Skip first and last element during counting down indices in remove test
authorMaciej Piechotka <uzytkownik2@gmail.com>
Fri, 21 Feb 2014 01:41:48 +0000 (02:41 +0100)
committerMaciej Piechotka <uzytkownik2@gmail.com>
Fri, 21 Feb 2014 01:41:48 +0000 (02:41 +0100)
tests/testlist.vala

index 54a7503..1873dfc 100644 (file)
@@ -349,11 +349,15 @@ public abstract class ListTests : CollectionTests {
                for (uint i = 0; i < idx.length; i++) {
                        int to_remove = (int)idx[i] - 1;
                        if (idx[i] == data.length - 1 || idx[i] == 0) {
-                               // Removing last or first element, which was already removed
+                               // Skip last or first element, which was already removed
                                continue;
                        }
                        for (uint j = 0; j < i; j++) {
                                if (idx[j] < idx[i]) {
+                                       if (idx[j] == data.length - 1 || idx[j] == 0) {
+                                               // Last and first element were not removed
+                                               continue;
+                                       }
                                        to_remove--;
                                }
                        }