File: bench_test.go

package info (click to toggle)
golang-github-djherbis-times 1.0.1%2Bgit20170215.d25002f-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 124 kB
  • sloc: makefile: 2
file content (29 lines) | stat: -rw-r--r-- 391 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package times

import (
	"os"
	"testing"
)

func BenchmarkGet(t *testing.B) {
	fileTest(t, func(f *os.File) {
		fi, err := os.Stat(f.Name())
		if err != nil {
			t.Error(err)
		}

		for i := 0; i < t.N; i++ {
			Get(fi)
		}
	})
	t.ReportAllocs()
}

func BenchmarkStat(t *testing.B) {
	fileTest(t, func(f *os.File) {
		for i := 0; i < t.N; i++ {
			Stat(f.Name())
		}
	})
	t.ReportAllocs()
}