Mercurial > hg > GearsTemplate
changeset 205:1b15f02ec713
Fix queue test
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 20 Dec 2016 16:54:42 +0900 |
parents | 57a88b2ae3b3 |
children | bd11fa6891b6 |
files | src/parallel_execution/CMakeLists.txt src/parallel_execution/test/queue_test.c src/parallel_execution/test/stack_test.c |
diffstat | 3 files changed, 27 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/src/parallel_execution/CMakeLists.txt Tue Dec 20 03:18:29 2016 +0900 +++ b/src/parallel_execution/CMakeLists.txt Tue Dec 20 16:54:42 2016 +0900 @@ -16,26 +16,26 @@ set( _ONE_VALUE_ARGS TARGET ) set( _MULTI_VALUE_ARGS SOURCES ) cmake_parse_arguments( _Gears "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} ) - add_executable(${_Gears_TARGET} ${_Gears_SOURCES} context.c c/enumCode.h ) + add_executable(${_Gears_TARGET} ${_Gears_SOURCES} context.c c/enumCode.h) endmacro() GearsCommand( TARGET twice SOURCES - main.c rb_tree.c stack.c origin_cs.c allocate.c compare.c worker.c dependency.c time.c twice.c + main.c rb_tree.c stack.c origin_cs.c allocate.c compare.c worker.c dependency.c time.c twice.c test/stack_test.c stack.c test/queue_test.c queue.c ) GearsCommand( TARGET test/stack_test SOURCES - test/stack_test.c stack.c + main.c rb_tree.c stack.c origin_cs.c allocate.c compare.c worker.c dependency.c time.c twice.c test/stack_test.c stack.c test/queue_test.c queue.c ) GearsCommand( TARGET test/queue_test SOURCES - test/queue_test.c queue.c + main.c rb_tree.c stack.c origin_cs.c allocate.c compare.c worker.c dependency.c time.c twice.c test/stack_test.c stack.c test/queue_test.c queue.c )
--- a/src/parallel_execution/test/queue_test.c Tue Dec 20 03:18:29 2016 +0900 +++ b/src/parallel_execution/test/queue_test.c Tue Dec 20 16:54:42 2016 +0900 @@ -19,7 +19,7 @@ context->data[D_Queue]->Queue.queue = (union Data*)queue; goto queue_test1(context, task, - &context->data[D_Queue]->Queue); + &context->data[D_Queue]->Queue.queue); } __code queue_test2(struct Context* context, struct Task* task, struct Queue* queue) {
--- a/src/parallel_execution/test/stack_test.c Tue Dec 20 03:18:29 2016 +0900 +++ b/src/parallel_execution/test/stack_test.c Tue Dec 20 16:54:42 2016 +0900 @@ -5,65 +5,62 @@ __code stack_test1(struct Context* context, struct Task* task, struct Stack* stack) { - task->code = C_StackTest1; - stack->next = C_StackTest2; + task->code = C_stack_test1; + stack->next = C_stack_test2; stack->data = (union Data*)task; - goto meta(context, stack->stack->stack.put); + goto meta(context, stack->push); } __code stack_test1_stub(struct Context* context) { Task* task = &ALLOCATE(context, Task)->Task; - struct Stack* stack = &(createSingleLinkedStack(context)->stack); - assert(stack->stack->singleLinkedStack.top == NULL); - assert(stack->stack->singleLinkedStack.last == NULL); - context->data[D_Stack]->stack.stack = (union Data*)stack; + struct Stack* stack = &(createSingleLinkedStack(context)->Stack); + assert(stack->stack->SingleLinkedStack.top == NULL); + context->data[D_Stack]->Stack.stack = (union Data*)stack; goto stack_test1(context, task, - &context->data[D_Stack]->stack); + context->data[D_Stack]->Stack.stack); } __code stack_test2(struct Context* context, struct Task* task, struct Stack* stack) { - task->code = C_StackTest2; - stack->next = C_StackTest3; + task->code = C_stack_test2; + stack->next = C_stack_test3; stack->data = (union Data*)task; - goto meta(context, stack->stack->stack.put); + goto meta(context, stack->push); } __code stack_test2_stub(struct Context* context) { - assert(((struct Task)context->data[D_Stack]->stack.stack->stack.stack->singleLinkedStack.top->data)->code == C_StackTest1) - assert(((struct Task)context->data[D_Stack]->stack.stack->stack.stack->singleLinkedStack.top->data)->code == C_StackTest1) + assert(((struct Task)context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data)->code == C_stack_test1); Task* task = &ALLOCATE(context, Task)->Task; goto stack_test2(context, task, - &context->data[D_Stack]->stack->stack); + context->data[D_Stack]->Stack.stack); } __code stack_test3(struct Context* context, struct Stack* stack) { - stack->next = C_StackTest4; - goto meta(context, stack->stack->take) + stack->next = C_stack_test4; + goto meta(context, stack->take) } __code stack_test3_stub(struct Context* context) { - assert(((struct Task)context->data[D_Stack]->stack.stack->stack.stack->singleLinkedStack.top->data)->code == C_StackTest2) - assert(((struct Task)context->data[D_Stack]->stack.stack->stack.stack->singleLinkedStack.top->data)->code == C_StackTest1) + assert(((struct Task)context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data)->code == C_stack_test2); + assert(((struct Task)context->data[D_Stack]->Stack.stack->Stack.stack->SingleLinkedStack.top->data)->code == C_stack_test1); goto stack_test3(context, - &context->data[D_Stack]->stack); + context->data[D_Stack]->Stack.stack); } __code stack_test4(struct Context* context) { - goto meta(context, Exit); + goto meta(context, C_exit); } __code stack_test4_stub(struct Context* context) { - assert(((struct Task)context->data[D_Stack]->stack.stack.data)->code == C_StackTest1) - assert(((struct Task)context->data[D_Stack]->stack.stack.last->data)->code == C_StackTest2) - goto stack_test4(context, - &context->data[D_Stack]->stack->stack); + assert(((struct Task)context->data[D_Stack]->stack.stack.data)->code == C_StackTest1); + assert(((struct Task)context->data[D_Stack]->stack.stack.last->data)->code == C_StackTest2); + goto stack_test4(context); } int main(int argc, char const* argv[]) { struct Context* main_context = NEW(struct Context); initContext(main_context); - main_context->next = C_StackTest1; + main_context->next = C_stack_test1; goto start_code(main_context); }