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)

1  
svoid gazelle_fakery_processInput_multi(TreeMap<S> sections, O... _) {
2  
  ErrorCounter errorCounter = optPar errorCounter(_, new ErrorCounter);
3  
  for (fS key : startingWithIC(keys(sections), "test input")) errorCounter.run(key, r {
4  
    LS inputLines = tlft(sections.get(key));
5  
    S expectedOutput = sections.get(replaceIC(key, "test input", "expected output"));
6  
    S expectedTempFacts = sections.get(replaceIC(key, "test input", "expected temporary facts"));
7  
    print("\nPROCESSING: " + key + "\n");
8  
    temporaryFacts.clear();
9  
    
10  
    new LS lines;
11  
    for i over inputLines: {
12  
      S input = inputLines.get(i);
13  
      S user = leadingSquareBracketStuff(input);
14  
      input = dropActuallyLeadingSquareBracketStuff(input);
15  
      gazelle_gatherFulfillments(ll(nu GazelleLine(text := input, extras := litmap(+user))), fulfillments, debug := true);
16  
      L<GazelleTree> l = dm_gazelle_reasonAboutChatInput_v2(user, input, paramsPlus(_,
17  
        preContext := subList(inputLines, 0, i),
18  
        requiredComment := null, debug := true));
19  
      print("Got " + n2(l, "child", "children") + " with line types: " + collect lineType(l));
20  
      for (GazelleTree t : l) {
21  
        if (eq(t.lineType, "temporary fact"))
22  
          temporaryFacts.add(printWithIndent("TEMP FACT> ", t.line));
23  
        else
24  
          lines.add(printWithIndent("OUT> ", t.line));
25  
      }
26  
    }
27  
  
28  
    assertEqualsVerbose(lines, tlft(expectedOutput));
29  
    assertEqualsVerbose(asList(temporaryFacts), tlft(expectedTempFacts));
30  
  });
31  
  errorCounter.print();
32  
}

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: 356 / 368
Version history: 14 change(s)
Referenced in: [show references]