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

30
LINES

< > BotCompany Repo | #1002936 - assertEqualsVerbose

JavaX fragment (include)

static <A> A assertEqualsVerbose(O x, A y) {
  assertEqualsVerbose((S) null, x, y);
  ret y;
}

static <A> A assertEqualsVerbose(S msg, O x, A y) {
  if (!eq(x, y)) {
    ifdef assertEqualsVerbose_advancedDiff
    if (x instanceof S && y instanceof S && (containsNewLine((S) x) || containsNewLine((S) y)))
      nlPrintNL(unidiff((S) x, (S) y));
    endifdef

    fail((msg != null ? msg + ": " : "") + /*sfu*/(y) + " != " + /*sfu*/(x));
  } else
    print("OK: " + /*sfu*/(x));
  ret y;
}

ifclass Scorer
static void assertEqualsVerbose(Scorer scorer, O x, O y) {
  if (scorer == null) ret with assertEqualsVerbose(x, y);
  if (!eq(x, y)) {
    print(/*sfu*/(y) + " != " + /*sfu*/(x));
    scorer.add(false);
  } else {
    print("OK: " + /*sfu*/(x));
    scorer.add(true);
  }
}
endif

Author comment

Began life as a copy of #1001055

download  show line numbers  debug dex   

Travelled to 10 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

No comments. add comment

Snippet ID: #1002936
Snippet name: assertEqualsVerbose
Eternal ID of this version: #1002936/16
Text MD5: 738c34019b627e0cf1fc64d2a86d83b9
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-15 17:02:46
Source code size: 815 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 465 / 446
Version history: 15 change(s)
Referenced in: [show references]

Formerly at http://tinybrain.de/1002936 & http://1002936.tinybrain.de