Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2012-01-17 13:39:21 -0500
committerThomas Schuetz2012-01-17 13:39:21 -0500
commit3a48b46b2613b03230e97c909846244ba8034fb1 (patch)
treeeaee50dd5bd35c961deb7cb3741a29d09817f400 /examples/org.eclipse.etrice.generator.c.reference
parentaa4c792743f27f427be53a1e535c41907743c8db (diff)
downloadorg.eclipse.etrice-3a48b46b2613b03230e97c909846244ba8034fb1.tar.gz
org.eclipse.etrice-3a48b46b2613b03230e97c909846244ba8034fb1.tar.xz
org.eclipse.etrice-3a48b46b2613b03230e97c909846244ba8034fb1.zip
[runtime.c] added interface and implementation for portable logger
Diffstat (limited to 'examples/org.eclipse.etrice.generator.c.reference')
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/RunAllTestcases.c6
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.c16
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.h13
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.c13
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.h13
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.c28
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.h13
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageQueue.c10
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.c67
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.h26
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCGenerator.xml6
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCRuntime.xml (renamed from examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml)12
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestEtUnitSpecial.xml5
13 files changed, 210 insertions, 18 deletions
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/RunAllTestcases.c b/examples/org.eclipse.etrice.generator.c.reference/src/RunAllTestcases.c
index 3408a0434..c21cc4074 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/RunAllTestcases.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/RunAllTestcases.c
@@ -12,8 +12,6 @@
#include <stdio.h>
-#include "etUnit.h"
-
#include "test/generator/RunCGeneratorTestcases.h"
#include "test/runtime/RunCRuntimeTestcases.h"
@@ -26,11 +24,7 @@ int main(void){
void runTestCases(void){
- etUnit_open("tmp/testlog","TestMessageService");
-
RunCGeneratorTestcases();
RunCRuntimeTestcases();
-
- etUnit_close();
}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.c
index db8176609..cf2d11e9c 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.c
@@ -1,3 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
/*
* RunCGeneratorTestcases.c
*
@@ -8,7 +20,11 @@
#include "RunCGeneratorTestcases.h"
#include "TestDataClass.h"
+#include "etUnit.h"
+
void RunCGeneratorTestcases(void){
+ etUnit_open("tmp/testlog","TestCGenerator");
TestDataClass_runSuite();
+ etUnit_close();
}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.h
index 01472caa9..03d5c4276 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.h
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/RunCGeneratorTestcases.h
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
/*
* RunCGeneratorTestcases.h
*
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.c
index 5c481fd4f..e3c521dd3 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.c
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
/*
* TestDataClass.c
*
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.h
index a3c9b4078..3cbce4bc1 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.h
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.h
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
/*
* TestEmDataClass.h
*
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.c
index 7180c67b9..a9a502f3b 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.c
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
/*
* RunRuntimeTestcases.c
*
@@ -12,10 +25,25 @@
#include "TestEtMessage.h"
#include "TestEtMessageQueue.h"
#include "TestEtMessageService.h"
+#include "TestEtUnit.h"
+
+#include "etUnit.h"
+
void RunCRuntimeTestcases(void){
+ etUnit_open("tmp/testlog","TestCRuntime");
+
TestEtMessage_runSuite();
TestEtMessageQueue_runSuite();
TestEtMessageService_runSuite();
+ TestEtUnit_runSuite();
+
+ etUnit_close();
+
+ /* special situation for testing openAll and closeAll of etUnit
+ * this has to be done outside of etUnit_open and etUnit_close */
+ etUnit_openAll("tmp/testlog","TestEtUnitSpecial", "etUnit", "openAll and closeAll");
+ EXPECT_TRUE("Open and Close", TRUE);
+ etUnit_closeAll();
}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.h
index 604dc0a3e..5d17f7ddb 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.h
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/RunCRuntimeTestcases.h
@@ -1,3 +1,16 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
/*
* RunRuntimeTestcases.h
*
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageQueue.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageQueue.c
index 34efb3b31..3a453962c 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageQueue.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageQueue.c
@@ -25,14 +25,14 @@ void TestEtMessageQueue_testPushPop(void){
etMessageQueue_push(&queue1, &msg1);
etMessageQueue_push(&queue1, &msg2);
- EXPECT_EQUAL_INT16("etMessageQueue.size before", 2,queue1.size);
+ EXPECT_EQUAL_INT16("etMessageQueue.size before", 2, queue1.size);
EXPECT_EQUAL_INT16("etMessageQueue.highWaterMark before", 2, queue1.highWaterMark);
etMessage* rcvMsg1 = etMessageQueue_pop(&queue1);
etMessage* rcvMsg2 = etMessageQueue_pop(&queue1);
- EXPECT_EQUAL_INT16("etMessageQueue.size after", 0,(int32)queue1.size);
- EXPECT_EQUAL_INT16("etMessageQueue.highWaterMark after", 2,queue1.highWaterMark);
+ EXPECT_EQUAL_INT16("etMessageQueue.size after", 0, queue1.size);
+ EXPECT_EQUAL_INT16("etMessageQueue.highWaterMark after", 2, queue1.highWaterMark);
EXPECT_EQUAL_INT16("rcvMsg1->address", 123, rcvMsg1->address);
EXPECT_EQUAL_INT16("rcvMsg1->evtID", 456, rcvMsg1->evtID);
@@ -55,8 +55,6 @@ void TestEtMessageQueue_testPushPop(void){
void TestEtMessageQueue_testMassiveMessaging(void){
etMessage msgArray[MAX];
- printf("sizeof(etMessage):%d\n", sizeof(etMessage));
- printf("size(msgArray):%d\n", sizeof(msgArray));
etMessageQueue queue1;
etMessageQueue_init(&queue1);
@@ -94,7 +92,7 @@ void TestEtMessageQueue_testMassiveMessaging(void){
}
void TestEtMessageQueue_runSuite(void){
- etUnit_openTestSuite("TestetMessageQueue");
+ etUnit_openTestSuite("TestEtMessageQueue");
ADD_TESTCASE(TestEtMessageQueue_testPushPop);
ADD_TESTCASE(TestEtMessageQueue_testMassiveMessaging);
etUnit_closeTestSuite();
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.c
new file mode 100644
index 000000000..3f01d0587
--- /dev/null
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.c
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
+/*
+ * TestEtUnit.c
+ *
+ * Created on: 16.01.2012
+ * Author: tschuetz
+ */
+
+#include "TestEtUnit.h"
+#include "etUnit.h"
+
+void TestEtUnit_Expect(void){
+ EXPECT_TRUE("EXPECT_TRUE", TRUE);
+ EXPECT_FALSE("EXPECT_FALSE", FALSE);
+
+ /* signed integer values */
+ EXPECT_EQUAL_INT8("EXPECT_EQUAL_INT8", -123, -123);
+ EXPECT_EQUAL_INT16("EXPECT_EQUAL_INT16", -12345, -12345);
+ EXPECT_EQUAL_INT32("EXPECT_EQUAL_INT32", -1234567, -1234567);
+
+ /* unsigned integer values */
+ EXPECT_EQUAL_UINT8("EXPECT_EQUAL_INT8", 123, 123);
+ EXPECT_EQUAL_UINT16("EXPECT_EQUAL_INT16", 12345, 12345);
+ EXPECT_EQUAL_UINT32("EXPECT_EQUAL_INT32", 1234567, 1234567);
+
+ /* float values */
+ EXPECT_EQUAL_FLOAT32("EXPECT_EQUAL_FLOAT32", (etFloat32) 123.456, (etFloat32) 123.456, (etFloat32) 0.0001);
+ EXPECT_EQUAL_FLOAT64("EXPECT_EQUAL_FLOAT64", (etFloat64) 123.456, (etFloat64) 123.456, (etFloat64) 0.0001);
+
+ /* Pointers */
+ etUInt16 value;
+ etUInt16* valuePtr = &value;
+
+ EXPECT_EQUAL_PTR("EXPECT_EQUAL_PTR", &value, valuePtr) \
+
+}
+
+
+void TestEtUnit_Expect_Order(void){
+ etInt16 list[] = {1,2,3,4};
+ EXPECT_ORDER_START(list, 4);
+ EXPECT_ORDER("id=1", 1);
+ EXPECT_ORDER("id=2", 2);
+ EXPECT_ORDER("id=3", 3);
+ EXPECT_ORDER_END("id=4", 4);
+}
+
+void TestEtUnit_runSuite(void){
+ etUnit_openTestSuite("TestEtUnit");
+ ADD_TESTCASE(TestEtUnit_Expect_Order);
+ ADD_TESTCASE(TestEtUnit_Expect);
+ etUnit_closeTestSuite();
+}
+
+
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.h
new file mode 100644
index 000000000..e591d27ef
--- /dev/null
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtUnit.h
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Thomas Schuetz (initial contribution)
+ *
+ *******************************************************************************/
+
+
+/*
+ * TestEtUnit.h
+ *
+ * Created on: 16.01.2012
+ * Author: tschuetz
+ */
+
+#ifndef _TESTETUNIT_H_
+#define _TESTETUNIT_H_
+
+void TestEtUnit_runSuite(void);
+
+#endif /* _TESTETUNIT_H_ */
diff --git a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCGenerator.xml b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCGenerator.xml
new file mode 100644
index 000000000..160ccd2bf
--- /dev/null
+++ b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCGenerator.xml
@@ -0,0 +1,6 @@
+<testsuites name="TestCGenerator" tests="0" failures="0" errors="0" time="0">
+ <testsuite name="TestDataClass" tests="0" failures="0" errors="0" time="0">
+ <testcase name="TestDataClass_Operations" time="0"/>
+ <testcase name="TestDataClass_testDataClassDeepCopy" time="0"/>
+ </testsuite>
+</testsuites>
diff --git a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCRuntime.xml
index 0a2578004..a5a4ad3d9 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml
+++ b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestCRuntime.xml
@@ -1,12 +1,8 @@
-<testsuites name="TestMessageService" tests="0" failures="0" errors="0" time="0">
- <testsuite name="TestDataClass" tests="0" failures="0" errors="0" time="0">
- <testcase name="TestDataClass_Operations" time="0"/>
- <testcase name="TestDataClass_testDataClassDeepCopy" time="0"/>
- </testsuite>
+<testsuites name="TestCRuntime" tests="0" failures="0" errors="0" time="0">
<testsuite name="TestMessage" tests="0" failures="0" errors="0" time="0">
<testcase name="TestEtMessage_testBasicMessage" time="0"/>
</testsuite>
- <testsuite name="TestetMessageQueue" tests="0" failures="0" errors="0" time="0">
+ <testsuite name="TestEtMessageQueue" tests="0" failures="0" errors="0" time="0">
<testcase name="TestEtMessageQueue_testPushPop" time="0"/>
<testcase name="TestEtMessageQueue_testMassiveMessaging" time="0"/>
</testsuite>
@@ -15,4 +11,8 @@
<testcase name="TestEtMessageService_GetPushPopReturn" time="0"/>
<testcase name="TestEtMessageService_GetReturn" time="0"/>
</testsuite>
+ <testsuite name="TestEtUnit" tests="0" failures="0" errors="0" time="0">
+ <testcase name="TestEtUnit_Expect_Order" time="0"/>
+ <testcase name="TestEtUnit_Expect" time="0"/>
+ </testsuite>
</testsuites>
diff --git a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestEtUnitSpecial.xml b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestEtUnitSpecial.xml
new file mode 100644
index 000000000..f319d0648
--- /dev/null
+++ b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestEtUnitSpecial.xml
@@ -0,0 +1,5 @@
+<testsuites name="TestEtUnitSpecial" tests="0" failures="0" errors="0" time="0">
+ <testsuite name="etUnit" tests="0" failures="0" errors="0" time="0">
+ <testcase name="openAll and closeAll" time="0"/>
+ </testsuite>
+</testsuites>

Back to the top