Răsfoiți Sursa

Test invalid index

Kajetan Johannes Hammerle 3 luni în urmă
părinte
comite
62fb3363c9
1 a modificat fișierele cu 6 adăugiri și 0 ștergeri
  1. 6 0
      test/modules/ArrayListTests.cpp

+ 6 - 0
test/modules/ArrayListTests.cpp

@@ -136,6 +136,12 @@ static void testRemove() {
     CORE_TEST_EQUAL(2, list[0]);
     CORE_TEST_EQUAL(3, list[1]);
     CORE_TEST_EQUAL(2, list.getLength());
+    CORE_TEST_EQUAL(Core::Error::INVALID_INDEX, list.removeBySwap(4));
+    CORE_TEST_EQUAL(Core::Error::INVALID_INDEX, list.removeBySwap(-1));
+    CORE_TEST_EQUAL(Core::Error::INVALID_INDEX, list.removeBySwap(-5));
+    CORE_TEST_EQUAL(2, list[0]);
+    CORE_TEST_EQUAL(3, list[1]);
+    CORE_TEST_EQUAL(2, list.getLength());
     CORE_TEST_ERROR(list.removeBySwap(1));
     CORE_TEST_EQUAL(2, list[0]);
     CORE_TEST_EQUAL(1, list.getLength());