1 Star 0 Fork 63

神以灵丶/carbon

forked from dromara/carbon 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
traveler_bench_test.go 13.56 KB
一键复制 编辑 原始数据 按行查看 历史
gouguoyin 提交于 2024-01-07 20:03 . 提升单元测试覆盖率
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
package carbon
import "testing"
func BenchmarkCarbon_Now(b *testing.B) {
for n := 0; n < b.N; n++ {
Now()
}
for n := 0; n < b.N; n++ {
Now(PRC)
}
}
func BenchmarkCarbon_Yesterday(b *testing.B) {
for n := 0; n < b.N; n++ {
Yesterday()
}
for n := 0; n < b.N; n++ {
Yesterday(PRC)
}
}
func BenchmarkCarbon_Tomorrow(b *testing.B) {
for n := 0; n < b.N; n++ {
Tomorrow()
}
for n := 0; n < b.N; n++ {
Tomorrow(PRC)
}
}
func BenchmarkCarbon_AddDuration(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddDuration("1s")
}
for n := 0; n < b.N; n++ {
NewCarbon().AddDuration("1s")
}
}
func BenchmarkCarbon_SubDuration(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubDuration("1s")
}
for n := 0; n < b.N; n++ {
NewCarbon().SubDuration("1s")
}
}
func BenchmarkCarbon_AddCenturies(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddCenturies(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddCenturies(1)
}
}
func BenchmarkCarbon_AddCenturiesNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddCenturiesNoOverflow(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddCenturiesNoOverflow(1)
}
}
func BenchmarkCarbon_AddCentury(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddCentury()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddCentury()
}
}
func BenchmarkCarbon_AddCenturyNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddCenturyNoOverflow()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddCenturyNoOverflow()
}
}
func BenchmarkCarbon_SubCenturies(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubCenturies(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubCenturies(1)
}
}
func BenchmarkCarbon_SubCenturiesNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubCenturiesNoOverflow(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubCenturiesNoOverflow(1)
}
}
func BenchmarkCarbon_SubCentury(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubCentury()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubCentury()
}
}
func BenchmarkCarbon_SubCenturyNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubCenturyNoOverflow()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubCenturyNoOverflow()
}
}
func BenchmarkCarbon_AddDecades(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddDecades(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddDecades(1)
}
}
func BenchmarkCarbon_AddDecadesNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddDecadesNoOverflow(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddDecadesNoOverflow(1)
}
}
func BenchmarkCarbon_AddDecade(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddDecade()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddDecade()
}
}
func BenchmarkCarbon_AddDecadeNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddDecadeNoOverflow()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddDecadeNoOverflow()
}
}
func BenchmarkCarbon_SubDecades(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubDecades(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubDecades(1)
}
}
func BenchmarkCarbon_SubDecadesNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubDecadesNoOverflow(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubDecadesNoOverflow(1)
}
}
func BenchmarkCarbon_SubDecade(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubDecade()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubDecade()
}
}
func BenchmarkCarbon_SubDecadeNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubDecadeNoOverflow()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubDecadeNoOverflow()
}
}
func BenchmarkCarbon_AddYears(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddYears(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddYears(1)
}
}
func BenchmarkCarbon_AddYearsNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddYearsNoOverflow(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddYearsNoOverflow(1)
}
}
func BenchmarkCarbon_AddYear(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddYear()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddYear()
}
}
func BenchmarkCarbon_AddYearNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddYearNoOverflow()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddYearNoOverflow()
}
}
func BenchmarkCarbon_SubYears(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubYears(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubYears(1)
}
}
func BenchmarkCarbon_SubYearsNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubYearsNoOverflow(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubYearsNoOverflow(1)
}
}
func BenchmarkCarbon_SubYear(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubYear()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubYear()
}
}
func BenchmarkCarbon_SubYearNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubYearNoOverflow()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubYearNoOverflow()
}
}
func BenchmarkCarbon_AddQuarters(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddQuarters(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddQuarters(1)
}
}
func BenchmarkCarbon_AddQuartersNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddQuartersNoOverflow(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddQuartersNoOverflow(1)
}
}
func BenchmarkCarbon_AddQuarter(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddQuarter()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddQuarter()
}
}
func BenchmarkCarbon_AddQuarterNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddQuarter()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddQuarter()
}
}
func BenchmarkCarbon_SubQuarters(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubQuarters(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubQuarters(1)
}
}
func BenchmarkCarbon_SubQuartersNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubQuartersNoOverflow(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubQuartersNoOverflow(1)
}
}
func BenchmarkCarbon_SubQuarter(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubQuarter()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubQuarter()
}
}
func BenchmarkCarbon_SubQuarterNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubQuarterNoOverflow()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubQuarterNoOverflow()
}
}
func BenchmarkCarbon_AddMonths(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddMonths(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddMonths(1)
}
}
func BenchmarkCarbon_AddMonthsNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddMonthsNoOverflow(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddMonthsNoOverflow(1)
}
}
func BenchmarkCarbon_AddMonth(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddMonth()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddMonth()
}
}
func BenchmarkCarbon_AddMonthNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddMonthNoOverflow()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddMonthNoOverflow()
}
}
func BenchmarkCarbon_SubMonths(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubMonths(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubMonths(1)
}
}
func BenchmarkCarbon_SubMonthsNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubMonthsNoOverflow(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubMonthsNoOverflow(1)
}
}
func BenchmarkCarbon_SubMonth(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubMonth()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubMonth()
}
}
func BenchmarkCarbon_SubMonthNoOverflow(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubMonthNoOverflow()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubMonthNoOverflow()
}
}
func BenchmarkCarbon_AddWeeks(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddWeeks(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddWeeks(1)
}
}
func BenchmarkCarbon_AddWeek(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddWeek()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddWeek()
}
}
func BenchmarkCarbon_SubWeeks(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubWeeks(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubWeeks(1)
}
}
func BenchmarkCarbon_SubWeek(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubWeek()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubWeek()
}
}
func BenchmarkCarbon_AddDays(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddDays(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddDays(1)
}
}
func BenchmarkCarbon_AddDay(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddDay()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddDay()
}
}
func BenchmarkCarbon_SubDays(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubDays(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubDays(1)
}
}
func BenchmarkCarbon_SubDay(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubDay()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubDay()
}
}
func BenchmarkCarbon_AddHours(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddHours(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddHours(1)
}
}
func BenchmarkCarbon_AddHour(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddHour()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddHour()
}
}
func BenchmarkCarbon_SubHours(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubHours(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubHours(1)
}
}
func BenchmarkCarbon_SubHour(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubHour()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubHour()
}
}
func BenchmarkCarbon_AddMinutes(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddMinutes(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddMinutes(1)
}
}
func BenchmarkCarbon_AddMinute(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddMinute()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddMinute()
}
}
func BenchmarkCarbon_SubMinutes(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubMinutes(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubMinutes(1)
}
}
func BenchmarkCarbon_SubMinute(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubMinute()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubMinute()
}
}
func BenchmarkCarbon_AddSeconds(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddSeconds(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddSeconds(1)
}
}
func BenchmarkCarbon_AddSecond(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddSecond()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddSecond()
}
}
func BenchmarkCarbon_SubSeconds(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubSeconds(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubSeconds(1)
}
}
func BenchmarkCarbon_SubSecond(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubSecond()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubSecond()
}
}
func BenchmarkCarbon_AddMilliseconds(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddMilliseconds(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddMilliseconds(1)
}
}
func BenchmarkCarbon_AddMillisecond(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddMillisecond()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddMillisecond()
}
}
func BenchmarkCarbon_SubMilliseconds(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubMilliseconds(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubMilliseconds(1)
}
}
func BenchmarkCarbon_SubMillisecond(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubMillisecond()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubMillisecond()
}
}
func BenchmarkCarbon_AddMicroseconds(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddMicroseconds(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddMicroseconds(1)
}
}
func BenchmarkCarbon_AddMicrosecond(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddMicrosecond()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddMicrosecond()
}
}
func BenchmarkCarbon_SubMicroseconds(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubMicroseconds(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubMicroseconds(1)
}
}
func BenchmarkCarbon_SubMicrosecond(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubMicrosecond()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubMicrosecond()
}
}
func BenchmarkCarbon_AddNanoseconds(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddNanoseconds(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().AddNanoseconds(1)
}
}
func BenchmarkCarbon_AddNanosecond(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.AddNanosecond()
}
for n := 0; n < b.N; n++ {
NewCarbon().AddNanosecond()
}
}
func BenchmarkCarbon_SubNanoseconds(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubNanoseconds(1)
}
for n := 0; n < b.N; n++ {
NewCarbon().SubNanoseconds(1)
}
}
func BenchmarkCarbon_SubNanosecond(b *testing.B) {
now := Now()
for n := 0; n < b.N; n++ {
now.SubNanosecond()
}
for n := 0; n < b.N; n++ {
NewCarbon().SubNanosecond()
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/latke/carbon.git
git@gitee.com:latke/carbon.git
latke
carbon
carbon
master

搜索帮助