static void ctxTestRule(S input, S ruleName) { ctxTestRule("", input, ruleName); } static void ctxTestRule(S prelude, S input, S ruleName) { //ruleName = addPrefix("Agent#", ruleName); S desc = prelude + input + " -> " + ruleName; print("\nTesting: " + desc); try { ctxContext().rulesFired.clear(); ctxClearOutput(); ctxProcessInput(input); ctxProcessRules(); ctxDefaultOnEmptyOutput(); S output = ctxGetOutput(); bool ok1 = ctxContext().rulesFired.contains(ruleName); if (!ok1) desc += " was: " + struct(ctxContext().rulesFired); bool ok2 = nempty(output); if (!ok2) desc += " no output"; else desc += " output: " + quote(output); addTestResult(desc, (boolToInt(ok1)+boolToInt(ok2))*50); } catch e { addTestResult(desc, e); } }