From a0aa434933a33b0af9f967206978a0c102603734 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Sat, 17 Aug 2019 10:07:58 +0100 Subject: [PATCH] Now up to seventy assertions... --- test/beowulf/bootstrap_test.clj | 42 +++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 5 deletions(-) diff --git a/test/beowulf/bootstrap_test.clj b/test/beowulf/bootstrap_test.clj index 785324b..7ac3936 100644 --- a/test/beowulf/bootstrap_test.clj +++ b/test/beowulf/bootstrap_test.clj @@ -49,9 +49,7 @@ (is (= actual expected) "A dotted pair is explicitly not an atom.")) (let [expected NIL actual (primitive-atom? (gsp "(A B C D)"))] - (is (= actual expected) "A list is explicitly not an atom")) - - )) + (is (= actual expected) "A list is explicitly not an atom")))) (deftest access-function-tests (testing "car" @@ -111,8 +109,7 @@ (testing "caaaar" (let [expected "1" actual (print-str (caaaar s))] - (is (= actual expected)))) - )) + (is (= actual expected)))))) (deftest equality-tests @@ -163,6 +160,12 @@ (deftest append-tests (testing "append" + (let [expected "(A B C . D)" + actual (print-str + (append + (gsp "(A B)") + (gsp "(C . D)")))] + (is (= actual expected))) (let [expected "(A B C D E)" actual (print-str (append @@ -185,4 +188,33 @@ actual (member (gsp "BERTRAM") (gsp "(ALBERT BELINDA CHARLIE DORIS ELFREDA FRED)"))] (= actual expected)))) +(deftest pairlis-tests + (testing "pairlis" + (let [expected "((A . U) (B . V) (C . W) (D . X) (E . Y))" + actual (print-str + (pairlis + (gsp "(A B C)") + (gsp "(U V W)") + (gsp "((D . X)(E . Y))")))] + (is (= actual expected))))) +(deftest assoc-tests + (testing "assoc" + (let [expected "(B CAR X)" + actual (print-str + (primitive-assoc + 'B + (gsp "((A . (M N)) (B . (CAR X)) (C . (QUOTE M)) (C . (CDR X)))")))] + (is (= actual expected))) + (let [expected "(C QUOTE M)" + actual (print-str + (primitive-assoc + 'C + (gsp "((A . (M N)) (B . (CAR X)) (C . (QUOTE M)) (C . (CDR X)))")))] + (is (= actual expected))) + (let [expected "NIL" + actual (print-str + (primitive-assoc + 'D + (gsp "((A . (M N)) (B . (CAR X)) (C . (QUOTE M)) (C . (CDR X)))")))] + (is (= actual expected)))))