Mercurial > hg > Members > Moririn
view src/parallel_execution/test/stack_test.cbc @ 442:481fce540daf
Fix goto implement method of generate_stub
author | Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 21 Nov 2017 09:16:12 +0900 |
parents | c93216e68d70 |
children | 831b7f6fd687 |
line wrap: on
line source
#include "../../context.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(); }