github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/slice/test/slice_benchmark_test.go (about) 1 package test 2 3 import ( 4 "testing" 5 6 "github.com/m4gshm/gollections/slice" 7 ) 8 9 func Benchmark_IsValidIndex(b *testing.B) { 10 for i := 0; i < b.N; i++ { 11 r := slice.IsValidIndex(5, 0) 12 r = slice.IsValidIndex(5, 5) 13 r = slice.IsValidIndex(5, -1) 14 _ = r 15 } 16 } 17 18 func Benchmark_CanIterateByRange(b *testing.B) { 19 for i := 0; i < b.N; i++ { 20 r := slice.CanIterateByRange(slice.IterNoStarted, 5, 4) 21 r = slice.CanIterateByRange(slice.IterNoStarted, 5, 6) 22 r = slice.CanIterateByRange(slice.IterNoStarted, 5, slice.IterNoStarted) 23 _ = r 24 } 25 }