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

16
LINES

< > BotCompany Repo | #1023149 // testAttractorBotResponse

JavaX fragment (include)

svoid testAttractorBotResponse(AttractorBot bot, S input, S expectedOutput, O... _) {
  bool fail = !boolPar noFail(_);
  new LS out;
  temp tempSet(bot, say := vfAddToCollection(out));
  bot.addInput(input);
  if (empty(expectedOutput)) {
    if (!empty(out)) ret with failOrWarn(fail, "Bot returned unexpected output: " + multiLineQuote(lines_rtrim(out)));
  } else {
    if (!cic(out, expectedOutput))
      ret with failOrWarn(fail, "Bot didn't return " + multiLineQuote(expectedOutput) + ", instead said: " + multiLineQuote(lines_rtrim(out)));
    print("OK, bot said: " + first(out));
    LS rest = listWithoutIC(out, expectedOutput);
    if (nempty(rest))
      ret with failOrWarn(fail, "Bot returned additional lines: " + rest);
  }
}

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: #1023149
Snippet name: testAttractorBotResponse
Eternal ID of this version: #1023149/12
Text MD5: f1f47d8176b620e4bec61cefe04d0514
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-19 12:17:10
Source code size: 758 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 203 / 259
Version history: 11 change(s)
Referenced in: [show references]