remove dynamic arrays which are not supported by msvc

Tue, 29 Oct 2024 16:47:40 +0100

author
Mike Becker <universe@uap-core.de>
date
Tue, 29 Oct 2024 16:47:40 +0100
changeset 951
8f6d6556380a
parent 950
37e7f92de46b
child 952
dc53362bc5a7

remove dynamic arrays which are not supported by msvc

tests/test_iterator.c file | annotate | diff | comparison | revisions
tests/test_printf.c file | annotate | diff | comparison | revisions
--- 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[] = {
--- a/tests/test_printf.c	Tue Oct 29 16:47:19 2024 +0100
+++ b/tests/test_printf.c	Tue Oct 29 16:47:40 2024 +0100
@@ -179,8 +179,8 @@
 
     const char *h = "Hello";
 
-    int const specimen_count = 13;
-    cxmutstr r[specimen_count];
+    cxmutstr r[13];
+    size_t specimen_count = cx_nmemb(r);
     int specimen = 0;
 
     CX_TEST_DO {

mercurial