Warning: session_start(): open(/var/lib/php/sessions/sess_eipilrrmnpe36avu1jbf4sk5vv, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
cmodule TestPhilosophyEngine > DynPrintLog {
sS program = [[
program (
count
count => proc {
while (i < 100):
inc i
}
) with declarations (static int i;)
and init code (
bot.addNativePredicate("i < 100",
() -> i < 100);
bot.addNativePredicate("inc i",
() -> {
++i;
print("Incremented i to " + i);
true;
});
) should end with (i == 100)
]];
start-thread {
new PhilosophyBot1 main;
main.program = program;
main.run();
pnl(main.facts);
for (SS map : main.matchFacts(
[[ program var_p
with declarations var_d
and init code var_i
should end with var_c
]])) {
S program = map.get("var_p"), declarations = map.get("var_d"),
initCode = map.get("var_i"), endCondition = map.get("var_c");
printVars(+program, +endCondition);
// Now build some JavaX code!
S javax = joinWithEmptyLines(
declarations,
"static new PhilosophyBot1 bot;",
"p {",
"bot.program = " + quote(program) + ";",
initCode,
"bot.run();",
"assertTrueVerbose(" + endCondition + ");",
"}");
printWithIndent("JAVAX> ", javax);
// do the JavaX super-magic
Class c = veryQuickJava(javax);
// now we can call the function we just made
callMain(c);
// assert succeeded, so we're good
print("Test succeeded!");
}
}
}