From 41f6987e81b023f0fa17e544c0f49cf39ae4f9f1 Mon Sep 17 00:00:00 2001
From: akashk4 <akashk4@illinois.edu>
Date: Fri, 3 Jan 2020 03:26:57 -0600
Subject: [PATCH] Added tests for create node and edge intrinsics

---
 .../hpvm/test/unitTests/CreateNodeAndEdge.c   | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 llvm/tools/hpvm/test/unitTests/CreateNodeAndEdge.c

diff --git a/llvm/tools/hpvm/test/unitTests/CreateNodeAndEdge.c b/llvm/tools/hpvm/test/unitTests/CreateNodeAndEdge.c
new file mode 100644
index 0000000000..f8ba09217d
--- /dev/null
+++ b/llvm/tools/hpvm/test/unitTests/CreateNodeAndEdge.c
@@ -0,0 +1,52 @@
+#include <stdio.h>
+#include "visc.h"
+
+struct Root {
+  int *input;
+  int *output;
+};
+
+
+void Func1(int *In, int *Out) {
+  __visc__hint (CPU_TARGET);
+  __visc__attributes(1, In, 1, Out);
+
+  __visc__return(1, Out);
+}
+
+void Func2(int *BindIn, int *SrcIn, int *Out) {
+  __visc__hint (CPU_TARGET);
+  __visc__attributes(2, BindIn, SrcIn, 1, Out);
+
+  __visc__return(1, Out);
+}
+
+void PipeRoot(int *In, int *Out) {
+    __visc__hint (CPU_TARGET);
+
+    __visc__attributes(1, In, 1, Out);
+
+    void* SrcNode = __visc__createNodeND(0, Func1);
+    void* DestNode = __visc__createNodeND(0, Func2);
+
+    __visc__bindIn(SrcNode, 0, 0, 0);
+
+    __visc__bindIn(DestNode, 0, 0, 0);
+   __visc__edge(SrcNode, DestNode, 1, 0, 1, 0);
+
+    __visc__bindOut(SrcNode, 0, 0, 0);
+}
+
+int  main(void) {
+    int In = 1;
+    int Out = 0;
+    struct Root RootArgs = {(int *) &In, (int *) &Out};
+
+    __visc__init();
+    void* PipeDFG = __visc__launch(0, PipeRoot, (void *) &RootArgs);
+    __visc__wait(PipeDFG);
+    __visc__cleanup();
+
+    return 0;
+}
+
-- 
GitLab