Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2012-01-11 09:19:51 -0500
committerThomas Schuetz2012-01-11 09:19:51 -0500
commit00023b054862d63b1cfe4e6d2ef2e3c7cac34fde (patch)
treec8a357d20cb2389583b7be99185c6407f3b414dd /examples/org.eclipse.etrice.generator.c.reference
parent3733c919d53082bd0b66ff0dab8694e84e6252db (diff)
downloadorg.eclipse.etrice-00023b054862d63b1cfe4e6d2ef2e3c7cac34fde.tar.gz
org.eclipse.etrice-00023b054862d63b1cfe4e6d2ef2e3c7cac34fde.tar.xz
org.eclipse.etrice-00023b054862d63b1cfe4e6d2ef2e3c7cac34fde.zip
[runtime.c] moved runtime files from generator.c.reference to runtime.c
Diffstat (limited to 'examples/org.eclipse.etrice.generator.c.reference')
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/.cproject22
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/SSRunner.c12
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessage.c21
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessage.h26
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageQueue.c79
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageQueue.h45
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageService.c60
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageService.h44
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.c277
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.h53
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/datatypes.h65
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessage.c (renamed from examples/org.eclipse.etrice.generator.c.reference/src/test/TestMessage.c)8
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessage.h (renamed from examples/org.eclipse.etrice.generator.c.reference/src/test/TestMessage.h)8
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageQueue.c (renamed from examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageQueue.c)12
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageQueue.h (renamed from examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageQueue.h)8
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageService.c (renamed from examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageService.c)16
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageService.h (renamed from examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageService.h)8
17 files changed, 52 insertions, 712 deletions
diff --git a/examples/org.eclipse.etrice.generator.c.reference/.cproject b/examples/org.eclipse.etrice.generator.c.reference/.cproject
index 8e525ab41..aea2b3be9 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/.cproject
+++ b/examples/org.eclipse.etrice.generator.c.reference/.cproject
@@ -32,13 +32,17 @@
<option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.836528711" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.1206340557" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
<option id="gnu.c.compiler.option.include.paths.937550345" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/runtime}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/src}&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.215126527" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.2141539090" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug">
- <option id="gnu.c.link.option.libs.1886054812" name="Libraries (-l)" superClass="gnu.c.link.option.libs"/>
- <option id="gnu.c.link.option.paths.1410926104" name="Library search path (-L)" superClass="gnu.c.link.option.paths"/>
+ <option id="gnu.c.link.option.libs.1886054812" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="org.eclipse.etrice.runtime.c"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1410926104" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/Debug}&quot;"/>
+ </option>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1941302758" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
@@ -88,12 +92,18 @@
<tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.1378403430" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release">
<option defaultValue="gnu.c.optimization.level.most" id="gnu.c.compiler.mingw.exe.release.option.optimization.level.554911279" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.release.option.optimization.level" valueType="enumerated"/>
<option id="gnu.c.compiler.mingw.exe.release.option.debugging.level.331396171" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.release.option.debugging.level" value="gnu.c.debugging.level.none" valueType="enumerated"/>
- <option id="gnu.c.compiler.option.include.paths.1226733508" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths"/>
+ <option id="gnu.c.compiler.option.include.paths.1226733508" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/src}&quot;"/>
+ </option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.156681579" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release.1192709765" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.release">
- <option id="gnu.c.link.option.libs.2121552378" name="Libraries (-l)" superClass="gnu.c.link.option.libs"/>
- <option id="gnu.c.link.option.paths.1610581119" name="Library search path (-L)" superClass="gnu.c.link.option.paths"/>
+ <option id="gnu.c.link.option.libs.2121552378" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
+ <listOptionValue builtIn="false" value="org.eclipse.etrice.runtime.c"/>
+ </option>
+ <option id="gnu.c.link.option.paths.1610581119" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/Release}&quot;"/>
+ </option>
<inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1107454825" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/SSRunner.c b/examples/org.eclipse.etrice.generator.c.reference/src/SSRunner.c
index bc6c96be3..9aa04ff58 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/SSRunner.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/SSRunner.c
@@ -14,9 +14,9 @@
#include "../src-gen/cGenRef/DataClass1.h"
#include "RUnit.h"
#include "RMessage.h"
-#include "test/TestMessage.h"
-#include "test/TestRMessageQueue.h"
-#include "test/TestRMessageService.h"
+#include "test/TestEtMessage.h"
+#include "test/TestEtMessageQueue.h"
+#include "test/TestEtMessageService.h"
@@ -58,9 +58,9 @@ void runTestCases(void){
RUnit_open("tmp/testlog","TestMessageService");
testDataClassDeepCopy();
- TestMessage_runSuite();
- TestMessageQueue_runSuite();
- TestRMessageService_runSuite();
+ TestEtMessage_runSuite();
+ TestEtMessageQueue_runSuite();
+ TestEtMessageService_runSuite();
RUnit_close();
}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessage.c b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessage.c
deleted file mode 100644
index 9e67a84c2..000000000
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessage.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * 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)
- *
- *******************************************************************************/
-
-#include "RMessage.h"
-
-#include <stddef.h>
-
-void RMessage_init(RMessage* self){
- self->next = NULL;
- self->address = 0;
- self->evtID = 0;
-}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessage.h b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessage.h
deleted file mode 100644
index dd6927662..000000000
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessage.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * 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)
- *
- *******************************************************************************/
-
-#ifndef RMESSAGE_H_
-#define RMESSAGE_H_
-
-#include "datatypes.h"
-
-typedef struct RMessage{
- struct RMessage* next;
- int16 address;
- int16 evtID;
-} RMessage;
-
-void RMessage_init(RMessage* self);
-
-#endif /* RMESSAGE_H_ */
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageQueue.c b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageQueue.c
deleted file mode 100644
index 0c28cdec9..000000000
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageQueue.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * 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)
- *
- *******************************************************************************/
-
-#include "RMessageQueue.h"
-
-void RMessageQueue_init(RMessageQueue* self){
- self->first = NULL;
- self->last = NULL;
- self->highWaterMark = 0;
- self->size = 0;
-}
-
-
-void RMessageQueue_push(RMessageQueue* self, RMessage* msg){
- // TODO: optimize queue for concurrent push / pop
- if (self->first == NULL) {
- /*no message in queue*/
- self->first = self->last = msg;
- }
- else {
- /*at least one message in queue*/
- self->last->next = msg;
- self->last = msg;
- }
- msg->next = NULL; /*TODO: optimization: this line could be removed if we assume that all messages are initialized*/
-
- if (++self->size > self->highWaterMark)
- self->highWaterMark++;
-}
-
-RMessage* RMessageQueue_pop(RMessageQueue* self){
- RMessage* pop_msg = self->first;
- if(self->first == NULL){
- /*no message in queue*/
- return NULL;
- }
- if (self->first->next==NULL){
- /*only one message in queue*/
- self->first = self->last = NULL;
- }
- else {
- /*more than one message in queue -> set first to nex message*/
- self->first = self->first->next;
- }
-
- pop_msg->next=NULL;
- self->size--;
-
- return pop_msg;
-}
-
-int16 RMessageQueue_getSize(RMessageQueue* self) {
- return self->size;
-}
-
-RMessage* RMessageQueue_getFirst(RMessageQueue* self){
- return self->first;
-}
-
-RMessage* RMessageQueue_getLast(RMessageQueue* self){
- return self->last;
-}
-
-boool RMessageQueue_isNotEmpty(RMessageQueue* self){
- return self->last != NULL;
-}
-
-int16 RMessageQueue_getHightWaterMark(RMessageQueue* self) {
- return self->highWaterMark;
-}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageQueue.h b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageQueue.h
deleted file mode 100644
index b2326eec8..000000000
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageQueue.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * 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)
- *
- *******************************************************************************/
-
-#ifndef _RMESSAGEQUEUE_H_
-#define _RMESSAGEQUEUE_H_
-
-#include "RMessage.h"
-#include <stddef.h>
-
-typedef struct RMessageQueue {
- RMessage* first;
- RMessage* last;
- int16 highWaterMark;
- int16 size;
-
-} RMessageQueue;
-
-void RMessageQueue_init(RMessageQueue* self);
-
-void RMessageQueue_push(RMessageQueue* self, RMessage* msg);
-
-RMessage* RMessageQueue_pop(RMessageQueue* self);
-
-int16 RMessageQueue_getSize(RMessageQueue* self);
-
-RMessage* RMessageQueue_getFirst(RMessageQueue* self);
-
-RMessage* RMessageQueue_getLast(RMessageQueue* self);
-
-boool RMessageQueue_isNotEmpty(RMessageQueue* self);
-
-int16 RMessageQueue_getHightWaterMark(RMessageQueue* self);
-
-
-
-#endif /* _RMESSAGEQUEUE_H_ */
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageService.c b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageService.c
deleted file mode 100644
index 2fe28406c..000000000
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageService.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * 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)
- *
- *******************************************************************************/
-
-
-#include "RMessageService.h"
-
-void RMessageService_init(RMessageService* self, uint8* buffer, uint16 maxBlocks, uint16 blockSize){
- self->messageBuffer.buffer = buffer;
- self->messageBuffer.maxBlocks = maxBlocks;
- self->messageBuffer.blockSize = blockSize;
- RMessageQueue_init(&self->messagePool);
- RMessageQueue_init(&self->messageQueue);
-
- RMessageService_initMessagePool(self);
-}
-
-/*
- * initialize message pool with block buffer
- * all blocks are added to pool
- */
-void RMessageService_initMessagePool(RMessageService* self){
- int i;
-
- for (i=0; i<self->messageBuffer.maxBlocks; i++){
- RMessage* block = (RMessage*) &self->messageBuffer.buffer[i*self->messageBuffer.blockSize];
- RMessageQueue_push(&self->messagePool, block);
- }
-}
-
-void RMessageService_pushMessage(RMessageService* self, RMessage* msg){
- RMessageQueue_push(&self->messageQueue, msg);
-
-}
-
-RMessage* RMessageService_popMessage(RMessageService* self){
- return RMessageQueue_pop(&self->messageQueue);
-}
-
-
-RMessage* RMessageService_getMessageBuffer(RMessageService* self, int16 size){
- if (size<=self->messageBuffer.blockSize){
- if (self->messagePool.size>0){
- return RMessageQueue_pop(&self->messagePool);
- }
- }
- return NULL;
-}
-
-void RMessageService_returnMessageBuffer(RMessageService* self, RMessage* buffer){
- RMessageQueue_push(&self->messagePool, buffer);
-}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageService.h b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageService.h
deleted file mode 100644
index fae4e33bb..000000000
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RMessageService.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * 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)
- *
- *******************************************************************************/
-
-#ifndef RMESSAGESERVICE_H_
-#define RMESSAGESERVICE_H_
-
-#include <stddef.h>
-#include "datatypes.h"
-#include "RMessageQueue.h"
-
-
-typedef struct RBuffer{
- uint8 *buffer;
- uint16 maxBlocks;
- uint16 blockSize;
-} RBuffer;
-
-typedef struct RMessageService {
- RMessageQueue messageQueue;
- RMessageQueue messagePool;
- RBuffer messageBuffer;
-} RMessageService;
-
-void RMessageService_init(RMessageService* self, uint8* buffer, uint16 maxBlocks, uint16 blockSize);
-
-void RMessageService_initMessagePool(RMessageService* self);
-
-void RMessageService_pushMessage(RMessageService* self, RMessage* msg);
-RMessage* RMessageService_popMessage(RMessageService* self);
-
-
-RMessage* RMessageService_getMessageBuffer(RMessageService* self, int16 size);
-void RMessageService_returnMessageBuffer(RMessageService* self, RMessage* buffer);
-
-#endif /* RMESSAGESERVICE_H_ */
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.c b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.c
deleted file mode 100644
index 2a68f5f8f..000000000
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/*******************************************************************************
- * 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)
- *
- *******************************************************************************/
-
-#include "RUnit.h"
-#include <string.h>
-
-/*** member variables */
-
-/* file handling */
-static FILE* RUnit_reportfile = NULL;
-
-/* names */
-static char* RUnit_TestFileName = NULL;
-static char* RUnit_TestResultPath = NULL;
-
-static char* RUnit_TestSuiteName = NULL;
-static char* RUnit_TestCaseName = NULL;
-
-/* counters */
-static etInt32 RUnit_passCount = 0;
-static etInt32 RUnit_failCount = 0;
-
-static boool etUnit_testcaseSuccess = TRUE;
-
-#define ETUNIT_FAILURE_TEXT_LEN 256
-
-static char etUnit_failureText[ETUNIT_FAILURE_TEXT_LEN];
-
-/* time measuring */
-static clock_t RUnit_startTime = 0;
-static clock_t RUnit_currentTime = 0;
-
-/* */
-
-/* forward declarations of private functions */
-void expect_equal_int(const char* message, etInt32 expected, etInt32 actual);
-void expect_equal_uint(const char* message, etUInt32 expected, etUInt32 actual);
-void expect_equal_float(const char* message, float64 expected, float64 actual, float64 precision);
-void RUnit_writeTestLog(const char *testcase, boool result, const char *resulttext);
-void etUnit_handleExpect(boool result, const char *resulttext);
-
-/* public functions */
-
-void RUnit_open(char* testResultPath, char* testFileName) {
- RUnit_passCount = 0;
- RUnit_failCount = 0;
- strcpy(etUnit_failureText,"");
-
- RUnit_TestFileName = testFileName;
- RUnit_TestResultPath = testResultPath;
-
- printf("************* TEST START (%s) **************\n", RUnit_TestFileName);
-
- char filename[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(filename, "%s/%s.xml", RUnit_TestResultPath, RUnit_TestFileName);
-
- if (RUnit_reportfile == NULL) {
- RUnit_reportfile = fopen(filename, "w+");
- if (RUnit_reportfile != NULL) {
- fprintf(RUnit_reportfile, "<testsuites name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n",
- RUnit_TestFileName);
- } else {
- printf("Unable to open file %s/%s.xml\n", RUnit_TestResultPath, RUnit_TestFileName);
- }
- }
- // prepare time measurement
- RUnit_startTime = clock();
- RUnit_currentTime = clock();
- printf("Start Time: %ld\n", RUnit_startTime);
-
-}
-
-void RUnit_close(void) {
- printf("\n");
- if (RUnit_failCount > 0) {
- printf("************* TEST FAILED *************\n");
- } else {
- printf("************* TEST PASSED *************\n");
- }
- printf("Number of Tests: %ld\n", RUnit_failCount + RUnit_passCount);
- printf("Failed: %ld\n", RUnit_failCount);
- printf("Passed: %ld\n", RUnit_passCount);
- printf("Total Time: %ld\n", clock() - RUnit_startTime);
- printf("End Time: %ld, CLOCKS_PER_SEC: %ld\n", clock(), CLOCKS_PER_SEC);
- printf("***************************************\n");
-
- if (RUnit_reportfile != NULL) {
- fprintf(RUnit_reportfile, "</testsuites>\n");
- fclose(RUnit_reportfile);
- RUnit_reportfile = NULL;
- }
-}
-
-void RUnit_openTestSuite(char* testSuiteName) {
- RUnit_TestSuiteName = testSuiteName;
- if (RUnit_reportfile != NULL) {
- fprintf(RUnit_reportfile, "\t<testsuite name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n",
- RUnit_TestSuiteName);
- }
-}
-
-void RUnit_closeTestSuite(void) {
- if (RUnit_reportfile != NULL) {
- fprintf(RUnit_reportfile, "\t</testsuite>\n");
- }
-}
-
-void RUnit_openTestCase(char* testCaseName) {
- RUnit_TestCaseName = testCaseName;
- etUnit_testcaseSuccess = TRUE;
- strcpy(etUnit_failureText,"");
-}
-
-void RUnit_closeTestCase(void) {
- if (RUnit_reportfile != NULL && RUnit_TestSuiteName != NULL) {
- RUnit_writeTestLog(RUnit_TestCaseName, etUnit_testcaseSuccess, etUnit_failureText);
- }
-}
-
-void EXPECT_TRUE(const char* message, boool condition) {
- if (condition == FALSE) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "%s: *** EXPECT_TRUE == FALSE", message);
- etUnit_handleExpect(FALSE, testresult);
- } else {
- etUnit_handleExpect(TRUE, "");
- }
-}
-
-void EXPECT_FALSE(const char* message, boool condition) {
- if (condition == TRUE) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "%s: EXPECT_FALSE == TRUE", message);
- etUnit_handleExpect(FALSE, testresult);
- } else {
- etUnit_handleExpect(TRUE, "");
- }
-}
-
-void EXPECT_EQUAL_INT8(const char* message, etInt8 expected, etInt8 actual) {
- expect_equal_int(message, (etInt32) expected, (etInt32) actual);
-}
-
-void EXPECT_EQUAL_INT16(const char* message, etInt16 expected, etInt16 actual) {
- expect_equal_int(message, (etInt32) expected, (etInt32) actual);
-}
-
-void EXPECT_EQUAL_INT32(const char* message, etInt32 expected, etInt32 actual) {
- expect_equal_int(message, (etInt32) expected, (etInt32) actual);
-}
-
-void EXPECT_EQUAL_UINT8(const char* message, etUInt8 expected, etUInt8 actual) {
- expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual);
-}
-
-void EXPECT_EQUAL_UINT16(const char* message, etUInt16 expected, etUInt16 actual) {
- expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual);
-}
-
-void EXPECT_EQUAL_UINT32(const char* message, etUInt32 expected, etUInt32 actual) {
- expect_equal_uint(message, (etUInt32) expected, (etUInt32) actual);
-}
-
-
-void EXPECT_EQUAL_FLOAT32(const char* message, float32 expected, float32 actual, float32 precision) {
- expect_equal_float(message, (float64) expected, (float64) actual, (float64) precision);
-}
-
-void EXPECT_EQUAL_FLOAT64(const char* message, float64 expected, float64 actual, float64 precision) {
- expect_equal_float(message, (float64) expected, (float64) actual, (float64) precision);
-}
-
-
-/* private functions */
-
-void expect_equal_int(const char* message, etInt32 expected, etInt32 actual) {
- if (expected != actual) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "%s: expected=%ld, actual=%ld", message, expected, actual);
- etUnit_handleExpect(FALSE, testresult);
- } else {
- etUnit_handleExpect(TRUE, "");
- }
-}
-
-void expect_equal_uint(const char* message, etUInt32 expected, etUInt32 actual) {
- if (expected != actual) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "%s: expected=%lu, actual=%lu", message, expected, actual);
- etUnit_handleExpect(FALSE, testresult);
- } else {
- etUnit_handleExpect(TRUE, "");
- }
-}
-
-
-void expect_equal_float(const char* message, float64 expected, float64 actual, float64 precision) {
- if (expected - actual < -precision || expected - actual > precision) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "%s: expected=%lf, actual=%lf", message, expected, actual);
- etUnit_handleExpect(FALSE, testresult);
- } else {
- etUnit_handleExpect(TRUE, "");
- }
-}
-
-void expect_equal_void_ptr(const char* message, const void* expected, const void* actual) {
- if (expected != actual) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "%s: expected=%ld, actual=%ld", message, (etUInt32) expected, (etUInt32) actual);
- etUnit_handleExpect(FALSE, testresult);
- } else {
- etUnit_handleExpect(TRUE, "");
- }
-}
-
-
-//_________
-
-void etUnit_handleExpect(boool result, const char *resulttext){
- if (result == TRUE) {
- /* nothing to do because no failure */
- }
- else {
- if (etUnit_testcaseSuccess == TRUE){
- /* first failure will be remembered */
- etUnit_testcaseSuccess = FALSE;
- strcpy(etUnit_failureText, resulttext);
- }
- else{
- /* more than one error will be ignored */
- }
- }
-}
-
-void RUnit_buildTestLogXML(char* xml, const char *testcase, boool result, const char *resulttext, clock_t time) {
- if (result == TRUE) {
- sprintf(xml, "\t\t<testcase name=\"%s\" time=\"%ld\"/>\n", testcase, time);
- } else {
- sprintf(
- xml,
- "\t\t<testcase name=\"%s\" classname=\"none\" time=\"%ld\">\n\t\t<failure>%s</failure>\n\t</testcase>\n",
- testcase, time, resulttext);
- }
-}
-
-void RUnit_writeTestLog(const char *testcase, boool result, const char *resulttext) {
- char writeBuffer[ETUNIT_FAILURE_TEXT_LEN];
-
- // counting
- if (result == TRUE) {
- RUnit_passCount++;
- printf("PASS: %s: %s\n", testcase, resulttext);
- } else {
- RUnit_failCount++;
- printf("FAIL: %s: %s\n", testcase, resulttext);
- }
-
- clock_t time = clock() - RUnit_currentTime;
- RUnit_currentTime = clock();
-
- // writing to file
- if (RUnit_reportfile != NULL) {
- RUnit_buildTestLogXML(writeBuffer, testcase, result, resulttext, time);
- fprintf(RUnit_reportfile, writeBuffer);
- }
-}
-
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.h b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.h
deleted file mode 100644
index a3badcc7e..000000000
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * 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)
- *
- *******************************************************************************/
-
-#ifndef _RUNIT_H_
-#define _RUNIT_H_
-
-#include "datatypes.h"
-#include <stdio.h>
-#include <time.h>
-
-
-// open / close
-void RUnit_open(char* testResultPath, char* testFileName);
-void RUnit_close(void);
-void RUnit_openTestSuite(char* testSuiteName);
-void RUnit_closeTestSuite(void);
-void RUnit_openTestCase(char* testCaseName);
-void RUnit_closeTestCase(void);
-
-/* boolean values */
-void EXPECT_TRUE(const char* testcase, etBool condition);
-void EXPECT_FALSE(const char* testcase, etBool condition);
-
-/* signed integer values */
-void EXPECT_EQUAL_INT8(const char* testcase, etInt8 expected, etInt8 actual);
-void EXPECT_EQUAL_INT16(const char* testcase, etInt16 expected, etInt16 actual);
-void EXPECT_EQUAL_INT32(const char* testcase, etInt32 expected, etInt32 actual);
-
-/* unsigned integer values */
-void EXPECT_EQUAL_UINT8(const char* testcase, etUInt8 expected, etUInt8 actual);
-void EXPECT_EQUAL_UINT16(const char* testcase, etUInt16 expected, etUInt16 actual);
-void EXPECT_EQUAL_UINT32(const char* testcase, etUInt32 expected, etUInt32 actual);
-
-/* float values */
-void EXPECT_EQUAL_FLOAT32(const char* testcase, etFloat32 expected, etFloat32 actual, etFloat32 precision);
-void EXPECT_EQUAL_FLOAT64(const char* testcase, etFloat64 expected, etFloat64 actual, etFloat64 precision);
-
-/* Pointers */
-#define EXPECT_EQUAL_PTR(testcase, expected, actual) \
- expect_equal_void_ptr(testcase, (const void*) expected, (const void*) actual);
-
-void expect_equal_void_ptr(const char* testcase, const void* expected, const void* actual);
-
-#endif /* _RUNIT_H_ */
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/datatypes.h b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/datatypes.h
deleted file mode 100644
index 7bcc4826a..000000000
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/datatypes.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * 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)
- *
- *******************************************************************************/
-
-#ifndef _DATATYPES_H_
-#define _DATATYPES_H_
-
-/*
- * typedefs for platform specific datatypes
- *
- * */
-
-/* unsigned integer datatypes */
-typedef unsigned char uint8;
-typedef unsigned short int uint16;
-typedef unsigned long uint32;
-typedef unsigned long long uint64;
-
-/* signed integer datatypes */
-typedef char int8;
-typedef short int int16;
-typedef long int32;
-typedef long long int64;
-
-
-/* float datatypes */
-typedef float float32;
-typedef double float64;
-
-/* boolean datatypes and values */
-typedef char boool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
-#ifndef TRUE
- #define TRUE 1
-#endif
-#ifndef FALSE
- #define FALSE 0
-#endif
-
-/*
- * typedefs for Runtime and Testing
- *
- * */
-
-typedef uint8 etInt8;
-typedef int16 etInt16;
-typedef int32 etInt32;
-
-typedef uint8 etUInt8;
-typedef uint16 etUInt16;
-typedef uint32 etUInt32;
-
-typedef boool etBool;
-
-typedef float32 etFloat32;
-typedef float64 etFloat64;
-
-#endif /* _DATATYPES_H_ */
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestMessage.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessage.c
index 56c2ecd51..a9d7b6aee 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestMessage.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessage.c
@@ -10,7 +10,7 @@
*
*******************************************************************************/
-#include "TestMessage.h"
+#include "TestEtMessage.h"
#include <stddef.h>
#include "RUnit.h"
@@ -18,7 +18,7 @@
-void TestMessage_testBasicMessage(void){
+void TestEtMessage_testBasicMessage(void){
RUnit_openTestCase("TestMessage_testBasicMessage");
RMessage msg1 = {(RMessage*)1234567, 123,456,};
@@ -40,9 +40,9 @@ void TestMessage_testBasicMessage(void){
}
-void TestMessage_runSuite(void){
+void TestEtMessage_runSuite(void){
RUnit_openTestSuite("TestMessage");
- TestMessage_testBasicMessage();
+ TestEtMessage_testBasicMessage();
RUnit_closeTestSuite();
}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestMessage.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessage.h
index 8a898e137..67b45e4e1 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestMessage.h
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessage.h
@@ -10,11 +10,11 @@
*
*******************************************************************************/
-#ifndef TESTMESSAGE_H_
-#define TESTMESSAGE_H_
+#ifndef _TESTMESSAGE_H_
+#define _TESTMESSAGE_H_
-void TestMessage_runSuite(void);
+void TestEtMessage_runSuite(void);
-#endif /* TESTMESSAGE_H_ */
+#endif /* _TESTMESSAGE_H_ */
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageQueue.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageQueue.c
index d50af956d..6b03602df 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageQueue.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageQueue.c
@@ -10,11 +10,11 @@
*
*******************************************************************************/
-#include "TestRMessageQueue.h"
+#include "TestEtMessageQueue.h"
#include "RUnit.h"
#include "RMessageQueue.h"
-void testPushPop(void){
+void TestEtMessageQueue_testPushPop(void){
RUnit_openTestCase("testPushPop");
RMessage msg1 = {NULL, 123, 456};
@@ -54,7 +54,7 @@ void testPushPop(void){
#define MAX 1000
-void testMassiveMessaging(void){
+void TestEtMessageQueue_testMassiveMessaging(void){
RUnit_openTestCase("MassiveMessaging");
RMessage msgArray[MAX];
@@ -97,9 +97,9 @@ void testMassiveMessaging(void){
RUnit_closeTestCase();
}
-void TestMessageQueue_runSuite(void){
+void TestEtMessageQueue_runSuite(void){
RUnit_openTestSuite("TestRMessageQueue");
- testPushPop();
- testMassiveMessaging();
+ TestEtMessageQueue_testPushPop();
+ TestEtMessageQueue_testMassiveMessaging();
RUnit_closeTestSuite();
}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageQueue.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageQueue.h
index 5c3b51eaa..afceea8f8 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageQueue.h
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageQueue.h
@@ -10,9 +10,9 @@
*
*******************************************************************************/
-#ifndef TESTRMESSAGEQUEUE_H_
-#define TESTRMESSAGEQUEUE_H_
+#ifndef _TESTRMESSAGEQUEUE_H_
+#define _TESTRMESSAGEQUEUE_H_
-void TestMessageQueue_runSuite(void);
+void TestEtMessageQueue_runSuite(void);
-#endif /* TESTRMESSAGEQUEUE_H_ */
+#endif /* _TESTRMESSAGEQUEUE_H_ */
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageService.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageService.c
index 4baff7079..ed14defb1 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageService.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageService.c
@@ -10,12 +10,12 @@
*
*******************************************************************************/
-#include "TestRMessageService.h"
+#include "TestEtMessageService.h"
#include "RUnit.h"
#include "RMessageService.h"
-void testRMessageService_init(void){
+void TestEtMessageService_init(void){
RUnit_openTestCase("testRMessageService_init");
RMessageService msgService;
@@ -35,7 +35,7 @@ void testRMessageService_init(void){
RUnit_closeTestCase();
}
-void testRMessageService_GetPushPopReturn(void){
+void TestEtMessageService_GetPushPopReturn(void){
RUnit_openTestCase("testRMessageService_GetPushPopReturn");
RMessageService msgService;
@@ -83,7 +83,7 @@ void testRMessageService_GetPushPopReturn(void){
RUnit_closeTestCase();
}
-void testRMessageService_GetReturn(void){
+void TestEtMessageService_GetReturn(void){
RUnit_openTestCase("testRMessageService_GetReturn");
RMessageService msgService;
@@ -113,10 +113,10 @@ void testRMessageService_GetReturn(void){
RUnit_closeTestCase();
}
-void TestRMessageService_runSuite(void){
+void TestEtMessageService_runSuite(void){
RUnit_openTestSuite("TestRMessageService");
- testRMessageService_init();
- testRMessageService_GetPushPopReturn();
- testRMessageService_GetReturn();
+ TestEtMessageService_init();
+ TestEtMessageService_GetPushPopReturn();
+ TestEtMessageService_GetReturn();
RUnit_closeTestSuite();
}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageService.h b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageService.h
index 981a0484b..287ff8c8b 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageService.h
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessageService.h
@@ -10,12 +10,12 @@
*
*******************************************************************************/
-#ifndef TESTRMESSAGESERVICE_H_
-#define TESTRMESSAGESERVICE_H_
+#ifndef _TESTRMESSAGESERVICE_H_
+#define _TESTRMESSAGESERVICE_H_
#include "RMessageService.h"
-void TestRMessageService_runSuite(void);
+void TestEtMessageService_runSuite(void);
-#endif /* TESTRMESSAGESERVICE_H_ */
+#endif /* _TESTRMESSAGESERVICE_H_ */

Back to the top