Mercurial > hg > Members > Moririn
view 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 source
#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 = (union Data*)new Int(); node->value->Int = 3; node->key = 3; printf("value->%d,key->%d\n",node->value->Int,node->key); goto tree->put(node, rbTreeTest2); } __code rbTreeTest1_stub(struct Context* context) { printf("test1_stub\n"); Tree* tree = createRedBlackTree(context); goto rbTreeTest1(context,tree); } __code rbTreeTest2(struct Tree* tree) { printf("Test2\n"); Node* node = new Node(); node->value = (union Data*)new Int(); node->value->Int = 4; node->key = 4; goto tree->put(node, rbTreeTest3); } __code rbTreeTest2_stub(struct Context* context) { printf("test2_stub\n"); Tree* tree = (struct Tree*)Gearef(context, Tree)->tree; goto rbTreeTest2(context,tree); } __code rbTreeTest3(struct Tree* tree) { printf("test3\n"); Node* node = new Node(); 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 = (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 = (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); } int main(int argc, char const* argv[]) { printf("test_main\n"); goto rbTreeTest1(); }