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

21
LINES

< > BotCompany Repo | #1001055 // assertEquals - not using structure() for making the message anymore [saving code]

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (3040L) is out of date.

static <A> A assertEquals(O x, A y) {
  ret assertEquals("", x, y);
}

static <A> A assertEquals(S msg, O x, A y) {
  if (assertVerbose()) ret assertEqualsVerbose(msg, x, y);
  if (!(x == null ? y == null : x.equals(y)))
    fail((msg != null ? msg + ": " : "") + y + " != " + x);
  ret y;
}

ifclass Scorer
  svoid assertEquals(Scorer scorer, O x, O y) {
    assertEquals(scorer, "", x, y);
  }
  
  svoid assertEquals(Scorer scorer, S msg, O x, O y) {
    if (scorer == null) ret with assertEquals(msg, x, y);
    scorer.add(eq(x, y), nullIfEmpty(msg));
  }
endif

download  show line numbers  debug dex  old transpilations   

Travelled to 17 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, ppjhyzlbdabe, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001055
Snippet name: assertEquals - not using structure() for making the message anymore [saving code]
Eternal ID of this version: #1001055/8
Text MD5: 6642b41586c4b70c9d4af11e8c8aa5e4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-08-11 06:09:11
Source code size: 585 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 1018 / 5022
Version history: 7 change(s)
Referenced in: #1001840 - assertEq - synonym of assertEquals
#1002427 - Accellerating 629 (SPIKE)
#1002936 - assertEqualsVerbose
#1005240 - assertEqic - like assertEquals, ignoring case
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1012660 - assertContains
#1012948 - assertSignEquals - test sign of int
#1014963 - assertEqualsQuick - no stack trace, no message
#1023360 - assertEqualsOptionalVerbose
#1028918 - assertEquals_quote - print quoted
#1033288 - assertDoublesVeryClose
#3000382 - Answer for ferdie (>> t = 1, f = 0)