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

svoid test_AllOnAllWithUpdates() {
  for (bool variation : falseTrue()) {
    new AllOnAllWithUpdates<S, Int> aoa;
    aoa.newA("one");
    assertNullVerbose(aoa.next());
    aoa.newB(1);
    assertEqualsVerbose(pair("one", 1), aoa.next());
    assertNullVerbose(aoa.next());
    aoa.newB(2);
    if (!variation) aoa.newA("two");
    assertEqualsVerbose(pair("one", 2), aoa.next());
    if (variation) {
      assertNullVerbose(aoa.next());
      aoa.newA("two");
    }
    assertEqualsVerbose(pair("two", 1), aoa.next());
    assertEqualsVerbose(pair("two", 2), aoa.next());
    assertNullVerbose(aoa.next());
  }
  
  new AllOnAllWithUpdates<S, Int> aoa;
  aoa.newA("one");
  aoa.newB(1);
  aoa.newA("two");
  aoa.newB(2);
  assertEqualsVerbose(pair("one", 1), aoa.next());
  assertEqualsVerbose(pair("two", 1), aoa.next());
  assertEqualsVerbose(pair("one", 2), aoa.next());
  assertEqualsVerbose(pair("two", 2), aoa.next());
  assertNullVerbose(aoa.next());
  
  print("test updates");
  
  aoa.updateA("one");
  aoa.updateB(2);
  assertEqualsVerbose(pair("one", 1), aoa.next());
  assertEqualsVerbose(pair("two", 2), aoa.next());
  assertEqualsVerbose(pair("one", 2), aoa.next());
  assertNullVerbose(aoa.next());
}

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: 135 / 217
Version history: 6 change(s)
Referenced in: [show references]