Mercurial > hg > GearsTemplate
view src/parallel_execution/test/stack_test.cbc @ 466:831b7f6fd687
Fix warning pointer type
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 21 Dec 2017 18:52:21 +0900 |
parents | 481fce540daf |
children | ac244346c85d |
line wrap: on
line source
#include "../../context.h" #include "Stack.h" #include <assert.h> __code stackTest1(struct Stack* stack) { Node* node = new Node(); node->color = Red; goto stack->push(node, stackTest2); } __code stackTest1_stub(struct Context* context) { Stack* stack = createSingleLinkedStack(context); goto stackTest1(context, stack); } __code stackTest2(struct Stack* stack) { Node* node = new Node(); node->color = Black; goto stack->push(node, stackTest3); } __code stackTest2_stub(struct Context* context) { SingleLinkedStack* singleLinkedStack = (SingleLinkedStack*)GearImpl(context, Stack, stack); assert(singleLinkedStack->top->data->Node.color == Red); Stack* stack = (struct Stack*)Gearef(context, Stack)->stack; goto stackTest2(context, stack); } __code stackTest3(struct Stack* stack) { goto stack->pop(assert3); } __code stackTest3_stub(struct Context* context) { /* assert on stack implementation */ SingleLinkedStack* singleLinkedStack = (SingleLinkedStack*)GearImpl(context, Stack, stack); assert(singleLinkedStack->top->data->Node.color == Black); Stack* stack = (struct Stack*)Gearef(context, Stack)->stack; goto stackTest3(context, stack); } __code assert3(struct Node* node, struct Stack* stack) { /* assert in normal level */ assert(node->color == Red); goto exit_code(0); } int main(int argc, char const* argv[]) { goto stackTest1(); }