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

21
LINES

< > BotCompany Repo | #1001598 // assertTrue - no longer accepts a function returning a boolean

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

Libraryless. Click here for Pure Java version (9373L/52K).

static void assertTrue(O o) {
  if (!(eq(o, true) /*|| isTrue(pcallF(o))*/))
    fail(str(o));
}
  
static bool assertTrue(S msg, bool b) {
  if (!b)
    fail(msg);
  ret b;
}

static bool assertTrue(bool b) {
  if (!b)
    fail("oops");
  ret b;
}

sbool assertTrue(Scorer scorer, bool b) {
  scorer.add(b);
  ret b;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 21 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, ekrmjmnbrukm, gwrvuhgaqvyk, ishqpsrjomds, jozkyjcghlvl, lpdgvwnxivlt, mowyntqkapby, mqqgnosmbjvj, odhhsrjjbcgr, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, whxojlpjdney, xrpafgyirdlv

No comments. add comment

Snippet ID: #1001598
Snippet name: assertTrue - no longer accepts a function returning a boolean
Eternal ID of this version: #1001598/8
Text MD5: b17c912257dd4575f0ac0bee13f2d625
Transpilation MD5: a97cbaf246cc9dd9d12bfefebdce10cb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-26 01:15:49
Source code size: 339 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 708 / 4089
Version history: 7 change(s)
Referenced in: #1001967 - assertFalse
#1002012 - assertNotNull
#1002021 - booleanValue - defaults to false for null or a random value
#1002427 - Accellerating 629 (SPIKE)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1014401 - assertTrueVerbose
#3000382 - Answer for ferdie (>> t = 1, f = 0)