diff options
author | Thomas Schuetz | 2013-04-30 10:20:01 +0000 |
---|---|---|
committer | Thomas Schuetz | 2013-04-30 10:20:01 +0000 |
commit | 557eaf3819ee03755134775d16ce1a2951e74222 (patch) | |
tree | 51412ce0cdf159f18346e83a52a46cfc22394c1a /tests/org.eclipse.etrice.runtime.c.tests | |
parent | fe7515af364af304ab279f66225cc9567e157b10 (diff) | |
download | org.eclipse.etrice-557eaf3819ee03755134775d16ce1a2951e74222.tar.gz org.eclipse.etrice-557eaf3819ee03755134775d16ce1a2951e74222.tar.xz org.eclipse.etrice-557eaf3819ee03755134775d16ce1a2951e74222.zip |
[runtime.c.tests] added testcases for etTimeHelpers
Change-Id: I0406acf26920b3cf40c8802128513c1cc540b7db
Diffstat (limited to 'tests/org.eclipse.etrice.runtime.c.tests')
5 files changed, 96 insertions, 5 deletions
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c index 1e6c72af9..4ab86cbb9 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c @@ -29,6 +29,7 @@ #include "TestEtMemory.h" #include "TestEtQueue.h" #include "TestEtTimer.h" +#include "helpers/TestEtTimeHelpers.h" #include "etUnit/etUnit.h" #include "debugging/etMSCLogger.h" @@ -46,6 +47,7 @@ void RunCRuntimeTestcases(void){ // TestEtMessageService_runSuite(); TestEtUnit_runSuite(); TestEtTimer_runSuite(); + TestEtTimeHelpers_runSuite(); etUnit_close(); diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/helpers/TestEtTimeHelpers.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/helpers/TestEtTimeHelpers.c new file mode 100644 index 000000000..1ff442503 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/helpers/TestEtTimeHelpers.c @@ -0,0 +1,65 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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)
+ *
+ *******************************************************************************/
+
+#include "TestEtTimeHelpers.h"
+#include "helpers/etTimeHelpers.h"
+
+#include "etUnit/etUnit.h"
+
+static void TestEtTimeHelpers_convertToMSec (etInt16 id) {
+ etInt32 result;
+ etTime time;
+
+ time.sec = 0;
+ time.nSec = 0;
+ result = etTimeHelpers_convertToMSec(&time);
+ EXPECT_EQUAL_INT32(id, "0 ms", 0, result);
+
+ time.sec = 1;
+ time.nSec = 1000000;
+ result = etTimeHelpers_convertToMSec(&time);
+ EXPECT_EQUAL_INT32(id, "1001 ms", 1001, result);
+
+ time.sec = 1111;
+ time.nSec = 55000000;
+ result = etTimeHelpers_convertToMSec(&time);
+ EXPECT_EQUAL_INT32(id, "111055 ms", 1111055, result);
+
+}
+
+static void TestEtTimeHelpers_convertToEtTime (etInt16 id) {
+ etInt32 ms_time;
+ etTime result;
+
+ ms_time=0;
+ etTimeHelpers_convertToEtTime(&result, ms_time);
+ EXPECT_EQUAL_INT32(id, "0 s", 0, result.sec);
+ EXPECT_EQUAL_INT32(id, "0 ns", 0, result.nSec);
+
+
+ ms_time=1234567;
+ etTimeHelpers_convertToEtTime(&result, ms_time);
+ EXPECT_EQUAL_INT32(id, "1234 s", 1234, result.sec);
+ EXPECT_EQUAL_INT32(id, "567000000 ns", 567000000, result.nSec);
+
+}
+
+
+
+void TestEtTimeHelpers_runSuite(void){
+ etUnit_openTestSuite("TestEtTimeHelpers");
+ ADD_TESTCASE(TestEtTimeHelpers_convertToMSec);
+ ADD_TESTCASE(TestEtTimeHelpers_convertToEtTime);
+ etUnit_closeTestSuite();
+}
+
+
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/helpers/TestEtTimeHelpers.h b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/helpers/TestEtTimeHelpers.h new file mode 100644 index 000000000..899888304 --- /dev/null +++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/helpers/TestEtTimeHelpers.h @@ -0,0 +1,19 @@ +/*******************************************************************************
+ * Copyright (c) 2013 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)
+ *
+ *******************************************************************************/
+
+#ifndef _TESTETTIMEHELPERS_H_
+#define _TESTETTIMEHELPERS_H_
+
+void TestEtTimeHelpers_runSuite(void);
+
+
+#endif /* _TESTETTIMEHELPERS_H_ */
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestCRuntime.etu b/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestCRuntime.etu index 4bdbf94a6..73347e136 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestCRuntime.etu +++ b/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestCRuntime.etu @@ -1,10 +1,10 @@ etUnit report
ts start: TestQueue
tc start 1: TestEtQueue_test
-tc end 1: 0
+tc end 1: 15
ts start: TestMemory
tc start 2: TestEtMemory_testFixedSize
-tc end 2: 15
+tc end 2: 0
tc start 3: TestEtMemory_testFreeList
tc end 3: 0
ts start: TestMessage
@@ -14,7 +14,7 @@ ts start: TestEtMessageQueue tc start 5: TestEtMessageQueue_testPushPop
tc end 5: 0
tc start 6: TestEtMessageQueue_testMassiveMessaging
-tc end 6: 0
+tc end 6: 16
ts start: TestEtUnit
tc start 7: TestEtUnit_Expect_Order
tc end 7: 0
@@ -25,3 +25,8 @@ tc start 9: TestEtTimer_lifecycle tc end 9: 1513
tc start 10: TestEtTimer_multiTimer
tc end 10: 1014
+ts start: TestEtTimeHelpers
+tc start 11: TestEtTimeHelpers_convertToMSec
+tc end 11: 0
+tc start 12: TestEtTimeHelpers_convertToEtTime
+tc end 12: 0
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu b/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu index 78f14cc25..71e585534 100644 --- a/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu +++ b/tests/org.eclipse.etrice.runtime.c.tests/tmp/testlog/TestEtUnitSpecial.etu @@ -1,4 +1,4 @@ etUnit report
ts start: etUnit
-tc start 11: openAll and closeAll
-tc end 11: 0
+tc start 13: openAll and closeAll
+tc end 13: 0
|