github.com/m4gshm/gollections@v0.0.13-0.20240331203319-a34a86e58a24/internal/examples/loopexamples/range_Closed_test.go (about) 1 package loopexamples 2 3 import ( 4 "testing" 5 6 "github.com/stretchr/testify/assert" 7 8 "github.com/m4gshm/gollections/loop/range_" 9 ) 10 11 func Test_RangeClosed(t *testing.T) { 12 13 var increasing = range_.Closed(-1, 3).Slice() //[]int{-1, 0, 1, 2, 3} 14 var decreasing = range_.Closed('e', 'a').Slice() //[]rune{'e', 'd', 'c', 'b', 'a'} 15 var one = range_.Closed(1, 1).Slice() //[]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 }