mw-parser/test/microworld/parser/bulk_test.clj
simon 2788cac40f 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.
2016-09-24 14:20:43 +01:00

26 lines
1.1 KiB
Clojure

(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")
))