@@ -78,9 +78,9 @@ func TestParse(t *testing.T) {
78
78
}
79
79
80
80
// Check ~4M YYYY-MM-DD dates in 20 byte form.
81
- for year := 0 ; year <= 9999 ; year ++ {
82
- for month := 0 ; month <= 13 ; month ++ {
83
- for day := 0 ; day <= 32 ; day ++ {
81
+ for year := range 10000 {
82
+ for month := range 14 {
83
+ for day := range 33 {
84
84
input := fmt .Sprintf ("%04d-%02d-%02dT12:34:56Z" , year , month , day )
85
85
expect , expectErr := time .Parse (time .RFC3339Nano , input )
86
86
actual , actualErr := Parse (input )
@@ -94,9 +94,9 @@ func TestParse(t *testing.T) {
94
94
}
95
95
96
96
// Check ~4M YYYY-MM-DD dates in 24 byte form.
97
- for year := 0 ; year <= 9999 ; year ++ {
98
- for month := 0 ; month <= 13 ; month ++ {
99
- for day := 0 ; day <= 32 ; day ++ {
97
+ for year := range 10000 {
98
+ for month := range 14 {
99
+ for day := range 33 {
100
100
input := fmt .Sprintf ("%04d-%02d-%02dT12:34:56.789Z" , year , month , day )
101
101
expect , expectErr := time .Parse (time .RFC3339Nano , input )
102
102
actual , actualErr := Parse (input )
@@ -110,9 +110,9 @@ func TestParse(t *testing.T) {
110
110
}
111
111
112
112
// Check ~4M YYYY-MM-DD dates in 30 byte form.
113
- for year := 0 ; year <= 9999 ; year ++ {
114
- for month := 0 ; month <= 13 ; month ++ {
115
- for day := 0 ; day <= 32 ; day ++ {
113
+ for year := range 10000 {
114
+ for month := range 14 {
115
+ for day := range 33 {
116
116
input := fmt .Sprintf ("%04d-%02d-%02dT12:34:56.123456789Z" , year , month , day )
117
117
expect , expectErr := time .Parse (time .RFC3339Nano , input )
118
118
actual , actualErr := Parse (input )
@@ -126,9 +126,9 @@ func TestParse(t *testing.T) {
126
126
}
127
127
128
128
// Check all ~1M HH:MM:SS times in 20 byte form.
129
- for hour := 0 ; hour < 100 ; hour ++ {
130
- for minute := 0 ; minute < 100 ; minute ++ {
131
- for second := 0 ; second < 100 ; second ++ {
129
+ for hour := range 100 {
130
+ for minute := range 100 {
131
+ for second := range 100 {
132
132
input := fmt .Sprintf ("2000-01-01T%02d:%02d:%02dZ" , hour , minute , second )
133
133
expect , expectErr := time .Parse (time .RFC3339Nano , input )
134
134
actual , actualErr := Parse (input )
@@ -142,9 +142,9 @@ func TestParse(t *testing.T) {
142
142
}
143
143
144
144
// Check ~1M HH:MM:SS.MMM times in 24 byte form.
145
- for hour := 0 ; hour < 100 ; hour ++ {
146
- for minute := 0 ; minute < 100 ; minute ++ {
147
- for second := 0 ; second < 100 ; second ++ {
145
+ for hour := range 100 {
146
+ for minute := range 100 {
147
+ for second := range 100 {
148
148
input := fmt .Sprintf ("2000-01-01T%02d:%02d:%02d.123Z" , hour , minute , second )
149
149
expect , expectErr := time .Parse (time .RFC3339Nano , input )
150
150
actual , actualErr := Parse (input )
@@ -158,9 +158,9 @@ func TestParse(t *testing.T) {
158
158
}
159
159
160
160
// Check ~1M HH:MM:SS.MMM times in 30 byte form.
161
- for hour := 0 ; hour < 100 ; hour ++ {
162
- for minute := 0 ; minute < 100 ; minute ++ {
163
- for second := 0 ; second < 100 ; second ++ {
161
+ for hour := range 100 {
162
+ for minute := range 100 {
163
+ for second := range 100 {
164
164
input := fmt .Sprintf ("2000-01-01T%02d:%02d:%02d.123456789Z" , hour , minute , second )
165
165
expect , expectErr := time .Parse (time .RFC3339Nano , input )
166
166
actual , actualErr := Parse (input )
@@ -405,31 +405,31 @@ func TestParseInvalid(t *testing.T) {
405
405
}
406
406
407
407
func BenchmarkParse (b * testing.B ) {
408
- for i := 0 ; i < b .N ; i ++ {
408
+ for range b .N {
409
409
Parse ("2006-01-02T15:04:05Z" )
410
410
}
411
411
}
412
412
413
413
func BenchmarkParseMilliseconds (b * testing.B ) {
414
- for i := 0 ; i < b .N ; i ++ {
414
+ for range b .N {
415
415
Parse ("2006-01-02T15:04:05.123Z" )
416
416
}
417
417
}
418
418
419
419
func BenchmarkParseMicroseconds (b * testing.B ) {
420
- for i := 0 ; i < b .N ; i ++ {
420
+ for range b .N {
421
421
Parse ("2006-01-02T15:04:05.123456Z" )
422
422
}
423
423
}
424
424
425
425
func BenchmarkParseNanoseconds (b * testing.B ) {
426
- for i := 0 ; i < b .N ; i ++ {
426
+ for range b .N {
427
427
Parse ("2006-01-02T15:04:05.123456789Z" )
428
428
}
429
429
}
430
430
431
431
func BenchmarkParseInvalid (b * testing.B ) {
432
- for i := 0 ; i < b .N ; i ++ {
432
+ for range b .N {
433
433
Parse ("2006-01-02T15:04:05.XZ" )
434
434
}
435
435
}
0 commit comments