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

32
LINES

< > BotCompany Repo | #1021800 // gazelle_fakery_processInput_multi (and check output)

JavaX fragment (include)

svoid gazelle_fakery_processInput_multi(TreeMap<S> sections, O... _) {
  ErrorCounter errorCounter = optPar errorCounter(_, new ErrorCounter);
  for (fS key : startingWithIC(keys(sections), "test input")) errorCounter.run(key, r {
    LS inputLines = tlft(sections.get(key));
    S expectedOutput = sections.get(replaceIC(key, "test input", "expected output"));
    S expectedTempFacts = sections.get(replaceIC(key, "test input", "expected temporary facts"));
    print("\nPROCESSING: " + key + "\n");
    temporaryFacts.clear();
    
    new LS lines;
    for i over inputLines: {
      S input = inputLines.get(i);
      S user = leadingSquareBracketStuff(input);
      input = dropActuallyLeadingSquareBracketStuff(input);
      gazelle_gatherFulfillments(ll(nu GazelleLine(text := input, extras := litmap(+user))), fulfillments, debug := true);
      L<GazelleTree> l = dm_gazelle_reasonAboutChatInput_v2(user, input, paramsPlus(_,
        preContext := subList(inputLines, 0, i),
        requiredComment := null, debug := true));
      print("Got " + n2(l, "child", "children") + " with line types: " + collect lineType(l));
      for (GazelleTree t : l) {
        if (eq(t.lineType, "temporary fact"))
          temporaryFacts.add(printWithIndent("TEMP FACT> ", t.line));
        else
          lines.add(printWithIndent("OUT> ", t.line));
      }
    }
  
    assertEqualsVerbose(lines, tlft(expectedOutput));
    assertEqualsVerbose(asList(temporaryFacts), tlft(expectedTempFacts));
  });
  errorCounter.print();
}

Author comment

Began life as a copy of #1021763

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1021800
Snippet name: gazelle_fakery_processInput_multi (and check output)
Eternal ID of this version: #1021800/15
Text MD5: ca083cd97fc028df833e8e9a51226282
Author: stefan
Category: javax / gazelle
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-02-28 10:16:47
Source code size: 1553 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 272 / 284
Version history: 14 change(s)
Referenced in: [show references]