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

22
LINES

< > BotCompany Repo | #1008992 // ctxTestIO

JavaX fragment (include)

static void ctxTestIO(S input, S regexp) {
  ctxTestIO("", input, regexp);
}

static void ctxTestIO(S prelude, S input, S regexp) {
  S desc = prelude + input + " -> " + regexp;
  regexp = ctxREToJavaRE(trim(multiSpacesToSingle(regexp)));
  print("\nTesting: " + desc);
  try {
    ctxContext().rulesFired.clear();
    ctxClearOutput();
    ctxProcessInput(input);
    ctxProcessRules();
    ctxDefaultOnEmptyOutput();
    S output = ctxDropEmotions(ctxGetOutput());
    bool ok = regexpIC(regexp, output).find();
    desc += " | " + struct(output) + " " + sfu(ctxContext().rulesFired);
    addTestResultVerbose(desc, ok);
  } catch e {
    addTestResult(desc, e);
  }
}

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: 441 / 452
Version history: 11 change(s)
Referenced in: [show references]