github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/internal/examples/sliceexamples/range_Of_test.go (about) 1 package sliceexamples 2 3 import ( 4 "testing" 5 6 "github.com/m4gshm/gollections/slice/range_" 7 "github.com/stretchr/testify/assert" 8 ) 9 10 func Test_RangeOf(t *testing.T) { 11 12 var increasing = range_.Of(-1, 3) //[]int{-1, 0, 1, 2} 13 var decreasing = range_.Of('e', 'a') //[]rune{'e', 'd', 'c', 'b'} 14 var nothing = range_.Of(1, 1) //nil 15 16 assert.Equal(t, []int{-1, 0, 1, 2}, increasing) 17 assert.Equal(t, []rune{'e', 'd', 'c', 'b'}, decreasing) 18 assert.Nil(t, nothing) 19 }