Uses 911K of libraries. Click here for Pure Java version (11778L/66K).
!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!"); } } }
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025616 |
Snippet name: | Auto-Test philosophy engine with counter example [broken?] |
Eternal ID of this version: | #1025616/19 |
Text MD5: | efc444cf4af5a6007179ce9abbf3ca6a |
Transpilation MD5: | 11ed1d84e1cfb3acd4dc0f451c56e9d3 |
Author: | stefan |
Category: | |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-10-17 14:49:05 |
Source code size: | 1594 bytes / 68 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 301 / 998 |
Version history: | 18 change(s) |
Referenced in: | [show references] |