[vala/staging] tests: Add explicit "move" and "resize" array tests to increase coverage



commit f2457d833b102de0504797aff57042deb835d4ae
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Sun Jan 7 09:45:04 2018 +0100

    tests: Add explicit "move" and "resize" array tests to increase coverage

 tests/basic-types/arrays.vala |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/tests/basic-types/arrays.vala b/tests/basic-types/arrays.vala
index 874f411..4f821d9 100644
--- a/tests/basic-types/arrays.vala
+++ b/tests/basic-types/arrays.vala
@@ -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 ();
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]