Mercurial > hg > Members > Moririn
diff src/parallel_execution/test/rbTree_test.cbc @ 469:ed494f4004c9
add RedBlackTree.cbc insert Test
author | ryokka |
---|---|
date | Wed, 27 Dec 2017 18:26:37 +0900 |
parents | ac244346c85d |
children | 4b5f9884b777 |
line wrap: on
line diff
--- a/src/parallel_execution/test/rbTree_test.cbc Mon Dec 25 18:10:56 2017 +0900 +++ b/src/parallel_execution/test/rbTree_test.cbc Wed Dec 27 18:26:37 2017 +0900 @@ -1,13 +1,16 @@ +#include <stdio.h> #include "../../context.h" #interface "Tree.h" + /* #include <assert.h> */ __code rbTreeTest1(struct Tree* tree) { printf("Test1\n"); Node* node = new Node(); - node->value = 3; + node->value = (union Data*)new Int(); + node->value->Int = 3; node->key = 3; - printf("value->%d,key->%d\n",node->value,node->key); + printf("value->%d,key->%d\n",node->value->Int,node->key); goto tree->put(node, rbTreeTest2); } @@ -21,7 +24,8 @@ __code rbTreeTest2(struct Tree* tree) { printf("Test2\n"); Node* node = new Node(); - node->value = 4; + node->value = (union Data*)new Int(); + node->value->Int = 4; node->key = 4; goto tree->put(node, rbTreeTest3); } @@ -36,29 +40,44 @@ __code rbTreeTest3(struct Tree* tree) { printf("test3\n"); Node* node = new Node(); - node->value = 2; + node->value = (union Data*)new Int(); + node->value->Int = 2; node->key = 2; goto tree->put(node, rbTreeTest4); } +__code rbTreeTest3_stub(struct Context* context) { + Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; + goto rbTreeTest3(context,tree); +} __code rbTreeTest4(struct Tree* tree) { printf("test4\n"); Node* node = new Node(); - node->value = 8; + node->value = (union Data*)new Int(); + node->value->Int = 8; node->key = 8; goto tree->put(node, rbTreeTest5); } +__code rbTreeTest4_stub(struct Context* context) { + Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; + goto rbTreeTest4(context,tree); +} __code rbTreeTest5(struct Tree* tree) { printf("test5\n"); Node* node = new Node(); - node->value = 7; + node->value = (union Data*)new Int(); + node->value->Int = 7; node->key = 7; goto exit_code(context); } +__code rbTreeTest5_stub(struct Context* context) { + Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; + goto rbTreeTest5(context,tree); +}