!7 p-exp { if (contains(arg, "bake")) bakeTheBot(); test1(); test2(); test3(); } svoid test1 { BakedBot bot = bakedBotWithRules([[ inputContainsTokens("=>") && !inputStartsWith("!rule ") => output(Should I store this rule?) ]]); bot.setAuthorized(true); bot.check("bla => blubb", "Should I store this rule?"); assertEqualsVerbose("", unnull(callAnswerMethod(bot, "bla <= blubb"))); bot.check("!rule bla => bla", "Rule saved as *. Have 2 rules."); } svoid test2 { BakedBot bot = bakedBotWithRules([[ input(what is $chicken $wire?) => output(a $wire made from $chicken) ]]); bot.check("what is pork sausage?", "a sausage made from pork"); } svoid test3 { BakedBot bot = bakedBotWithRules([[ input(What is $gertrude $afraid_of?) && fact($gertrude is $afraid_of $wolves) => output($wolves) ]]); bot.setList("Fact-to-fact rules", [[ fact($gertrude is a $sheep) && fact($sheep are $afraid_of_wolves) => fact($gertrude is $afraid_of_wolves) ]]); bot.setList("Random Facts", [[ sheep are afraid of wolves Cats are afraid of dogs. Mice are afraid of cats. klaus is a sheep ]]); bot.answerAuthed("!deriveFacts"); assertEqualsVerbose_match("Klaus is afraid of wolves", bot.getList("Derived facts")); pnl((L) call(bot.bot, 'mL_facts)); call(bot.bot, 'setDebug, true); bot.check("What is Klaus afraid of", "Wolves"); }