Mercurial > hg > Members > Moririn
annotate 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 |
rev | line source |
---|---|
469 | 1 #include <stdio.h> |
453 | 2 #include "../../context.h" |
468
ac244346c85d
Change used interface syntax from #include to #interface
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents:
466
diff
changeset
|
3 #interface "Tree.h" |
469 | 4 |
454 | 5 /* #include <assert.h> */ |
453 | 6 |
7 __code rbTreeTest1(struct Tree* tree) { | |
454 | 8 printf("Test1\n"); |
453 | 9 Node* node = new Node(); |
469 | 10 node->value = (union Data*)new Int(); |
11 node->value->Int = 3; | |
453 | 12 node->key = 3; |
469 | 13 printf("value->%d,key->%d\n",node->value->Int,node->key); |
453 | 14 goto tree->put(node, rbTreeTest2); |
15 } | |
16 | |
17 __code rbTreeTest1_stub(struct Context* context) { | |
454 | 18 printf("test1_stub\n"); |
453 | 19 Tree* tree = createRedBlackTree(context); |
20 goto rbTreeTest1(context,tree); | |
21 } | |
22 | |
23 | |
24 __code rbTreeTest2(struct Tree* tree) { | |
454 | 25 printf("Test2\n"); |
453 | 26 Node* node = new Node(); |
469 | 27 node->value = (union Data*)new Int(); |
28 node->value->Int = 4; | |
453 | 29 node->key = 4; |
30 goto tree->put(node, rbTreeTest3); | |
31 } | |
32 | |
454 | 33 __code rbTreeTest2_stub(struct Context* context) { |
34 printf("test2_stub\n"); | |
35 Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; | |
36 goto rbTreeTest2(context,tree); | |
37 } | |
453 | 38 |
39 | |
40 __code rbTreeTest3(struct Tree* tree) { | |
454 | 41 printf("test3\n"); |
453 | 42 Node* node = new Node(); |
469 | 43 node->value = (union Data*)new Int(); |
44 node->value->Int = 2; | |
453 | 45 node->key = 2; |
46 goto tree->put(node, rbTreeTest4); | |
47 } | |
48 | |
469 | 49 __code rbTreeTest3_stub(struct Context* context) { |
50 Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; | |
51 goto rbTreeTest3(context,tree); | |
52 } | |
453 | 53 |
54 __code rbTreeTest4(struct Tree* tree) { | |
454 | 55 printf("test4\n"); |
453 | 56 Node* node = new Node(); |
469 | 57 node->value = (union Data*)new Int(); |
58 node->value->Int = 8; | |
453 | 59 node->key = 8; |
60 goto tree->put(node, rbTreeTest5); | |
61 } | |
62 | |
469 | 63 __code rbTreeTest4_stub(struct Context* context) { |
64 Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; | |
65 goto rbTreeTest4(context,tree); | |
66 } | |
453 | 67 |
68 __code rbTreeTest5(struct Tree* tree) { | |
454 | 69 printf("test5\n"); |
453 | 70 Node* node = new Node(); |
469 | 71 node->value = (union Data*)new Int(); |
72 node->value->Int = 7; | |
453 | 73 node->key = 7; |
454 | 74 goto exit_code(context); |
453 | 75 } |
76 | |
469 | 77 __code rbTreeTest5_stub(struct Context* context) { |
78 Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; | |
79 goto rbTreeTest5(context,tree); | |
80 } | |
453 | 81 |
454 | 82 |
453 | 83 |
84 int main(int argc, char const* argv[]) { | |
454 | 85 printf("test_main\n"); |
453 | 86 goto rbTreeTest1(); |
87 } |