Mercurial > hg > Members > Moririn
changeset 453:40ea6277b91c
add rbTree_test.cbc
author | ryokka |
---|---|
date | Fri, 08 Dec 2017 15:32:14 +0900 |
parents | 1432d924c472 |
children | 77de0283ac92 |
files | src/parallel_execution/test/rbTree_test.cbc |
diffstat | 1 files changed, 65 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/parallel_execution/test/rbTree_test.cbc Fri Dec 08 15:32:14 2017 +0900 @@ -0,0 +1,65 @@ +#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(); +}