Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2012-01-14 04:07:38 -0500
committerThomas Schuetz2012-01-14 04:07:38 -0500
commitd0af1f77c1bda1530b1fba283c420e6267035ca4 (patch)
tree58fdfb3c197c10215fe73b8ec2239b65da384707 /examples/org.eclipse.etrice.generator.c.reference
parent1d5477d83b321341015ae4aaebe834e71445b4bf (diff)
downloadorg.eclipse.etrice-d0af1f77c1bda1530b1fba283c420e6267035ca4.tar.gz
org.eclipse.etrice-d0af1f77c1bda1530b1fba283c420e6267035ca4.tar.xz
org.eclipse.etrice-d0af1f77c1bda1530b1fba283c420e6267035ca4.zip
[generator.c.reference] added Testcase for Operations in generated DataClasses
Diffstat (limited to 'examples/org.eclipse.etrice.generator.c.reference')
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/generator/TestDataClass.c21
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/runtime/TestEtMessageQueue.c6
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml3
3 files changed, 23 insertions, 7 deletions
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 066eb97e6..75e435a4d 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
@@ -12,6 +12,23 @@
#include "../../../src-gen/cGenRef/DataClass1.h"
+void TestDataClass_Operations(void){
+ RUnit_openTestCase("Operations");
+
+ DataClass1 d;
+ d.Attr1 = 123;
+ d.ComplexAttr.Attr1 = 456;
+ d.ComplexAttr.Attr2 = (float32)789.123;
+ d.ComplexAttr.Attr3 = 789;
+ d.Attr3 = (float32)321.123;
+
+ EXPECT_EQUAL_INT32("Operation DataClass1_MultiplyWithAttr1", 246, DataClass1_MultiplyWithAttr1(&d, 2));
+ EXPECT_EQUAL_FLOAT32("Operation DataClass1_MultiplyWithAttr3", (float32)642.246, DataClass1_MultiplyWithAttr3(&d, 2), (float32)0.0001);
+
+ RUnit_closeTestCase();
+}
+
+
void TestDataClass_testDataClassDeepCopy(void){
RUnit_openTestCase("testDataClassDeepCopy");
@@ -31,15 +48,13 @@ void TestDataClass_testDataClassDeepCopy(void){
EXPECT_EQUAL_INT32("ComplexAttr.Attr3", 789, e.ComplexAttr.Attr3);
EXPECT_EQUAL_FLOAT32("Attr3", (float32)321.123, e.Attr3, (float32)0.0001);
- EXPECT_EQUAL_INT32("Operation DataClass1_MultiplyWithAttr1", 246, DataClass1_MultiplyWithAttr1(&d, 2));
- EXPECT_EQUAL_FLOAT32("Operation DataClass1_MultiplyWithAttr3", (float32)642.246, DataClass1_MultiplyWithAttr3(&d, 2), (float32)0.0001);
RUnit_closeTestCase();
}
void TestDataClass_runSuite(void){
RUnit_openTestSuite("TestDataClass");
+ TestDataClass_Operations();
TestDataClass_testDataClassDeepCopy();
RUnit_closeTestSuite();
-
}
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 6b03602df..1708a4c85 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
@@ -27,12 +27,12 @@ void TestEtMessageQueue_testPushPop(void){
RMessageQueue_push(&queue1, &msg2);
EXPECT_EQUAL_INT16("RMessageQueue.size before", 2,queue1.size);
- EXPECT_EQUAL_INT16("RMessageQueue.highWaterMark before", 2,queue1.highWaterMark);
+ EXPECT_EQUAL_INT16("RMessageQueue.highWaterMark before", 2, queue1.highWaterMark);
RMessage* rcvMsg1 = RMessageQueue_pop(&queue1);
RMessage* rcvMsg2 = RMessageQueue_pop(&queue1);
- EXPECT_EQUAL_INT16("RMessageQueue.size after", 0,queue1.size);
+ EXPECT_EQUAL_INT16("RMessageQueue.size after", 0,(int32)queue1.size);
EXPECT_EQUAL_INT16("RMessageQueue.highWaterMark after", 2,queue1.highWaterMark);
EXPECT_EQUAL_INT16("rcvMsg1->address", 123, rcvMsg1->address);
@@ -64,7 +64,7 @@ void TestEtMessageQueue_testMassiveMessaging(void){
RMessageQueue queue1;
RMessageQueue_init(&queue1);
- int32 i;
+ int16 i;
for(i=0; i<MAX; i++){
//RMessage_init(&msgArray[i]);
msgArray[i].address = i;
diff --git a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml
index 36d6edbba..0d4b81369 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml
+++ b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml
@@ -1,5 +1,6 @@
<testsuites name="TestMessageService" tests="0" failures="0" errors="0" time="0">
<testsuite name="TestDataClass" tests="0" failures="0" errors="0" time="0">
+ <testcase name="Operations" time="0"/>
<testcase name="testDataClassDeepCopy" time="0"/>
</testsuite>
<testsuite name="TestMessage" tests="0" failures="0" errors="0" time="0">
@@ -7,7 +8,7 @@
</testsuite>
<testsuite name="TestRMessageQueue" tests="0" failures="0" errors="0" time="0">
<testcase name="testPushPop" time="0"/>
- <testcase name="MassiveMessaging" time="0"/>
+ <testcase name="MassiveMessaging" time="1"/>
</testsuite>
<testsuite name="TestRMessageService" tests="0" failures="0" errors="0" time="0">
<testcase name="testRMessageService_init" time="0"/>

Back to the top