Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

25
LINES

< > BotCompany Repo | #1025753 // test_FactStore (OK)

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7672L/49K).

1  
svoid test_FactStore() {
2  
  PhilosophyBot1 bot = new([[
3  
    $x weighs $y
4  
      => proc {
5  
        delete all (last time $x weighed $z)
6  
        store      (last time $x weighed $y)
7  
      }
8  
  ]]);
9  
  //bot.printNonMatches = true;
10  
  bot.parseProgram();
11  
  new SimpleFactStore fs;
12  
  fs.verbose = true;
13  
  philosophyBot1_factStore(bot, fs, debug := true);
14  
  bot.addFact("a weighs (50 pounds)");
15  
  bot.addFact("b weighs (55 pounds)");
16  
  bot.think();
17  
  assertEqualsVerbose(ll(
18  
    "last time a weighed (50 pounds)",
19  
    "last time b weighed (55 pounds)"), sorted(fs.facts()));
20  
  bot.addFact("a weighs (52 pounds)");
21  
  bot.think();
22  
  assertEqualsVerbose(ll(
23  
    "last time a weighed (52 pounds)",
24  
    "last time b weighed (55 pounds)"), sorted(fs.facts()));
25  
}

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: #1025753
Snippet name: test_FactStore (OK)
Eternal ID of this version: #1025753/9
Text MD5: a873c4af8f8101e835db23c12ac7f879
Transpilation MD5: d41bee981c85c724c8fcbc79400e0faf
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-17 23:06:22
Source code size: 770 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 226 / 378
Version history: 8 change(s)
Referenced in: [show references]