]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
tests: Add explicit "move" and "resize" array tests to increase coverage
authorRico Tzschichholz <ricotz@ubuntu.com>
Sun, 7 Jan 2018 08:45:04 +0000 (09:45 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Wed, 10 Jan 2018 19:44:54 +0000 (20:44 +0100)
tests/basic-types/arrays.vala

index 874f4112f6ec0e53d6d82e821a3d08c34454a87c..4f821d94dac9bdf1ff7f5579a3e13f1404558736 100644 (file)
@@ -227,6 +227,20 @@ void test_explicit_copying () {
        assert (a0[1] == a1[1]);
 }
 
+void test_array_move () {
+       int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+       assert (a[4] == 5);
+       a.move (4, 0, 5);
+       assert (a[4] == 9);
+}
+
+void test_array_resize () {
+       int[] a = { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+       assert (a[a.length - 1] == 9);
+       a.resize (5);
+       assert (a[a.length - 1] == 5);
+}
+
 void main () {
        test_integer_array ();
        test_string_array ();
@@ -240,4 +254,6 @@ void main () {
        test_generics_array ();
        test_void_array ();
        test_explicit_copying ();
+       test_array_move ();
+       test_array_resize ();
 }