Add test for ranges

This commit is contained in:
Bruce Hill 2024-08-10 14:52:42 -04:00
parent df7a8508c8
commit 416300287f

22
test/ranges.tm Normal file
View File

@ -0,0 +1,22 @@
func main():
>> Range(1, 5) == 1:to(5)
= yes
>> 1:to(5) == 5:to(1):reversed()
= yes
>> Range(1, 5) == Range(5, 10)
= no
>> [i for i in 3:to(5)]
= [3, 4, 5]
>> [i for i in 3:to(10):by(2)]
= [3, 5, 7, 9]
>> [i for i in 3:to(10):reversed():by(2)]
= [10, 8, 6, 4]
>> [i for i in (2:to(10):by(2)):by(2)]
= [2, 6, 10]