summaryrefslogtreecommitdiff
path: root/tests/vec.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-10-27 16:17:32 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2024-10-27 16:35:04 +0200
commit5940254d9363ed8de9ba79a65cb074ec5aa4e69f (patch)
treeb217218914aff187ea3ee056a0ab46d1963cc9b2 /tests/vec.c
downloadconts-5940254d9363ed8de9ba79a65cb074ec5aa4e69f.tar.gz
conts-5940254d9363ed8de9ba79a65cb074ec5aa4e69f.zip
initial containers
Diffstat (limited to 'tests/vec.c')
-rw-r--r--tests/vec.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/vec.c b/tests/vec.c
new file mode 100644
index 0000000..4bc06e7
--- /dev/null
+++ b/tests/vec.c
@@ -0,0 +1,19 @@
+#include <assert.h>
+
+#define VEC_TYPE int
+#define VEC_NAME ints
+#include <conts/vec.h>
+
+int main()
+{
+ struct ints ints = ints_create(0);
+ for (int i = 0; i < 1000000; ++i) {
+ ints_append(&ints, i);
+ }
+
+ for (int i = 0; i < 1000000; ++i) {
+ int *v = ints_at(&ints, i);
+ assert(v && *v == i);
+ }
+ ints_destroy(&ints);
+}