Mercurial > hg > Members > Moririn
view src/parallel_execution/test/queue_test.cbc @ 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 | a9863b41f026 |
children | 394e38952c80 |
line wrap: on
line source
#include "../../context.h" #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 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->data->Node.color == Red); assert(singleLinkedQueue->last->data->Node.color == Red); Queue* queue = Gearef(context, 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->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 exit_code(context); } 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); }