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

37
LINES

< > BotCompany Repo | #1011515 // Test smallestList [OK]

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

Download Jar. Libraryless. Click here for Pure Java version (4596L/30K).

!7

p {
  // ll method
  for (int n = 0; n <= 10; n++) {
    O[] data = repArrayF(f aGlobalID, n);
    O l = smallestList_ll(data);
    check(data, l);
  }
  
  // add method
  O l = null;
  O[] data = new O[0];
  for (int n = 0; n <= 10; n++) {
    check(data, l);
    data = addToObjectArray(data, aGlobalID());
    l = smallestList_add(l, last(data));
  }
  
  print("OK!");
}

svoid check(O[] data, O l) {
  int n = l(data);
  print("Size " + n + ": " + sfu(l));
  assertEquals(n, smallestList_l(l));
  for i to n:
    assertEquals(data[i], smallestList_get(l, i));
  assertEquals(asList(data), new L(smallestList_asList(l)));
    
  int size = 0;
  if (l != null)
    if (l instanceof S) size = 0;
    else size = toInt(unsafe_sizeOf(l));
  print("Bytes used for list: " + size + " bytes");
  printStruct(unsafe_allFieldOffsets(l));
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1011515
Snippet name: Test smallestList [OK]
Eternal ID of this version: #1011515/10
Text MD5: 72a9f626a6813d794dc13ba0192cf9ae
Transpilation MD5: 31f30f914cc3429a00e5d345d83ad19d
Author: stefan
Category: javax / collections
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-27 00:04:02
Source code size: 875 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 566 / 1255
Version history: 9 change(s)
Referenced in: [show references]