aboutsummaryrefslogtreecommitdiff
path: root/test/test-vec.cpp
diff options
context:
space:
mode:
authorcomex2015-03-01 13:20:08 -0500
committercomex2015-03-01 13:20:08 -0500
commit471eb472dbd3462b6a5ab21f85621e16c411709b (patch)
tree1e682ade28b4a49ab8894a19c5205b59d1e73cc9 /test/test-vec.cpp
parentAdd extra argument to substitute_hook_functions and interpose_imports for use... (diff)
downloadsubstitute-471eb472dbd3462b6a5ab21f85621e16c411709b.tar.gz
add vec
Diffstat (limited to '')
-rw-r--r--test/test-vec.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/test-vec.cpp b/test/test-vec.cpp
new file mode 100644
index 0000000..f587c1b
--- /dev/null
+++ b/test/test-vec.cpp
@@ -0,0 +1,23 @@
+#include "cbit/vec.h"
+#include <stdio.h>
+DECL_VEC(const char *, ccp);
+
+int main() {
+ VEC_STORAGE(ccp) stor;
+ VEC_STORAGE_INIT(&stor, ccp);
+ struct vec_ccp *vec = &stor.v;
+ for (int i = 0; i < 20; i++) {
+ char *x;
+ asprintf(&x, "el%d", i);
+ vec_append_ccp(vec, x);
+ }
+ vec_remove_ccp(vec, 5, 4);
+ vec_add_space_ccp(vec, 9, 2);
+ for (int i = 9; i <= 10; i++)
+ vec->els[i] = "TILT";
+ vec_concat_ccp(vec, vec);
+ VEC_FOREACH(vec, i, const char **c, ccp) {
+ printf("%zd->%s\n", i, *c);
+ }
+
+}