2 Star 0 Fork 70

golang-package/carbon

forked from dromara/carbon 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
extremum_bench_test.go 1.13 KB
一键复制 编辑 原始数据 按行查看 历史
kuafuRace 提交于 26天前 . test: Add b.ResetTimer()
package carbon
import (
"testing"
)
func BenchmarkMaxValue(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
MaxValue()
}
}
func BenchmarkMinValue(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
MinValue()
}
}
func BenchmarkMaxDuration(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
MaxDuration()
}
}
func BenchmarkMinDuration(b *testing.B) {
b.ResetTimer()
for n := 0; n < b.N; n++ {
MinDuration()
}
}
func BenchmarkMax(b *testing.B) {
c1 := Parse("2020-08-06")
c2 := Parse("2021-08-05")
b.ResetTimer()
for n := 0; n < b.N; n++ {
Max(c1, c2)
}
}
func BenchmarkMin(b *testing.B) {
c1 := Parse("2020-08-06")
c2 := Parse("2021-08-05")
b.ResetTimer()
for n := 0; n < b.N; n++ {
Min(c1, c2)
}
}
func BenchmarkCarbon_Closest(b *testing.B) {
c1 := Parse("2020-08-04")
c2 := Parse("2020-08-05")
c3 := Parse("2021-08-06")
b.ResetTimer()
for n := 0; n < b.N; n++ {
c1.Closest(c2, c3)
}
}
func BenchmarkCarbon_Farthest(b *testing.B) {
c1 := Parse("2020-08-04")
c2 := Parse("2020-08-05")
c3 := Parse("2021-08-06")
b.ResetTimer()
for n := 0; n < b.N; n++ {
c1.Farthest(c2, c3)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/golang-package/carbon.git
git@gitee.com:golang-package/carbon.git
golang-package
carbon
carbon
master

搜索帮助