Skip to content

Commit 7a4c78c

Browse files
committed
Fix benchmark tests
1 parent 28b3135 commit 7a4c78c

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ High performance C99-compatible `strftime` formatter for Go.
1616
Comparision with the standard library `time.(*Time).Format()`:
1717

1818
```
19-
> go test -bench Bench -cpu 4 -benchmem .
19+
> go test -tags bench -bench Bench -cpu 4 -benchmem .
2020
2121
goos: darwin
2222
goarch: amd64
@@ -30,7 +30,7 @@ ok github.com/imperfectgo/go-strftime 4.245s
3030
Comparision with other libraries:
3131

3232
```
33-
> go test -bench Bench -cpu 8 -benchmem ./benchmark
33+
> go test -tags benchcomp -bench Bench -cpu 8 -benchmem .
3434
3535
goos: darwin
3636
goarch: amd64
@@ -48,4 +48,5 @@ ok github.com/imperfectgo/go-strftime/benchmark 10.605s
4848
## License
4949

5050
This project can be treated as a derived work of time package from golang standard library.
51+
5152
Licensed under the Modified (3-clause) BSD license.

benchmark_comp_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2018 Timon Wong. All rights reserved.
22

3-
// +build bench
3+
// +build benchcomp
44

55
package strftime_test
66

benchmark_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5+
// +build bench
6+
57
package strftime_test
68

79
import (

example_test.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,21 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
package strftime_test
5+
package strftime
66

77
import (
88
"fmt"
99
"time"
10-
11-
"github.com/imperfectgo/go-strftime"
1210
)
1311

1412
func ExampleFormat() {
1513
t := time.Date(2008, 9, 3, 20, 4, 26, 654321000, time.FixedZone("CST", 8*3600))
1614

17-
fmt.Println(strftime.Format(t, "%c"))
18-
fmt.Println(strftime.Format(t, "%Y-%m-%dT%H:%M:%S.%f%z"))
19-
fmt.Println(strftime.Format(t, "%A is day number %w of the week."))
20-
fmt.Println(strftime.Format(t, "Last century was%n the %Cth century."))
21-
fmt.Println(strftime.Format(t, "Time zone: %Z"))
15+
fmt.Println(Format(t, "%c"))
16+
fmt.Println(Format(t, "%Y-%m-%dT%H:%M:%S.%f%z"))
17+
fmt.Println(Format(t, "%A is day number %w of the week."))
18+
fmt.Println(Format(t, "Last century was%n the %Cth century."))
19+
fmt.Println(Format(t, "Time zone: %Z"))
2220

2321
// Output:
2422
// Wed Sep 3 20:04:26 2008

0 commit comments

Comments
 (0)