-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/TeamSPoon/metta-wam
- Loading branch information
Showing
4 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
tests/baseline_compat/hyperon-mettalog_sanity/xor_test.metta
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
;; Basic XOR Logic | ||
!(assertEqual (xor True False) True) | ||
!(assertEqual (xor False True) True) | ||
!(assertEqual (xor True True) False) | ||
!(assertEqual (xor False False) False) | ||
|
||
;; XOR with Expressions | ||
!(assertEqual (xor (> 5 3) (< 2 1)) True) | ||
!(assertEqual (xor (== 1 1) (== 2 2)) False) | ||
!(assertEqual (xor (not True) (and True False)) False) | ||
|
||
(: mprogn (-> Atom Atom Atom )) | ||
(= (mprogn $code1 $code2) (let $_ (eval $code1) (eval $code2))) | ||
|
||
;; XOR with Side Effects to Ensure Both Expressions Are Evaluated | ||
!(assertEqual (xor (mprogn (println! "First") True) (mprogn (println! "Second") False)) True) | ||
!(assertEqual (xor (mprogn (println! "First") True) (mprogn (println! "Second") True)) False) | ||
!(assertEqual (xor (mprogn (println! "First") False) (mprogn (println! "Second") True)) True) | ||
!(assertEqual (xor (mprogn (println! "First") False) (mprogn (println! "Second") False)) False) |