Mercurial > hg > GearsTemplate
view src/parallel_execution/test/stack_test.cbc @ 351:3529c7e93c4f
fix generate_stub
author | mir3636 |
---|---|
date | Thu, 08 Jun 2017 15:44:39 +0900 |
parents | a9863b41f026 |
children | c93216e68d70 |
line wrap: on
line source
#include "../../context.h" #include <assert.h> __code stackTest1(struct Stack* stack) { stack->stack = (union Data*)createSingleLinkedStack(context); Node* node = new Node(); node->color = Red; goto stack->push(node, stackTest2); } __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 = &stack->stack->Stack.stack->SingleLinkedStack; assert(singleLinkedStack->top->data->Node.color == Red); Stack* stack = Gearef(context, 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 = &stack->stack->Stack.stack->SingleLinkedStack; assert(singleLinkedStack->top->data->Node.color == Black); Stack* stack = Gearef(context, 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(); }