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

31
LINES

< > BotCompany Repo | #1002936 - assertEqualsVerbose

JavaX fragment (include)

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

// x = expected, y = actual
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 + ": " : "") + "expected: "+ x + ", got: " + y);
  } 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 11 computer(s): aoiabmzegqzx, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz, xrpafgyirdlv

No comments. add comment

Snippet ID: #1002936
Snippet name: assertEqualsVerbose
Eternal ID of this version: #1002936/19
Text MD5: bb6614719d11ea8a22e3912b85666b4a
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-05-17 14:26:40
Source code size: 843 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 488 / 488
Version history: 18 change(s)
Referenced in: [show references]

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