OSDN Git Service

[1] Some test for 'subst-tree' were added.
authorU-tackya-PC\tackya <yammouch@users.sourceforge.jp>
Sat, 7 May 2011 08:36:40 +0000 (17:36 +0900)
committerU-tackya-PC\tackya <yammouch@users.sourceforge.jp>
Sat, 7 May 2011 08:36:40 +0000 (17:36 +0900)
test/unify_matcher.clj

index 7225dd9..f3f6341 100755 (executable)
     (is (= (um/subst b '?*xs) ()))
     ))
 
+(deftest test-subst-tree
+  (let [b '{?x 0, ?y 1, ?*z [2 3 4]}]
+    (is (= (um/subst-tree b '[?x ?y ?*z])
+           '[0 1 2 3 4]))
+    (is (= (um/subst-tree b '[?*z ?x ?y])
+           '[2 3 4 0 1]))
+    (is (= (um/subst-tree b '[a b [c ?*z] ?y [?*z]])
+           '[a b [c 2 3 4] 1 [2 3 4]]))))
+
 (deftest test-vars-in
   (is (= (um/vars-in '((?x (?y ?z) ?*xs) ?a b ?*c))
          '#{?x ?y ?z ?*xs ?a ?*c})))