Mercurial > hg > Gears > GearsAgda
view src/parallel_execution/test/queue_test.cbc @ 350:a9863b41f026
Fix error for queue & stack test
author | Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 07 Jun 2017 15:17:36 +0900 |
parents | 131a04a70dd8 |
children | c93216e68d70 |
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; 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); } __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); } __code assert2(struct Queue* queue) { SingleLinkedQueue* singleLinkedQueue = &queue->queue->Queue.queue->SingleLinkedQueue; assert(singleLinkedQueue->top->data->Node.color == Red); assert(singleLinkedQueue->last->data->Node.color == Black); goto meta(context, C_queueTest3); } __code queueTest3(struct Queue* queue) { queue->next = C_assert3; goto meta(context, queue->queue->Queue.take); } __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); } 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); }