Mercurial > hg > GearsTemplate
diff src/parallel_execution/test/queue_test.cbc @ 442:481fce540daf
Fix goto implement method of generate_stub
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 21 Nov 2017 09:16:12 +0900 |
parents | 394e38952c80 |
children | 831b7f6fd687 |
line wrap: on
line diff
--- a/src/parallel_execution/test/queue_test.cbc Tue Nov 21 04:28:36 2017 +0900 +++ b/src/parallel_execution/test/queue_test.cbc Tue Nov 21 09:16:12 2017 +0900 @@ -2,12 +2,16 @@ #include <assert.h> __code queueTest1(struct Queue* queue) { - queue->queue = (union Data*)createSingleLinkedQueue(context); Node* node = new Node(); node->color = Red; goto queue->put(node, queueTest2); } +__code queueTest1_stub(struct Context* context) { + Queue* queue = createSingleLinkedQueue(context); + goto queueTest1(context, queue); +} + __code queueTest2(struct Queue* queue) { Node* node = new Node(); node->color = Black; @@ -18,7 +22,7 @@ SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue); assert(singleLinkedQueue->top->next->data->Node.color == Red); assert(singleLinkedQueue->last->data->Node.color == Red); - Queue* queue = Gearef(context, Queue); + Queue* queue = (struct Queue*)Gearef(context, Queue)->queue; goto queueTest2(context, queue); } @@ -30,7 +34,7 @@ SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue); assert(singleLinkedQueue->top->next->data->Node.color == Red); assert(singleLinkedQueue->last->data->Node.color == Black); - Queue* queue = Gearef(context, Queue); + Queue* queue = (struct Queue*)Gearef(context, Queue)->queue; goto queueTest3(context, queue); } @@ -42,8 +46,5 @@ } int main(int argc, char const* argv[]) { - struct Context* main_context = NEW(struct Context); - initContext(main_context); - main_context->next = C_queueTest1; - goto start_code(main_context); + goto queueTest1(); }