Mercurial > hg > Members > Moririn
view src/parallel_execution/test/rbTree_test.cbc @ 453:40ea6277b91c
add rbTree_test.cbc
author | ryokka |
---|---|
date | Fri, 08 Dec 2017 15:32:14 +0900 |
parents | |
children | 77de0283ac92 |
line wrap: on
line source
#include "../../context.h" #include <assert.h> __code rbTreeTest1(struct Tree* tree) { printf("insert1\n"); Node* node = new Node(); node->value = 3; node->key = 3; printf("value->%d,key->%d\n",node->value,node->key); goto tree->put(node, rbTreeTest2); } __code rbTreeTest1_stub(struct Context* context) { printf("insert1_stub\n"); Tree* tree = createRedBlackTree(context); goto rbTreeTest1(context,tree); } __code rbTreeTest2(struct Tree* tree) { printf("insert2\n"); Node* node = new Node(); node->value = 4; node->key = 4; goto tree->put(node, rbTreeTest3); } __code rbTreeTest3(struct Tree* tree) { printf("insert3\n"); Node* node = new Node(); node->value = 2; node->key = 2; goto tree->put(node, rbTreeTest4); } __code rbTreeTest4(struct Tree* tree) { printf("insert4\n"); Node* node = new Node(); node->value = 8; node->key = 8; goto tree->put(node, rbTreeTest5); } __code rbTreeTest5(struct Tree* tree) { printf("insert5\n"); Node* node = new Node(); node->value = 7; node->key = 7; goto tree->put(node, assert1); } __code assert1(struct RedBlackTree* tree) { printf("assert\n"); assert(tree->root->color == Black); goto exit_code(0); } int main(int argc, char const* argv[]) { goto rbTreeTest1(); }