Trying to get code quality up, but in the process I've broken something -

I think, the simplifier.
This commit is contained in:
simon 2016-08-13 19:45:43 +01:00
parent d2a73ba408
commit 3168c1b2fb
9 changed files with 298 additions and 183 deletions

View file

@ -472,3 +472,15 @@
(is (nil? (apply afn (list {:x 0 :y 1} world)))
"Middle cell of the strip has only two high neighbours, so rule should not fire."))
))
(deftest regression-tests
(testing "Rule in default set which failed on switchover to declarative rules"
(let [afn (compile-rule "if state is scrub then 1 chance in 5 state should be forest")
world (transform-world
(make-world 3 3)
(list (compile-rule "if x is 2 then altitude should be 11")
(compile-rule "if x is less than 2 then state should be scrub")))]
(is (= (:state (apply afn (list {:x 1 :y 1} world))) :forest)
"Centre cell is scrub, so rule should fire")
(is (= (:state (apply afn (list {:x 2 :y 1} world))) :beach)
"Middle cell of the strip is not scrub, so rule should not fire."))))