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

22
LINES

< > BotCompany Repo | #1008992 // ctxTestIO

JavaX fragment (include)

1  
static void ctxTestIO(S input, S regexp) {
2  
  ctxTestIO("", input, regexp);
3  
}
4  
5  
static void ctxTestIO(S prelude, S input, S regexp) {
6  
  S desc = prelude + input + " -> " + regexp;
7  
  regexp = ctxREToJavaRE(trim(multiSpacesToSingle(regexp)));
8  
  print("\nTesting: " + desc);
9  
  try {
10  
    ctxContext().rulesFired.clear();
11  
    ctxClearOutput();
12  
    ctxProcessInput(input);
13  
    ctxProcessRules();
14  
    ctxDefaultOnEmptyOutput();
15  
    S output = ctxDropEmotions(ctxGetOutput());
16  
    bool ok = regexpIC(regexp, output).find();
17  
    desc += " | " + struct(output) + " " + sfu(ctxContext().rulesFired);
18  
    addTestResultVerbose(desc, ok);
19  
  } catch e {
20  
    addTestResult(desc, e);
21  
  }
22  
}

Author comment

Began life as a copy of #1008973

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008992
Snippet name: ctxTestIO
Eternal ID of this version: #1008992/12
Text MD5: f894f1fb0f439730ac0ba2276ab6a3b4
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-14 18:54:38
Source code size: 691 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 447 / 457
Version history: 11 change(s)
Referenced in: [show references]