@@ -1095,10 +1095,10 @@ func FuzzParseRFC3339(f *testing.F) {
10951095func TestAppendIntWidth (t * testing.T ) {
10961096 values := []int {0 , - 1 , 1 , 10 , - 10 , 99 , - 99 , 9999 , - 9999 , 10001 }
10971097 for _ , v := range values {
1098- exp := AppendInt (nil , v , 4 )
1098+ want := AppendInt (nil , v , 4 )
10991099 got := AppendIntWidth4 (nil , v )
1100- if ! bytes .Equal (got , exp ) {
1101- t .Errorf ("AppendIntWidth4(%d) = %s, want %s" , v , got , exp )
1100+ if ! bytes .Equal (got , want ) {
1101+ t .Errorf ("AppendIntWidth4(%d) = %s, want %s" , v , got , want )
11021102 }
11031103 }
11041104}
@@ -1107,23 +1107,23 @@ func BenchmarkAppendIntWidth4(b *testing.B) {
11071107 b .Run ("name=AppendInt" , func (b * testing.B ) {
11081108 var buf = make ([]byte , 0 , 8 )
11091109 b .ResetTimer ()
1110- for i := 0 ; i < b . N ; i ++ {
1110+ for b . Loop () {
11111111 buf = AppendInt (buf [:0 ], 360 , 4 )
11121112 }
11131113 })
11141114 b .Run ("name=AppendIntWidth4" , func (b * testing.B ) {
11151115 var buf = make ([]byte , 0 , 8 )
11161116 b .ResetTimer ()
1117- for i := 0 ; i < b . N ; i ++ {
1117+ for b . Loop () {
11181118 buf = AppendIntWidth4 (buf [:0 ], 360 )
11191119 }
11201120 })
11211121}
11221122
11231123func BenchmarkTimeFormatRFC3339 (b * testing.B ) {
1124- tm := Now ( )
1124+ tm := Unix ( 1661201140 , 676836973 )
11251125 buf := make ([]byte , 0 , 64 )
1126- for i := 0 ; i < b . N ; i ++ {
1126+ for b . Loop () {
11271127 buf = tm .AppendFormat (buf [:0 ], RFC3339 )
11281128 }
11291129}
0 commit comments