Skip to content

Commit

Permalink
Inc range tests with start == end and neg. step
Browse files Browse the repository at this point in the history
Add tests with `start == end` for negative (and positive, since it was
missing) step. Also, add inclusive range test with a zero step, and
remove some duplicate test cases.
  • Loading branch information
sortraev committed Nov 26, 2024
1 parent ef92359 commit 84b1426
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tests/range0.fut
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,20 @@
-- input { 1 5 } output { [1i32, 2i32, 3i32, 4i32, 5i32] }
-- input { 5 1 } error: 5...1
-- input { 5 0 } error: 5...0
-- input { 0 5 } output { [0i32, 1i32, 2i32,
-- 3i32, 4i32, 5i32] }

-- ==
-- entry: test1
-- input { 0 5 } output { [0i32, 1i32, 2i32, 3i32, 4i32] }
-- input { 1 5 } output { [1i32, 2i32, 3i32, 4i32] }
-- input { 5 1 } error: 5..<1
-- input { 5 0 } error: 5..<0
-- input { 0 5 } output { [0i32, 1i32, 2i32, 3i32, 4i32] }

-- ==
-- entry: test2
-- input { 0 5 } error: 0..>5
-- input { 1 5 } error: 1..>5
-- input { 5 1 } output { [5i32, 4i32, 3i32, 2i32] }
-- input { 5 0 } output { [5i32, 4i32, 3i32, 2i32, 1i32] }
-- input { 0 5 } error: 0..>5

-- ==
-- entry: test3
Expand All @@ -31,6 +27,9 @@
-- input { 5 4 1 } output { [5i32, 4i32, 3i32, 2i32, 1i32] }
-- input { 5 0 0 } output { [5i32, 0i32] }
-- input { 0 2 5 } output { [0i32, 2i32, 4i32] }
-- input { 1 1 5 } error: 1..1...5
-- input { 1 0 1 } output { [1i32] }
-- input { 1 2 1 } output { [1i32] }

-- ==
-- entry: test4
Expand Down

0 comments on commit 84b1426

Please sign in to comment.