# HG changeset patch # User Tatsuki IHA # Date 1501508408 -32400 # Node ID c93216e68d703e6190583714eb45ae5221d32e01 # Parent d9a7620a11061b48906542cb3bc1fd218a779f82 Can work queue_test converted by generate_stub diff -r d9a7620a1106 -r c93216e68d70 src/parallel_execution/test/queue_test.cbc --- a/src/parallel_execution/test/queue_test.cbc Sat Jul 29 19:35:16 2017 +0900 +++ b/src/parallel_execution/test/queue_test.cbc Mon Jul 31 22:40:08 2017 +0900 @@ -5,43 +5,40 @@ queue->queue = (union Data*)createSingleLinkedQueue(context); Node* node = new Node(); node->color = Red; - queue->data = (union Data*)node; - queue->next = C_assert1; - goto meta(context, queue->queue->Queue.put); -} - -__code assert1(struct Queue* queue) { - SingleLinkedQueue* singleLinkedQueue = &queue->queue->Queue.queue->SingleLinkedQueue; - assert(singleLinkedQueue->top->data->Node.color == Red); - assert(singleLinkedQueue->last->data->Node.color == Red); - goto meta(context, C_queueTest2); + goto queue->put(node, queueTest2); } __code queueTest2(struct Queue* queue) { Node* node = new Node(); node->color = Black; - queue->data = (union Data*)node; - queue->next = C_assert2; - goto meta(context, queue->queue->Queue.put); + goto queue->put(node, queueTest3); } -__code assert2(struct Queue* queue) { - SingleLinkedQueue* singleLinkedQueue = &queue->queue->Queue.queue->SingleLinkedQueue; +__code queueTest2_stub(struct Context* context) { + SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue); assert(singleLinkedQueue->top->data->Node.color == Red); - assert(singleLinkedQueue->last->data->Node.color == Black); - goto meta(context, C_queueTest3); + assert(singleLinkedQueue->last->data->Node.color == Red); + Queue* queue = Gearef(context, Queue); + goto queueTest2(context, queue); } __code queueTest3(struct Queue* queue) { - queue->next = C_assert3; - goto meta(context, queue->queue->Queue.take); + goto queue->take(assert3); +} + +__code queueTest3_stub(struct Context* context) { + SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue); + assert(singleLinkedQueue->top->data->Node.color == Red); + assert(singleLinkedQueue->last->data->Node.color == Black); + Queue* queue = Gearef(context, Queue); + goto queueTest3(context, queue); } __code assert3(struct Queue* queue) { SingleLinkedQueue* singleLinkedQueue = &queue->queue->Queue.queue->SingleLinkedQueue; assert(singleLinkedQueue->top->data->Node.color == Black); assert(singleLinkedQueue->last->data->Node.color == Black); - goto meta(context, C_exit_code); + goto exit_code(context); } int main(int argc, char const* argv[]) { diff -r d9a7620a1106 -r c93216e68d70 src/parallel_execution/test/stack_test.cbc --- a/src/parallel_execution/test/stack_test.cbc Sat Jul 29 19:35:16 2017 +0900 +++ b/src/parallel_execution/test/stack_test.cbc Mon Jul 31 22:40:08 2017 +0900 @@ -15,7 +15,7 @@ } __code stackTest2_stub(struct Context* context) { - SingleLinkedStack* singleLinkedStack = &stack->stack->Stack.stack->SingleLinkedStack; + SingleLinkedStack* singleLinkedStack = (SingleLinkedStack*)GearImpl(context, Stack, stack); assert(singleLinkedStack->top->data->Node.color == Red); Stack* stack = Gearef(context, Stack); goto stackTest2(context, stack); @@ -29,7 +29,7 @@ /* assert on stack implementation */ - SingleLinkedStack* singleLinkedStack = &stack->stack->Stack.stack->SingleLinkedStack; + SingleLinkedStack* singleLinkedStack = (SingleLinkedStack*)GearImpl(context, Stack, stack); assert(singleLinkedStack->top->data->Node.color == Black); Stack* stack = Gearef(context, Stack); goto stackTest3(context, stack);