tests/test_iterator.c

changeset 951
8f6d6556380a
parent 853
d4baf4dd55c3
--- a/tests/test_iterator.c	Tue Oct 29 16:47:19 2024 +0100
+++ b/tests/test_iterator.c	Tue Oct 29 16:47:40 2024 +0100
@@ -31,8 +31,8 @@
 #include "cx/iterator.h"
 
 CX_TEST(test_iterator_create) {
-    size_t size = 20;
-    unsigned array[size];
+    unsigned array[20];
+    size_t size = cx_nmemb(array);
     for (unsigned i = 0 ; i < size ; i++) array[i] = i;
 
     CxIterator iter = cxIterator(array, sizeof(unsigned), size);
@@ -59,8 +59,8 @@
 }
 
 CX_TEST(test_iterator_iterate) {
-    size_t size = 20;
-    unsigned array[size];
+    unsigned array[20];
+    size_t size = cx_nmemb(array);
     for (unsigned i = 0 ; i < size ; i++) array[i] = i;
 
     CxIterator iter = cxIterator(array, sizeof(unsigned), size);
@@ -80,8 +80,8 @@
 }
 
 CX_TEST(test_iterator_with_slow_remove) {
-    size_t size = 20;
-    unsigned array[size];
+    unsigned array[20];
+    size_t size = cx_nmemb(array);
     for (unsigned i = 0 ; i < size ; i++) array[i] = i;
 
     size_t elem_counts[] = {
@@ -121,8 +121,8 @@
 }
 
 CX_TEST(test_iterator_with_fast_remove) {
-    size_t size = 20;
-    unsigned array[size];
+    unsigned array[20];
+    size_t size = cx_nmemb(array);
     for (unsigned i = 0 ; i < size ; i++) array[i] = i;
 
     size_t elem_counts[] = {

mercurial