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

29
LINES

< > BotCompany Repo | #1025485 // test_List_2 - more tests for a list (called by test_List)

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

Libraryless. Click here for Pure Java version (2209L/14K).

// pass an empty instance
svoid test_List_2(L<S> l, O... _) {
  assertIndexOfAndContainsVerbose(l, "a", -1);
  l.add("a");
  assertIndexOfAndContainsVerbose(l, "a", 0);
  assertIndexOfAndContainsVerbose(l, "b", -1);
  l.add("b");
  assertIndexOfAndContainsVerbose(l, "a", 0);
  assertIndexOfAndContainsVerbose(l, "b", 1);
  l.add("a");
  assertIndexOfAndContainsVerbose(l, "a", 0);
  l.remove(2);
  assertIndexOfAndContainsVerbose(l, "a", 0);
  l.remove("a");
  assertIndexOfAndContainsVerbose(l, "a", -1);
  assertIndexOfAndContainsVerbose(l, "b", 0);
  
  l.clear();
  
  addAll(l, "a", "b", "c", "d");
  l.subList(1, 3).clear();
  assertEquals(ll("a", "d"), cloneList(l));
  
  LS sub = l.subList(1, 2);
  sub.set(0, "x");
  assertEquals(1, sub.size()); // check modCount handling
  
  l.clear();
}

Author comment

Began life as a copy of #1025482

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: #1025485
Snippet name: test_List_2 - more tests for a list (called by test_List)
Eternal ID of this version: #1025485/6
Text MD5: 9d3530939cd42fa7ef84c7506cc3f98d
Transpilation MD5: f4441502badf4f69b3ea97fbec76a801
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-10-01 16:26:45
Source code size: 829 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 198 / 299
Version history: 5 change(s)
Referenced in: [show references]