[glib: 4/8] tests: Add missing array length checks



commit 121b6bc599fcbe9c5f0414a6cdbdc2d00a481ee2
Author: Philip Withnall <withnall endlessm com>
Date:   Tue Jul 16 10:17:08 2019 +0100

    tests: Add missing array length checks
    
    Signed-off-by: Philip Withnall <withnall endlessm com>

 glib/tests/array-test.c | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/glib/tests/array-test.c b/glib/tests/array-test.c
index e27670b0b..906812b01 100644
--- a/glib/tests/array-test.c
+++ b/glib/tests/array-test.c
@@ -939,6 +939,8 @@ pointer_array_copy (void)
   ptr_array = g_ptr_array_sized_new (0);
   ptr_array2 = g_ptr_array_copy (ptr_array, NULL, NULL);
 
+  g_assert_cmpuint (ptr_array2->len, ==, ptr_array->len);
+
   g_ptr_array_unref (ptr_array);
   g_ptr_array_unref (ptr_array2);
 
@@ -950,6 +952,7 @@ pointer_array_copy (void)
 
   ptr_array2 = g_ptr_array_copy (ptr_array, NULL, NULL);
 
+  g_assert_cmpuint (ptr_array2->len, ==, ptr_array->len);
   for (i = 0; i < array_size; i++)
     g_assert_cmpuint (*((gsize *) g_ptr_array_index (ptr_array2, i)), ==, i);
 
@@ -962,6 +965,7 @@ pointer_array_copy (void)
   /* Test copy through GCopyFunc */
   ptr_array2 = g_ptr_array_copy (ptr_array, ptr_array_copy_func, NULL);
 
+  g_assert_cmpuint (ptr_array2->len, ==, ptr_array->len);
   for (i = 0; i < array_size; i++)
     g_assert_cmpuint (*((gsize *) g_ptr_array_index (ptr_array2, i)), ==, i);
 


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