Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2012-01-30 15:05:42 +0000
committerThomas Schuetz2012-01-30 15:05:42 +0000
commitd5afc9c0c42138ac147199ae60193899953869cb (patch)
treec27b93e12a6cd508f5486a1a2a78f064663f3469 /tests/org.eclipse.etrice.generator.c.tests/src/test/runtime/TestEtUnit.c
parent17c0786b480e757f538d5e334e6e5c93f6751a4a (diff)
downloadorg.eclipse.etrice-d5afc9c0c42138ac147199ae60193899953869cb.tar.gz
org.eclipse.etrice-d5afc9c0c42138ac147199ae60193899953869cb.tar.xz
org.eclipse.etrice-d5afc9c0c42138ac147199ae60193899953869cb.zip
[generator.c.tests] moved testcases for C-generator to generator.c.tests
Diffstat (limited to 'tests/org.eclipse.etrice.generator.c.tests/src/test/runtime/TestEtUnit.c')
-rw-r--r--tests/org.eclipse.etrice.generator.c.tests/src/test/runtime/TestEtUnit.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/tests/org.eclipse.etrice.generator.c.tests/src/test/runtime/TestEtUnit.c b/tests/org.eclipse.etrice.generator.c.tests/src/test/runtime/TestEtUnit.c
new file mode 100644
index 000000000..3f01d0587
--- /dev/null
+++ b/tests/org.eclipse.etrice.generator.c.tests/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();
+}
+
+

Back to the top