Mercurial > hg > GearsTemplate
view src/parallel_execution/test/queue_test.cbc @ 456:95f58f2b2c0e
Add TaskIterator
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 11 Dec 2017 16:26:55 +0900 |
parents | 481fce540daf |
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(); }