# HG changeset patch # User Tatsuki IHA # Date 1483473639 -32400 # Node ID 37d8759300619cd3f58c7c57ff20d5f959a2a605 # Parent 962fbfe777bb81a24636e50d370f90f36fa693af Fix queue_test error diff -r 962fbfe777bb -r 37d875930061 src/parallel_execution/test/queue_test.c --- a/src/parallel_execution/test/queue_test.c Mon Jan 02 01:01:37 2017 +0900 +++ b/src/parallel_execution/test/queue_test.c Wed Jan 04 05:00:39 2017 +0900 @@ -12,14 +12,15 @@ } __code queueTest1_stub(struct Context* context) { + Queue* queue = &createSingleLinkedQueue(context)->Queue; + context->data[D_Queue]->Queue.queue = (union Data*)queue; + SingleLinkedQueue* singleLinkedQueue = &context->data[D_Queue]->Queue.queue->Queue.queue->SingleLinkedQueue; + assert(singleLinkedQueue->top == NULL); + assert(singleLinkedQueue->last == NULL); Task* task = &ALLOCATE(context, Task)->Task; - struct Queue* queue = &(createSingleLinkedQueue(context)->Queue); - assert(queue->queue->SingleLinkedQueue.top == NULL); - assert(queue->queue->SingleLinkedQueue.last == NULL); - context->data[D_Queue]->Queue.queue = (union Data*)queue; goto queueTest1(context, task, - &context->data[D_Queue]->Queue.queue); + &context->data[D_Queue]->Queue); } __code queueTest2(struct Context* context, struct Task* task, struct Queue* queue) { @@ -30,12 +31,13 @@ } __code queueTest2_stub(struct Context* context) { - // assert(((struct Task)context->data[D_Queue]->queue.queue->queue.queue->singleLinkedQueue.top->data)->code == C_QueueTest1) - // assert(((struct Task)context->data[D_Queue]->queue.queue->queue.queue->singleLinkedQueue.top->data)->code == C_QueueTest1) + SingleLinkedQueue* singleLinkedQueue = &context->data[D_Queue]->Queue.queue->Queue.queue->SingleLinkedQueue; + assert(((struct Task*)singleLinkedQueue->top->data)->code == C_queueTest1); + assert(((struct Task*)singleLinkedQueue->last->data)->code == C_queueTest1); Task* task = &ALLOCATE(context, Task)->Task; goto queueTest2(context, task, - &context->data[D_Queue]->Queue.queue); + &context->data[D_Queue]->Queue); } __code queueTest3(struct Context* context, struct Queue* queue) { @@ -44,25 +46,26 @@ } __code queueTest3_stub(struct Context* context) { - // assert(((struct Task)context->data[D_Queue]->queue.queue->queue.queue->singleLinkedQueue.top->data)->code == C_QueueTest2) - // assert(((struct Task)context->data[D_Queue]->queue.queue->queue.queue->singleLinkedQueue.top->data)->code == C_QueueTest1) + SingleLinkedQueue* singleLinkedQueue = &context->data[D_Queue]->Queue.queue->Queue.queue->SingleLinkedQueue; + assert(((struct Task*)singleLinkedQueue->top->data)->code == C_queueTest1); + assert(((struct Task*)singleLinkedQueue->last->data)->code == C_queueTest2); goto queueTest3(context, &context->data[D_Queue]->Queue); } -__code queueTest4(struct Context* context, struct Queue* queue) { - goto meta(context, C_queueTest4 /*Exit*/ ); +__code queueTest4(struct Context* context) { } __code queueTest4_stub(struct Context* context) { -// assert(((struct Task)context->data[D_Queue]->queue.queue.data)->code == C_queueTest1) -// assert(((struct Task)context->data[D_Queue]->queue.queue.last->data)->code == C_queueTest2) - goto queueTest4(context, - &context->data[D_Queue]->Queue.queue); + SingleLinkedQueue* singleLinkedQueue = &context->data[D_Queue]->Queue.queue->Queue.queue->SingleLinkedQueue; + assert(((struct Task*)context->data[D_Queue]->Queue.data)->code == C_queueTest1); + assert(((struct Task*)singleLinkedQueue->top->data)->code == C_queueTest2); + assert(((struct Task*)singleLinkedQueue->last->data)->code == C_queueTest2); + goto queueTest4(context); } int main(int argc, char const* argv[]) { - struct Context* main_context = NEW(struct Context); + Context* main_context = NEW(struct Context); initContext(main_context); main_context->next = C_queueTest1; goto start_code(main_context);