diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-10-16 21:12:00 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-10-16 21:12:00 +0300 |
| commit | e962c7a4c70b6e2c3f2df89be176c491d62739e7 (patch) | |
| tree | a5c22494b81fdc52ff053fc417f5039a2efb6dba /tests/spvec.c | |
| parent | 717eb9512cbd98e965c1b842cbc9d84e218c37c2 (diff) | |
| download | conts-master.tar.gz conts-master.zip | |
+ Regular tests are pretty darn slow with valgrind on certain virtual
machines, speed them up a bit
Diffstat (limited to 'tests/spvec.c')
| -rw-r--r-- | tests/spvec.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/spvec.c b/tests/spvec.c index b46bd88..b169884 100644 --- a/tests/spvec.c +++ b/tests/spvec.c @@ -38,16 +38,16 @@ int main() ints_reset(&ints); assert(ints_len(&ints) == 0); - for (int i = 0; i < 1000000; ++i) { + for (int i = 0; i < ITER; ++i) { if (!ints_append(&ints, i)) { fprintf(stderr, "failed appending %d to vec\n", i); ints_destroy(&ints); return -1; } } - assert(ints_len(&ints) == 1000000); + assert(ints_len(&ints) == ITER); - for (int i = 0; i < 1000000; ++i) { + for (int i = 0; i < ITER; ++i) { int *v = ints_at(&ints, i); assert(v && *v == i); } @@ -59,7 +59,7 @@ int main() } /* TEN million !!1! */ - if (!ints_reserve(&ints, 10000000)) { + if (!ints_reserve(&ints, 10 * ITER)) { fprintf(stderr, "failed reserving vec\n"); ints_destroy(&ints); return -1; @@ -69,13 +69,13 @@ int main() * (is shrink necessary when we already have reserve? I * guess it shows intention a bit better and just asserts instead of * maybe fails?) */ - ints_shrink(&ints, 1000000); + ints_shrink(&ints, ITER); /* so the above is equivalent to */ - assert(ints_reserve(&ints, 1000000)); - assert(ints_len(&ints) == 1000000); + assert(ints_reserve(&ints, ITER)); + assert(ints_len(&ints) == ITER); - for (int i = 1000000 - 1; i >= 0; --i) { + for (int i = ITER - 1; i >= 0; --i) { ints_remove(&ints, i); } assert(ints_len(&ints) == 0); |
