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

1  
// pass an empty instance
2  
svoid test_List_2(L<S> l, O... _) {
3  
  assertIndexOfAndContainsVerbose(l, "a", -1);
4  
  l.add("a");
5  
  assertIndexOfAndContainsVerbose(l, "a", 0);
6  
  assertIndexOfAndContainsVerbose(l, "b", -1);
7  
  l.add("b");
8  
  assertIndexOfAndContainsVerbose(l, "a", 0);
9  
  assertIndexOfAndContainsVerbose(l, "b", 1);
10  
  l.add("a");
11  
  assertIndexOfAndContainsVerbose(l, "a", 0);
12  
  l.remove(2);
13  
  assertIndexOfAndContainsVerbose(l, "a", 0);
14  
  l.remove("a");
15  
  assertIndexOfAndContainsVerbose(l, "a", -1);
16  
  assertIndexOfAndContainsVerbose(l, "b", 0);
17  
  
18  
  l.clear();
19  
  
20  
  addAll(l, "a", "b", "c", "d");
21  
  l.subList(1, 3).clear();
22  
  assertEquals(ll("a", "d"), cloneList(l));
23  
  
24  
  LS sub = l.subList(1, 2);
25  
  sub.set(0, "x");
26  
  assertEquals(1, sub.size()); // check modCount handling
27  
  
28  
  l.clear();
29  
}

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: 199 / 301
Version history: 5 change(s)
Referenced in: [show references]