aboutsummaryrefslogtreecommitdiff
path: root/dependencies/uthash/tests/test45.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-12-01 13:33:34 +0100
committerToni Uhlig <matzeton@googlemail.com>2020-12-01 13:33:34 +0100
commit00e5132a803f8781b6f538625ab99816b7b52d2d (patch)
tree726a07ea8b2b6f35135dd253ecd8dc0768b09f42 /dependencies/uthash/tests/test45.c
parent32b192df3b898b4199325309a6113ae7efa3556e (diff)
parentc8bf38e5fb717d40635a2a89b22ed71b0de4266b (diff)
Merge commit 'c8bf38e5fb717d40635a2a89b22ed71b0de4266b' as 'dependencies/uthash'
Diffstat (limited to 'dependencies/uthash/tests/test45.c')
-rw-r--r--dependencies/uthash/tests/test45.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/dependencies/uthash/tests/test45.c b/dependencies/uthash/tests/test45.c
new file mode 100644
index 000000000..b0633f2b4
--- /dev/null
+++ b/dependencies/uthash/tests/test45.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include "utarray.h"
+
+int main()
+{
+ UT_array *a;
+ int i, *p=NULL;
+ utarray_new(a, &ut_int_icd);
+ for(i=0; i<10; i++) {
+ utarray_push_back(a,&i);
+ }
+ utarray_pop_back(a);
+ utarray_erase(a,0,1);
+ while ( (p=(int*)utarray_next(a,p)) != NULL ) {
+ printf("%d ",*p);
+ }
+ printf("\n");
+ i = 100;
+ utarray_insert(a,&i,3);
+ while ( (p=(int*)utarray_next(a,p)) != NULL ) {
+ printf("%d ",*p);
+ }
+ printf("\n");
+ utarray_extend_back(a);
+ p = (int*)utarray_back(a);
+ *p = 1000;
+ p = NULL;
+ while ( (p=(int*)utarray_next(a,p)) != NULL ) {
+ printf("%d ",*p);
+ }
+ printf("\n");
+ utarray_clear(a);
+ utarray_free(a);
+ return 0;
+}
+