annotate src/parallel_execution/test/queue_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 394e38952c80
children 831b7f6fd687
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
323
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "../../context.h"
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include <assert.h>
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 __code queueTest1(struct Queue* queue) {
350
a9863b41f026 Fix error for queue & stack test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
5 Node* node = new Node();
a9863b41f026 Fix error for queue & stack test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
6 node->color = Red;
390
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
7 goto queue->put(node, queueTest2);
323
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 }
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
442
481fce540daf Fix goto implement method of generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 399
diff changeset
10 __code queueTest1_stub(struct Context* context) {
481fce540daf Fix goto implement method of generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 399
diff changeset
11 Queue* queue = createSingleLinkedQueue(context);
481fce540daf Fix goto implement method of generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 399
diff changeset
12 goto queueTest1(context, queue);
481fce540daf Fix goto implement method of generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 399
diff changeset
13 }
481fce540daf Fix goto implement method of generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 399
diff changeset
14
323
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
15 __code queueTest2(struct Queue* queue) {
350
a9863b41f026 Fix error for queue & stack test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
16 Node* node = new Node();
a9863b41f026 Fix error for queue & stack test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
17 node->color = Black;
390
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
18 goto queue->put(node, queueTest3);
323
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 }
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
390
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
21 __code queueTest2_stub(struct Context* context) {
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
22 SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue);
399
394e38952c80 Add dummy data to SingleLinkedQueue
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 390
diff changeset
23 assert(singleLinkedQueue->top->next->data->Node.color == Red);
390
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
24 assert(singleLinkedQueue->last->data->Node.color == Red);
442
481fce540daf Fix goto implement method of generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 399
diff changeset
25 Queue* queue = (struct Queue*)Gearef(context, Queue)->queue;
390
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
26 goto queueTest2(context, queue);
323
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
27 }
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29 __code queueTest3(struct Queue* queue) {
390
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
30 goto queue->take(assert3);
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
31 }
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
32
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
33 __code queueTest3_stub(struct Context* context) {
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
34 SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue);
399
394e38952c80 Add dummy data to SingleLinkedQueue
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 390
diff changeset
35 assert(singleLinkedQueue->top->next->data->Node.color == Red);
390
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
36 assert(singleLinkedQueue->last->data->Node.color == Black);
442
481fce540daf Fix goto implement method of generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 399
diff changeset
37 Queue* queue = (struct Queue*)Gearef(context, Queue)->queue;
390
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
38 goto queueTest3(context, queue);
323
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 }
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
40
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
41 __code assert3(struct Queue* queue) {
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
42 SingleLinkedQueue* singleLinkedQueue = &queue->queue->Queue.queue->SingleLinkedQueue;
399
394e38952c80 Add dummy data to SingleLinkedQueue
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 390
diff changeset
43 assert(singleLinkedQueue->top->next->data->Node.color == Black);
350
a9863b41f026 Fix error for queue & stack test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 323
diff changeset
44 assert(singleLinkedQueue->last->data->Node.color == Black);
390
c93216e68d70 Can work queue_test converted by generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 350
diff changeset
45 goto exit_code(context);
323
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
46 }
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
47
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
48 int main(int argc, char const* argv[]) {
442
481fce540daf Fix goto implement method of generate_stub
Tatsuki IHA <innparusu@cr.ie.u-ryukyu.ac.jp>
parents: 399
diff changeset
49 goto queueTest1();
323
131a04a70dd8 Use generate_stub for stack_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
50 }