summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-10-16 17:47:13 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2025-10-16 17:47:13 +0300
commit2176169257505d22021fc9a739c9f2090c514cb4 (patch)
treeb59a167a0792cff3856f135edffa3493cc450886 /tests
parent7ad6716b5c4dcf8c1c2ce8059884d26fa7c32908 (diff)
downloadconts-2176169257505d22021fc9a739c9f2090c514cb4.tar.gz
conts-2176169257505d22021fc9a739c9f2090c514cb4.zip
check iteration on empty vectors
Diffstat (limited to 'tests')
-rw-r--r--tests/spvec.c3
-rw-r--r--tests/vec.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/spvec.c b/tests/spvec.c
index aa9b96c..b46bd88 100644
--- a/tests/spvec.c
+++ b/tests/spvec.c
@@ -21,6 +21,9 @@ int main()
atexit(covsrv_destroy);
#endif
struct ints ints = ints_create();
+ foreach(ints, iter, &ints) {
+ assert(false && "iterating empty spvec");
+ }
/* ensure stability before we do anything else */
assert(ints_reserve(&ints, 1));
diff --git a/tests/vec.c b/tests/vec.c
index 1ed5f72..af36b5c 100644
--- a/tests/vec.c
+++ b/tests/vec.c
@@ -28,6 +28,10 @@ int main()
#endif
struct ints ints = ints_create(0);
+ foreach(ints, iter, &ints) {
+ assert(false && "iterating empty vec");
+ }
+
for (int i = 0; i < 1000000; ++i) {
if (!ints_append(&ints, i)) {
fprintf(stderr, "failed appending %d to vec\n", i);