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

57
LINES

< > BotCompany Repo | #1025736 // Philosophy bot main test (musings, FactStore)

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (20075L/110K).

!7

cmodule TestPhilosophyBot1 > DynPrintLog {
  transient LS musingSnippets = ll(#1025734, #1025756);
  
  transient ReliableSingleThread rstUpdateList = dm_rstWithDelay(this, 0.5, r updateListImpl);
  transient LS errors = listWithNotify(rstUpdateList);
  transient JList jList;
  
  visual jhsplit(super,
    jCenteredLiveValueSection(dm_calculatedLiveValue(S, () -> "Errors (" + l(errors) + ")"),
      jList = listPopupMenuItemsThreaded(jlist(errors),
        "Show text", r { showText("Test Error", selectedItem(jList)) }
  )));
  
  start-thread {
    for (S snippetID : musingSnippets)
      dm_onSnippetEdited(snippetID, r dm_reload);

    try {
      new Scorer<S> scorer; // infos are print logs
      errors.clear();
      scorer.errors = errors;
      Var<Int> n = new(0);
      
      for (S snippetID : musingSnippets) {
        Scorer scorer2, int n2 = unpair test_PhilosophyBot1(snippetID);
        incIntVar(n, n2);
        scorer.add(scorer2);
      }

      // local DB
      for (S musing : (LS) collect text((Cl) dm_call(dm_aiMusingsCRUD(), "concepts")))
        addTestToScorerWithPrintLog(scorer, r {
          incIntVar(n, ai_checkMusing(musing));
        });
      
      for (Runnable r : ll(
        r test_FactStore,
        r test_philosophyBot1_nativePredicateOnLHS,
        r test_philosophyBot1_dropCommentParagraphs,
      ))
        addTestToScorerWithPrintLog(scorer, r);

      if (scorer.allCorrect())
        infoBox("PhilosophyBot1 tested OK - " + n2(n!, "expectation") + " tested / " + scorer);
      else
        infoBox("PhilosophyBot1 failures - " + n2(n!, "expectation") + " tested / " + scorer);
    } on fail {
      infoBox("PhilosophyBot1 fail");
    }
  }
  
  void updateListImpl {
    fillListWithStrings(jList, errors);
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1025736
Snippet name: Philosophy bot main test (musings, FactStore)
Eternal ID of this version: #1025736/25
Text MD5: 28369e1c6e9de9d3cbe49e5537b419d7
Transpilation MD5: c35e3fa03b0bfe68c8dd615e2ead58d7
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-20 16:11:35
Source code size: 1828 bytes / 57 lines
Pitched / IR pitched: No / No
Views / Downloads: 284 / 12659
Version history: 24 change(s)
Referenced in: [show references]