1: Great renaming in pursuit of a CLJC-viable parser. There is still a bug here,

or between here and microworld.engine, because compiled rules which pass all the
unit tests nevertheless fail in integration testing.
This commit is contained in:
simon 2016-09-24 14:20:43 +01:00
parent 88d707a32e
commit 2788cac40f
12 changed files with 64 additions and 52 deletions

View file

@ -0,0 +1,25 @@
(ns microworld.parser.bulk-test
(:use clojure.java.io)
(:require [clojure.test :refer :all]
[microworld.parser.bulk :refer :all]))
(deftest bulk-parsing-test
(testing "Bulk (file) parsing and compilation"
(is (= (count (parse-file (as-file "resources/rules.txt"))) 15)
"Should parse all rules and throw no exceptions")
(is (empty?
(remove #(= % ':RULE)
(map first
(parse-file
(as-file "resources/rules.txt")))))
"all parsed rules should be lambda sexprs")
(is (= (count (compile-file (as-file "resources/rules.txt"))) 15)
"Should compile all rules and throw no exceptions")
(is (empty?
(remove ifn?
(map first
(compile-file
(as-file "resources/rules.txt")))))
"all compiled rules should be ifns")
))