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