Mercurial > hg > Gears > GearsAgda
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 |
rev | line source |
---|---|
182 | 1 #include "../queue.h" |
2 #include "../context.h" | |
3 #include "../origin_cs.h" | |
4 #include <assert.h> | |
5 | |
209 | 6 __code queueTest1(struct Context* context, struct Task* task, struct Queue* queue) { |
7 task->code = C_queueTest1; | |
8 queue->next = C_queueTest2; | |
182 | 9 queue->data = (union Data*)task; |
203 | 10 goto meta(context, queue->queue->Queue.put); |
182 | 11 } |
12 | |
209 | 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 | 19 Task* task = &ALLOCATE(context, Task)->Task; |
209 | 20 goto queueTest1(context, |
182 | 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 | 23 } |
24 | |
209 | 25 __code queueTest2(struct Context* context, struct Task* task, struct Queue* queue) { |
26 task->code = C_queueTest2; | |
27 queue->next = C_queueTest3; | |
182 | 28 queue->data = (union Data*)task; |
203 | 29 goto meta(context, queue->queue->Queue.put); |
182 | 30 } |
31 | |
209 | 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 | 36 Task* task = &ALLOCATE(context, Task)->Task; |
209 | 37 goto queueTest2(context, |
182 | 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 | 40 } |
41 | |
209 | 42 __code queueTest3(struct Context* context, struct Queue* queue) { |
43 queue->next = C_queueTest4; | |
203 | 44 goto meta(context, queue->queue->Queue.take); |
182 | 45 } |
46 | |
209 | 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 | 51 goto queueTest3(context, |
203 | 52 &context->data[D_Queue]->Queue); |
182 | 53 } |
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 | 57 } |
58 | |
209 | 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 | 65 } |
66 | |
67 int main(int argc, char const* argv[]) { | |
257 | 68 struct Context* main_context = NEW(struct Context); |
182 | 69 initContext(main_context); |
209 | 70 main_context->next = C_queueTest1; |
182 | 71 goto start_code(main_context); |
72 } |