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).

1  
!7
2  
3  
p {
4  
  // ll method
5  
  for (int n = 0; n <= 10; n++) {
6  
    O[] data = repArrayF(f aGlobalID, n);
7  
    O l = smallestList_ll(data);
8  
    check(data, l);
9  
  }
10  
  
11  
  // add method
12  
  O l = null;
13  
  O[] data = new O[0];
14  
  for (int n = 0; n <= 10; n++) {
15  
    check(data, l);
16  
    data = addToObjectArray(data, aGlobalID());
17  
    l = smallestList_add(l, last(data));
18  
  }
19  
  
20  
  print("OK!");
21  
}
22  
23  
svoid check(O[] data, O l) {
24  
  int n = l(data);
25  
  print("Size " + n + ": " + sfu(l));
26  
  assertEquals(n, smallestList_l(l));
27  
  for i to n:
28  
    assertEquals(data[i], smallestList_get(l, i));
29  
  assertEquals(asList(data), new L(smallestList_asList(l)));
30  
    
31  
  int size = 0;
32  
  if (l != null)
33  
    if (l instanceof S) size = 0;
34  
    else size = toInt(unsafe_sizeOf(l));
35  
  print("Bytes used for list: " + size + " bytes");
36  
  printStruct(unsafe_allFieldOffsets(l));
37  
}

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: 568 / 1261
Version history: 9 change(s)
Referenced in: [show references]