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

25
LINES

< > BotCompany Repo | #1013386 // Test CompactPairKeyHashMap (OK)

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

Download Jar. Libraryless. Click here for Pure Java version (2454L/17K).

1  
!7
2  
3  
static new CompactPairKeyHashMap<S, S> map1;
4  
static new HashMap<Pair<S>, S> map2;
5  
6  
p {
7  
  check();
8  
  repeat 100 {
9  
    repeat 10 {
10  
      putInTwoMaps(map1, map2, pair(aGlobalID(), aGlobalID()), aGlobalID());
11  
    }
12  
    removeFromTwoMaps(map1, map2, random(keys(map2)));
13  
    check();
14  
  }
15  
  print("OK!");
16  
}
17  
18  
svoid check {
19  
  assertEqualsVerbose(map2.size(), map1.size());
20  
  assertEquals(sorted(keys(map2)), sorted(keys(map1)));
21  
  assertEquals(sorted(values(map2)), sorted(values(map1)));
22  
  for (Pair<S> key : keys(map1))
23  
    assertEquals(map2.get(key), map1.get(key));
24  
  assertNull(map1.get(pair("unknown", "unknown")));
25  
}

Author comment

Began life as a copy of #1013304

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1013386
Snippet name: Test CompactPairKeyHashMap (OK)
Eternal ID of this version: #1013386/5
Text MD5: a59caa255b6b5386ac5e0fdfd2ccf805
Transpilation MD5: 91de02ab8f3a6fc69975fffa5c8cd485
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-04 00:06:33
Source code size: 644 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 608 / 1286
Version history: 4 change(s)
Referenced in: [show references]