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

22
LINES

< > BotCompany Repo | #1034065 // test_CompactHashMap (OK)

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

Libraryless. Click here for Pure Java version (5279L/30K).

1  
svoid test_CompactHashMap() {
2  
  new CompactHashMap<S> map1;
3  
  new HashMap<S> map2;
4  
  
5  
  embedded void check {
6  
    assertEqualsVerbose(map2.size(), map1.size());
7  
    assertEquals(sorted(keys(map2)), sorted(keys(map1)));
8  
    assertEquals(sorted(values(map2)), sorted(values(map1)));
9  
    for (S key : keys(map1))
10  
      assertEquals(map2.get(key), map1.get(key));
11  
    assertNull(map1.get("unknown"));
12  
  }
13  
  
14  
  check();
15  
  repeat 100 {
16  
    repeat 10 {
17  
      putInTwoMaps(map1, map2, aGlobalID(), aGlobalID());
18  
    }
19  
    removeFromTwoMaps(map1, map2, random(keys(map2)));
20  
    check();
21  
  }
22  
}

Author comment

Began life as a copy of #1013304

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1034065
Snippet name: test_CompactHashMap (OK)
Eternal ID of this version: #1034065/1
Text MD5: 8e42d27660e490cfc50f9dc0cb1f5922
Transpilation MD5: cd2d3fabc73fa4c39a668c806ba1067d
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-20 01:29:10
Source code size: 604 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 111 / 170
Referenced in: [show references]