Java std::list std::vector - test addAll and subList

This commit is contained in:
William S Fulton 2017-06-26 13:42:19 +01:00
commit 90d2ba884c
2 changed files with 20 additions and 0 deletions

View file

@ -139,5 +139,15 @@ public class li_std_vector_runme {
if (v9.size() != 7) throw new RuntimeException("v9 test (1) failed");
if (!v9.remove(new Integer(60))) throw new RuntimeException("v9 test (2) failed");
if (v9.size() != 6) throw new RuntimeException("v9 test (3) failed");
IntVector v10 = new IntVector(java.util.Arrays.asList(10, 20, 30, 40, 50));
v10.subList(1, 4).clear(); // Recommended way to call protected method removeRange(1,3)
if (v10.size() != 2) throw new RuntimeException("v10 test (1) failed");
if (v10.get(0) != 10) throw new RuntimeException("v10 test (2) failed");
if (v10.get(1) != 50) throw new RuntimeException("v10 test (3) failed");
v10.addAll(1, java.util.Arrays.asList(22, 33));
if (v10.size() != 4) throw new RuntimeException("v10 test (4) failed");
if (v10.get(1) != 22) throw new RuntimeException("v10 test (5) failed");
if (v10.get(2) != 33) throw new RuntimeException("v10 test (6) failed");
}
}