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

40
LINES

< > BotCompany Repo | #1023908 // test_AllOnAllWithUpdates (OK)

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

Libraryless. Click here for Pure Java version (2341L/15K).

1  
svoid test_AllOnAllWithUpdates() {
2  
  for (bool variation : falseTrue()) {
3  
    new AllOnAllWithUpdates<S, Int> aoa;
4  
    aoa.newA("one");
5  
    assertNullVerbose(aoa.next());
6  
    aoa.newB(1);
7  
    assertEqualsVerbose(pair("one", 1), aoa.next());
8  
    assertNullVerbose(aoa.next());
9  
    aoa.newB(2);
10  
    if (!variation) aoa.newA("two");
11  
    assertEqualsVerbose(pair("one", 2), aoa.next());
12  
    if (variation) {
13  
      assertNullVerbose(aoa.next());
14  
      aoa.newA("two");
15  
    }
16  
    assertEqualsVerbose(pair("two", 1), aoa.next());
17  
    assertEqualsVerbose(pair("two", 2), aoa.next());
18  
    assertNullVerbose(aoa.next());
19  
  }
20  
  
21  
  new AllOnAllWithUpdates<S, Int> aoa;
22  
  aoa.newA("one");
23  
  aoa.newB(1);
24  
  aoa.newA("two");
25  
  aoa.newB(2);
26  
  assertEqualsVerbose(pair("one", 1), aoa.next());
27  
  assertEqualsVerbose(pair("two", 1), aoa.next());
28  
  assertEqualsVerbose(pair("one", 2), aoa.next());
29  
  assertEqualsVerbose(pair("two", 2), aoa.next());
30  
  assertNullVerbose(aoa.next());
31  
  
32  
  print("test updates");
33  
  
34  
  aoa.updateA("one");
35  
  aoa.updateB(2);
36  
  assertEqualsVerbose(pair("one", 1), aoa.next());
37  
  assertEqualsVerbose(pair("two", 2), aoa.next());
38  
  assertEqualsVerbose(pair("one", 2), aoa.next());
39  
  assertNullVerbose(aoa.next());
40  
}

Author comment

Began life as a copy of #1023898

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023908
Snippet name: test_AllOnAllWithUpdates (OK)
Eternal ID of this version: #1023908/7
Text MD5: 38590e1da3671eb75bd773863f914295
Transpilation MD5: 7035d23744c7f7ed12b68581c2e10f10
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-07-12 02:00:12
Source code size: 1259 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 213 / 321
Version history: 6 change(s)
Referenced in: [show references]