annotate src/parallel_execution/test/queue_test.c @ 281:ceb8735aefb0

fix queue_test
author mir3636
date Fri, 03 Feb 2017 18:19:24 +0900
parents 2c2e4e597eb0
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 #include "../context.h"
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 #include <assert.h>
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
3
209
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
4 __code queueTest1(struct Context* context, struct Task* task, struct Queue* queue) {
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
5 task->code = C_queueTest1;
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
6 queue->next = C_queueTest2;
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
7 queue->data = (union Data*)task;
203
25db17f32ac2 replace Stack for stack
ikkun
parents: 182
diff changeset
8 goto meta(context, queue->queue->Queue.put);
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
9 }
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
10
209
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
11 __code queueTest1_stub(struct Context* context) {
280
2c2e4e597eb0 generate no compile errors
mir3636
parents: 257
diff changeset
12 Queue* queue = createSingleLinkedQueue(context);
212
37d875930061 Fix queue_test error
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 209
diff changeset
13 context->data[D_Queue]->Queue.queue = (union Data*)queue;
37d875930061 Fix queue_test error
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 209
diff changeset
14 SingleLinkedQueue* singleLinkedQueue = &context->data[D_Queue]->Queue.queue->Queue.queue->SingleLinkedQueue;
37d875930061 Fix queue_test error
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 209
diff changeset
15 assert(singleLinkedQueue->top == NULL);
37d875930061 Fix queue_test error
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 209
diff changeset
16 assert(singleLinkedQueue->last == NULL);
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 Task* task = &ALLOCATE(context, Task)->Task;
209
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
18 goto queueTest1(context,
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
19 task,
212
37d875930061 Fix queue_test error
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 209
diff changeset
20 &context->data[D_Queue]->Queue);
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 }
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
22
209
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
23 __code queueTest2(struct Context* context, struct Task* task, struct Queue* queue) {
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
24 task->code = C_queueTest2;
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
25 queue->next = C_queueTest3;
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
26 queue->data = (union Data*)task;
203
25db17f32ac2 replace Stack for stack
ikkun
parents: 182
diff changeset
27 goto meta(context, queue->queue->Queue.put);
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
28 }
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
29
209
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
30 __code queueTest2_stub(struct Context* context) {
281
ceb8735aefb0 fix queue_test
mir3636
parents: 280
diff changeset
31 SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue);
ceb8735aefb0 fix queue_test
mir3636
parents: 280
diff changeset
32 assert(singleLinkedQueue->top->data->Task.code == C_queueTest1);
216
6578c5c274ba Not use cast for queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 214
diff changeset
33 assert(singleLinkedQueue->last->data->Task.code == C_queueTest1);
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
34 Task* task = &ALLOCATE(context, Task)->Task;
209
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
35 goto queueTest2(context,
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
36 task,
212
37d875930061 Fix queue_test error
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 209
diff changeset
37 &context->data[D_Queue]->Queue);
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
38 }
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
39
209
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
40 __code queueTest3(struct Context* context, struct Queue* queue) {
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
41 queue->next = C_queueTest4;
203
25db17f32ac2 replace Stack for stack
ikkun
parents: 182
diff changeset
42 goto meta(context, queue->queue->Queue.take);
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
43 }
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
44
209
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
45 __code queueTest3_stub(struct Context* context) {
281
ceb8735aefb0 fix queue_test
mir3636
parents: 280
diff changeset
46 SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue);
216
6578c5c274ba Not use cast for queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 214
diff changeset
47 assert(singleLinkedQueue->top->data->Task.code == C_queueTest1);
6578c5c274ba Not use cast for queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 214
diff changeset
48 assert(singleLinkedQueue->last->data->Task.code == C_queueTest2);
209
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
49 goto queueTest3(context,
203
25db17f32ac2 replace Stack for stack
ikkun
parents: 182
diff changeset
50 &context->data[D_Queue]->Queue);
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
51 }
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
52
212
37d875930061 Fix queue_test error
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 209
diff changeset
53 __code queueTest4(struct Context* context) {
213
9e5c504adc21 Add goto exit to queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 212
diff changeset
54 goto meta(context, C_exit_code);
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
55 }
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
56
209
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
57 __code queueTest4_stub(struct Context* context) {
212
37d875930061 Fix queue_test error
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 209
diff changeset
58 SingleLinkedQueue* singleLinkedQueue = &context->data[D_Queue]->Queue.queue->Queue.queue->SingleLinkedQueue;
216
6578c5c274ba Not use cast for queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 214
diff changeset
59 assert(context->data[D_Queue]->Queue.data->Task.code == C_queueTest1);
6578c5c274ba Not use cast for queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 214
diff changeset
60 assert(singleLinkedQueue->top->data->Task.code == C_queueTest2);
6578c5c274ba Not use cast for queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 214
diff changeset
61 assert(singleLinkedQueue->last->data->Task.code == C_queueTest2);
212
37d875930061 Fix queue_test error
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents: 209
diff changeset
62 goto queueTest4(context);
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
63 }
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
64
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
65 int main(int argc, char const* argv[]) {
257
cd3486e4ba70 fix make error of twice
mir3636
parents: 246
diff changeset
66 struct Context* main_context = NEW(struct Context);
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
67 initContext(main_context);
209
5708390a9d88 fix compile errors
mir3636
parents: 208
diff changeset
68 main_context->next = C_queueTest1;
182
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
69 goto start_code(main_context);
57a11c15ff4c Add queue_test
Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
parents:
diff changeset
70 }