aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_vec.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_vec.c b/tests/test_vec.c
new file mode 100644
index 0000000..4cbc96f
--- /dev/null
+++ b/tests/test_vec.c
@@ -0,0 +1,22 @@
+#include "vec.h"
+
+#include <assert.h>
+#include <stdio.h>
+
+int main() {
+ printf("[TEST] vec\n");
+
+ IntVector vec;
+ IntVector_init(&vec);
+
+ for (int i = 0; i < 1000; i++) {
+ assert(vec.size == i);
+ IntVector_push_back(&vec, &i);
+ assert(*(IntVector_end(&vec) - 1) == i);
+ }
+ assert(*IntVector_begin(&vec) == 0);
+
+ IntVector_free(&vec);
+ printf("[PASS] vec\n");
+ return 0;
+}