File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -37,5 +37,11 @@ or (a b : Bool) : Bool := a || b;
37
37
--- Logical conjunction.
38
38
and (a b : Bool) : Bool := a && b;
39
39
40
+ --- Logical exclusive or.
41
+ xor : Bool -> Bool -> Bool
42
+ | true true := false
43
+ | false flase := false
44
+ | _ _ := true;
45
+
40
46
builtin assert
41
47
assert (x : Bool) : Bool := x;
Original file line number Diff line number Diff line change @@ -4,7 +4,15 @@ import Test.JuvixUnit open;
4
4
import Stdlib.Prelude open;
5
5
6
6
tests : List Test :=
7
- [testCase "And" (assertEqual "and works as expected" (and true false) false)];
7
+ [
8
+ testCase "And" (assertEqual "and works as expected" (and true false) false);
9
+ testCase
10
+ "Xor"
11
+ (assertEqual "and works as expected" (xor true false) (xor false true));
12
+ testCase
13
+ "Xor-2"
14
+ (assertEqual "and works as expected" (xor false false) (xor true true));
15
+ ];
8
16
9
17
suite : TestSuite := testSuite "Prelude" tests;
10
18
You can’t perform that action at this time.
0 commit comments