Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Oct 30, 2024
1 parent 60d24af commit 1140fe1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/Compilation/Positive.hs
Original file line number Diff line number Diff line change
Expand Up @@ -480,5 +480,10 @@ tests =
"Test081: Non-duplication in let-folding"
$(mkRelDir ".")
$(mkRelFile "test081.juvix")
$(mkRelFile "out/test081.out")
$(mkRelFile "out/test081.out"),
posTest
"Test082: Pattern matching with side conditions"
$(mkRelDir ".")
$(mkRelFile "test082.juvix")
$(mkRelFile "out/test082.out")
]
1 change: 1 addition & 0 deletions tests/Compilation/positive/out/test082.out
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4
22 changes: 22 additions & 0 deletions tests/Compilation/positive/test082.juvix
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
-- Pattern matching with side conditions
module test082;

import Stdlib.Prelude open;

f (lst : List Nat) : Nat :=
case lst of
| [] := 0
| x :: xs
| if x == 0 := 1
| if true := 2;

g (lst : List Nat) : Nat :=
case lst of
| [] := 0
| _ :: _ if false := 0
| x :: xs
| if x == 0 := 1
| if false := 2
| if true := 3;

main : Nat := f [0; 1; 2] + g [1; 2];

0 comments on commit 1140fe1

Please sign in to comment.