Mercurial > hg > GearsTemplate
changeset 390:c93216e68d70
Can work queue_test converted by generate_stub
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 31 Jul 2017 22:40:08 +0900 |
parents | d9a7620a1106 |
children | 2d9c500f263e |
files | src/parallel_execution/test/queue_test.cbc src/parallel_execution/test/stack_test.cbc |
diffstat | 2 files changed, 19 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- 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[]) {
--- 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);