annotate src/parallel_execution/test/queue_test.c @ 257:cd3486e4ba70

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