Mercurial > hg > Members > Moririn
view src/parallel_execution/test/stack_test.c @ 401:408b4aab7610
Supported par goto iterate statement for perl script
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 29 Aug 2017 21:50:57 +0900 |
parents | c1512f358c37 |
children |
line wrap: on
line source
#include "../../context.h" #include <assert.h> __code stackTest1(struct Context *context,struct Stack* stack) { stack->stack = (union Data*)createSingleLinkedStack(context); Node* node = &ALLOCATE(context, Node)->Node; node->color = Red; Gearef(context, Stack)->stack = stack->stack; Gearef(context, Stack)->data = node; Gearef(context, Stack)->next = stackTest2; goto meta(context, stack->stack->Stack.push); } __code stackTest1_stub(struct Context* context) { Stack* stack = Gearef(context, Stack); goto stackTest1(context, stack); } __code stackTest2(struct Context *context,struct Stack* stack) { Node* node = &ALLOCATE(context, Node)->Node; node->color = Black; Gearef(context, Stack)->stack = stack->stack; Gearef(context, Stack)->data = node; Gearef(context, Stack)->next = stackTest3; goto meta(context, stack->stack->Stack.push); } __code stackTest2_stub(struct Context* context) { SingleLinkedStack* singleLinkedStack = &stack->stack->Stack.stack->SingleLinkedStack; assert(singleLinkedStack->top->data->Node.color == Red); Stack* stack = Gearef(context, Stack); goto stackTest2(context, stack); } __code stackTest3(struct Context *context,struct Stack* stack) { Gearef(context, Stack)->stack = stack->stack; Gearef(context, Stack)->next = assert3; goto meta(context, stack->stack->Stack.pop); } __code stackTest3_stub(struct Context* context) { /* assert on stack implementation */ SingleLinkedStack* singleLinkedStack = &stack->stack->Stack.stack->SingleLinkedStack; assert(singleLinkedStack->top->data->Node.color == Black); Stack* stack = Gearef(context, Stack); goto stackTest3(context, stack); } __code assert3(struct Context *context,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(); } __code assert3_stub(struct Context* context) { Node* node = Gearef(context, Node); Stack* stack = Gearef(context, Stack); goto assert3(context, node, stack); }