changeset 322:366baa247572

Use generate_stub for queue_test
author Tatsuki IHA <e125716@ie.u-ryukyu.ac.jp>
date Tue, 21 Mar 2017 03:58:31 +0900
parents a9a6d571fa80
children 131a04a70dd8
files src/parallel_execution/CMakeLists.txt src/parallel_execution/Todo src/parallel_execution/test/queue_test.c
diffstat 3 files changed, 2 insertions(+), 72 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/CMakeLists.txt	Wed Mar 01 18:28:49 2017 +0900
+++ b/src/parallel_execution/CMakeLists.txt	Tue Mar 21 03:58:31 2017 +0900
@@ -76,7 +76,7 @@
   TARGET
       queue_test
   SOURCES 
-      test/queue_test.c SingleLinkedQueue.cbc
+      test/queue_test.cbc SingleLinkedQueue.cbc
 )
 
 GearsCommand(
--- a/src/parallel_execution/Todo	Wed Mar 01 18:28:49 2017 +0900
+++ b/src/parallel_execution/Todo	Tue Mar 21 03:58:31 2017 +0900
@@ -1,6 +1,6 @@
 Wed Mar  1 18:25:36 JST 2017
 
-    parallel_executtion/text/ を .cbc に書き直す
+    parallel_executtion/test/ を .cbc に書き直す
     rb_tree の stub をできるだけ取り外す
     synchornizedQueue の meta部分を分離する
     synchronizedQueue のバグをとる
--- a/src/parallel_execution/test/queue_test.c	Wed Mar 01 18:28:49 2017 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-#include "../context.h"
-#include <assert.h>
-
-__code queueTest1(struct Context* context, struct Task* task, struct Queue* queue) {
-    task->code = C_queueTest1;
-    queue->next = C_queueTest2;
-    queue->data = (union Data*)task;
-    goto meta(context, queue->queue->Queue.put);
-}
-
-__code queueTest1_stub(struct Context* context) {
-    Queue* queue = createSingleLinkedQueue(context);
-    context->data[D_Queue]->Queue.queue = (union Data*)queue;
-    SingleLinkedQueue* singleLinkedQueue = &context->data[D_Queue]->Queue.queue->Queue.queue->SingleLinkedQueue;
-    assert(singleLinkedQueue->top == NULL);
-    assert(singleLinkedQueue->last == NULL);
-    Task* task = &ALLOCATE(context, Task)->Task;
-    goto queueTest1(context,
-            task,
-            &context->data[D_Queue]->Queue);
-}
-
-__code queueTest2(struct Context* context, struct Task* task, struct Queue* queue) {
-    task->code = C_queueTest2;
-    queue->next = C_queueTest3;
-    queue->data = (union Data*)task;
-    goto meta(context, queue->queue->Queue.put);
-}
-
-__code queueTest2_stub(struct Context* context) {
-    SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue);
-    assert(singleLinkedQueue->top->data->Task.code == C_queueTest1);
-    assert(singleLinkedQueue->last->data->Task.code == C_queueTest1);
-    Task* task = &ALLOCATE(context, Task)->Task;
-    goto queueTest2(context,
-            task,
-            &context->data[D_Queue]->Queue);
-}
-
-__code queueTest3(struct Context* context, struct Queue* queue) {
-    queue->next = C_queueTest4;
-    goto meta(context, queue->queue->Queue.take);
-}
-
-__code queueTest3_stub(struct Context* context) {
-    SingleLinkedQueue* singleLinkedQueue = (SingleLinkedQueue*)GearImpl(context, Queue, queue);
-    assert(singleLinkedQueue->top->data->Task.code == C_queueTest1);
-    assert(singleLinkedQueue->last->data->Task.code == C_queueTest2);
-    goto queueTest3(context,
-            &context->data[D_Queue]->Queue);
-}
-
-__code queueTest4(struct Context* context) {
-    goto meta(context, C_exit_code);
-}
-
-__code queueTest4_stub(struct Context* context) {
-    SingleLinkedQueue* singleLinkedQueue = &context->data[D_Queue]->Queue.queue->Queue.queue->SingleLinkedQueue;
-    assert(context->data[D_Queue]->Queue.data->Task.code == C_queueTest1);
-    assert(singleLinkedQueue->top->data->Task.code == C_queueTest2);
-    assert(singleLinkedQueue->last->data->Task.code == C_queueTest2);
-    goto queueTest4(context);
-}
-
-int main(int argc, char const* argv[]) {
-    struct Context* main_context = NEW(struct Context);
-    initContext(main_context);
-    main_context->next = C_queueTest1;
-    goto start_code(main_context);
-}