diff --git a/tests/baseline_compat/hyperon-mettalog_sanity/xor_test.metta b/tests/baseline_compat/hyperon-mettalog_sanity/xor_test.metta new file mode 100644 index 00000000000..de1b1c5d540 --- /dev/null +++ b/tests/baseline_compat/hyperon-mettalog_sanity/xor_test.metta @@ -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)