summaryrefslogtreecommitdiffstats
path: root/web/server/h2o/libh2o/deps/klib/test/kgraph_test.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:57:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 02:57:58 +0000
commitbe1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 (patch)
tree9754ff1ca740f6346cf8483ec915d4054bc5da2d /web/server/h2o/libh2o/deps/klib/test/kgraph_test.c
parentInitial commit. (diff)
downloadnetdata-upstream.tar.xz
netdata-upstream.zip
Adding upstream version 1.44.3.upstream/1.44.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/server/h2o/libh2o/deps/klib/test/kgraph_test.c')
-rw-r--r--web/server/h2o/libh2o/deps/klib/test/kgraph_test.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/web/server/h2o/libh2o/deps/klib/test/kgraph_test.c b/web/server/h2o/libh2o/deps/klib/test/kgraph_test.c
new file mode 100644
index 00000000..3da1cd71
--- /dev/null
+++ b/web/server/h2o/libh2o/deps/klib/test/kgraph_test.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include "kgraph.h"
+
+KHASH_INIT2(e32, extern, uint32_t, int, 1, kh_int_hash_func, kh_int_hash_equal)
+
+typedef struct {
+ int i;
+ khash_t(e32) *_arc;
+} vertex_t;
+
+KGRAPH_INIT(g, extern, vertex_t, int, e32)
+KGRAPH_PRINT(g, extern)
+
+int main()
+{
+ int *pb, *pe;
+ kgraph_t(g) *g;
+ g = kg_init_g();
+ kg_put_a_g(g, 10, 20, 0, &pb, &pe);
+ kg_put_a_g(g, 20, 30, 0, &pb, &pe);
+ kg_put_a_g(g, 30, 10, 1, &pb, &pe);
+ kg_del_v_g(g, 20);
+ kg_print_g(g);
+ kg_destroy_g(g);
+ return 0;
+}