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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
469
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
1 #include <stdio.h>
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
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
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
4
454
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
5 /* #include <assert.h> */
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
6
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
7 __code rbTreeTest1(struct Tree* tree) {
454
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
8 printf("Test1\n");
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
9 Node* node = new Node();
469
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
10 node->value = (union Data*)new Int();
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
11 node->value->Int = 3;
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
12 node->key = 3;
469
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
13 printf("value->%d,key->%d\n",node->value->Int,node->key);
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
14 goto tree->put(node, rbTreeTest2);
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
15 }
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
16
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
17 __code rbTreeTest1_stub(struct Context* context) {
454
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
18 printf("test1_stub\n");
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
19 Tree* tree = createRedBlackTree(context);
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
20 goto rbTreeTest1(context,tree);
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
21 }
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
22
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
23
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
24 __code rbTreeTest2(struct Tree* tree) {
454
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
25 printf("Test2\n");
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
26 Node* node = new Node();
469
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
27 node->value = (union Data*)new Int();
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
28 node->value->Int = 4;
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
29 node->key = 4;
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
30 goto tree->put(node, rbTreeTest3);
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
31 }
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
32
454
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
33 __code rbTreeTest2_stub(struct Context* context) {
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
34 printf("test2_stub\n");
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
35 Tree* tree = (struct Tree*)Gearef(context, Tree)->tree;
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
36 goto rbTreeTest2(context,tree);
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
37 }
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
38
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
39
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
40 __code rbTreeTest3(struct Tree* tree) {
454
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
41 printf("test3\n");
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
42 Node* node = new Node();
469
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
43 node->value = (union Data*)new Int();
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
44 node->value->Int = 2;
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
45 node->key = 2;
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
46 goto tree->put(node, rbTreeTest4);
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
47 }
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
48
469
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
49 __code rbTreeTest3_stub(struct Context* context) {
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
50 Tree* tree = (struct Tree*)Gearef(context, Tree)->tree;
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
51 goto rbTreeTest3(context,tree);
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
52 }
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
53
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
54 __code rbTreeTest4(struct Tree* tree) {
454
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
55 printf("test4\n");
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
56 Node* node = new Node();
469
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
57 node->value = (union Data*)new Int();
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
58 node->value->Int = 8;
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
59 node->key = 8;
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
60 goto tree->put(node, rbTreeTest5);
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
61 }
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
62
469
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
63 __code rbTreeTest4_stub(struct Context* context) {
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
64 Tree* tree = (struct Tree*)Gearef(context, Tree)->tree;
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
65 goto rbTreeTest4(context,tree);
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
66 }
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
67
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
68 __code rbTreeTest5(struct Tree* tree) {
454
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
69 printf("test5\n");
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
70 Node* node = new Node();
469
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
71 node->value = (union Data*)new Int();
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
72 node->value->Int = 7;
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
73 node->key = 7;
454
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
74 goto exit_code(context);
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
75 }
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
76
469
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
77 __code rbTreeTest5_stub(struct Context* context) {
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
78 Tree* tree = (struct Tree*)Gearef(context, Tree)->tree;
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
79 goto rbTreeTest5(context,tree);
ed494f4004c9 add RedBlackTree.cbc insert Test
ryokka
parents: 468
diff changeset
80 }
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
81
454
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
82
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
83
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
84 int main(int argc, char const* argv[]) {
454
77de0283ac92 Debug RedBlackTree.cbc.
ryokka
parents: 453
diff changeset
85 printf("test_main\n");
453
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
86 goto rbTreeTest1();
40ea6277b91c add rbTree_test.cbc
ryokka
parents:
diff changeset
87 }