or between here and microworld.engine, because compiled rules which pass all the unit tests nevertheless fail in integration testing.
26 lines
1.1 KiB
Clojure
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")
|
|
))
|
|
|