Mercurial > hg > Members > Moririn
view 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 source
#include "../../context.h" #include <assert.h> __code queueTest1(struct Queue* queue) { 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; goto queue->put(node, queueTest3); } __code queueTest2_stub(struct Context* context) { SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue); assert(singleLinkedQueue->top->next->data->Node.color == Red); assert(singleLinkedQueue->last->data->Node.color == Red); Queue* queue = (struct Queue*)Gearef(context, Queue)->queue; goto queueTest2(context, queue); } __code queueTest3(struct Queue* queue) { goto queue->take(assert3); } __code queueTest3_stub(struct Context* context) { SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue); assert(singleLinkedQueue->top->next->data->Node.color == Red); assert(singleLinkedQueue->last->data->Node.color == Black); Queue* queue = (struct Queue*)Gearef(context, Queue)->queue; goto queueTest3(context, queue); } __code assert3(struct Queue* queue) { SingleLinkedQueue* singleLinkedQueue = &queue->queue->Queue.queue->SingleLinkedQueue; assert(singleLinkedQueue->top->next->data->Node.color == Black); assert(singleLinkedQueue->last->data->Node.color == Black); goto exit_code(context); } int main(int argc, char const* argv[]) { goto queueTest1(); }