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

36
LINES

< > BotCompany Repo | #1018498 // Test callOpt_cached

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Libraryless. Click here for Pure Java version (5787L/41K).

!7

set flag _MethodCache_debug.

sclass Bla {
  S ok() { ret 'jaOK; }
  int yo(int x) { ret x+5; }
  S yo(S x) { ret 'ja + x; }
  S testMe(int x) { ret 'int; }
}

sclass DaStatic {
  sS sOK() { ret 'sJaOK; }
  static int yo(int x) { ret x+5; }
  sS yo(S x) { ret 'ja + x; }
}

p-exp {
  twice {
    assertEqualsVerbose('jaOK, callOpt_cached(new Bla, 'ok));
    assertNull(callOpt_cached(new Bla, 'sOK));
    assertEqualsVerbose(15, callOpt_cached(new Bla, 'yo, 10));
    assertEqualsVerbose('jaX, callOpt_cached(new Bla, 'yo, 'X));
    assertNull(callOpt_cached(new Bla, 'yoyo));
    assertNull(callOpt_cached(new Bla, 'yo, 5.0));
    assertNull(callOpt_cached(Bla, 'ok)); // non-static method
    assertNull(callOpt_cached(new Bla, 'testMe, 'test));
    
    assertNull(callOpt_cached(DaStatic, 'ok));
    assertEqualsVerbose('sJaOK, callOpt_cached(DaStatic, 'sOK));
    assertEqualsVerbose(15, callOpt_cached(DaStatic, 'yo, 10));
    assertEqualsVerbose('jaX, callOpt_cached(DaStatic, 'yo, 'X));
    assertNull(callOpt_cached(DaStatic, 'yoyo));
    assertNull(callOpt_cached(DaStatic, 'yo, 5.0));
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018498
Snippet name: Test callOpt_cached
Eternal ID of this version: #1018498/7
Text MD5: fc8b9141683df7b6d69439648f615ecb
Transpilation MD5: 22a5e9826b80c18431220cce7b0bce27
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-02 12:29:55
Source code size: 1140 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 436 / 1302
Version history: 6 change(s)
Referenced in: [show references]