Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2012-01-16 12:42:50 +0000
committerThomas Schuetz2012-01-16 12:42:50 +0000
commit112cbb3dd645b3f91f573290e94d0499da0705c1 (patch)
tree6978fd9bd46e3d36a5fda4bdd0a067c4b1185ab8 /runtime/org.eclipse.etrice.runtime.c/src
parenta1c1528bf5d71ba66eb99045edaf3a9fd9fb78f2 (diff)
downloadorg.eclipse.etrice-112cbb3dd645b3f91f573290e94d0499da0705c1.tar.gz
org.eclipse.etrice-112cbb3dd645b3f91f573290e94d0499da0705c1.tar.xz
org.eclipse.etrice-112cbb3dd645b3f91f573290e94d0499da0705c1.zip
[runtime.c] changed naming convention for runtime to prefix et (for eTrice)
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.h45
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/RMessageService.c60
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/RMessageService.h44
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/etDatatypes.h (renamed from runtime/org.eclipse.etrice.runtime.c/src/datatypes.h)8
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/etMessage.c (renamed from runtime/org.eclipse.etrice.runtime.c/src/RMessage.c)4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/etMessage.h (renamed from runtime/org.eclipse.etrice.runtime.c/src/RMessage.h)20
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.c (renamed from runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.c)20
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.h45
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/etMessageService.c60
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/etMessageService.h44
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/etUnit.c (renamed from runtime/org.eclipse.etrice.runtime.c/src/RUnit.c)128
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/etUnit.h (renamed from runtime/org.eclipse.etrice.runtime.c/src/RUnit.h)24
12 files changed, 251 insertions, 251 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.h
deleted file mode 100644
index b2326eec8..000000000
--- a/runtime/org.eclipse.etrice.runtime.c/src/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/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.c b/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.c
deleted file mode 100644
index 2fe28406c..000000000
--- a/runtime/org.eclipse.etrice.runtime.c/src/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/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.h b/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.h
deleted file mode 100644
index fae4e33bb..000000000
--- a/runtime/org.eclipse.etrice.runtime.c/src/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/runtime/org.eclipse.etrice.runtime.c/src/datatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/etDatatypes.h
index 7bcc4826a..e2622cbdf 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/datatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/etDatatypes.h
@@ -10,8 +10,8 @@
*
*******************************************************************************/
-#ifndef _DATATYPES_H_
-#define _DATATYPES_H_
+#ifndef _ETDATATYPES_H_
+#define _ETDATATYPES_H_
/*
* typedefs for platform specific datatypes
@@ -36,7 +36,7 @@ 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*/
+typedef char boolean; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
#ifndef TRUE
#define TRUE 1
#endif
@@ -57,7 +57,7 @@ typedef uint8 etUInt8;
typedef uint16 etUInt16;
typedef uint32 etUInt32;
-typedef boool etBool;
+typedef boolean etBool;
typedef float32 etFloat32;
typedef float64 etFloat64;
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RMessage.c b/runtime/org.eclipse.etrice.runtime.c/src/etMessage.c
index 9e67a84c2..940dc61c2 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/RMessage.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessage.c
@@ -10,11 +10,11 @@
*
*******************************************************************************/
-#include "RMessage.h"
+#include "etMessage.h"
#include <stddef.h>
-void RMessage_init(RMessage* self){
+void etMessage_init(etMessage* self){
self->next = NULL;
self->address = 0;
self->evtID = 0;
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RMessage.h b/runtime/org.eclipse.etrice.runtime.c/src/etMessage.h
index dd6927662..7bba6a1f3 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/RMessage.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessage.h
@@ -10,17 +10,17 @@
*
*******************************************************************************/
-#ifndef RMESSAGE_H_
-#define RMESSAGE_H_
+#ifndef _ETMESSAGE_H_
+#define _ETMESSAGE_H_
-#include "datatypes.h"
+#include "etDatatypes.h"
-typedef struct RMessage{
- struct RMessage* next;
- int16 address;
- int16 evtID;
-} RMessage;
+typedef struct etMessage{
+ struct etMessage* next;
+ etInt16 address;
+ etInt16 evtID;
+} etMessage;
-void RMessage_init(RMessage* self);
+void etMessage_init(etMessage* self);
-#endif /* RMESSAGE_H_ */
+#endif /* _ETMESSAGE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.c b/runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.c
index 0c28cdec9..2575d1a1d 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.c
@@ -10,9 +10,9 @@
*
*******************************************************************************/
-#include "RMessageQueue.h"
+#include "etMessageQueue.h"
-void RMessageQueue_init(RMessageQueue* self){
+void etMessageQueue_init(etMessageQueue* self){
self->first = NULL;
self->last = NULL;
self->highWaterMark = 0;
@@ -20,7 +20,7 @@ void RMessageQueue_init(RMessageQueue* self){
}
-void RMessageQueue_push(RMessageQueue* self, RMessage* msg){
+void etMessageQueue_push(etMessageQueue* self, etMessage* msg){
// TODO: optimize queue for concurrent push / pop
if (self->first == NULL) {
/*no message in queue*/
@@ -37,8 +37,8 @@ void RMessageQueue_push(RMessageQueue* self, RMessage* msg){
self->highWaterMark++;
}
-RMessage* RMessageQueue_pop(RMessageQueue* self){
- RMessage* pop_msg = self->first;
+etMessage* etMessageQueue_pop(etMessageQueue* self){
+ etMessage* pop_msg = self->first;
if(self->first == NULL){
/*no message in queue*/
return NULL;
@@ -58,22 +58,22 @@ RMessage* RMessageQueue_pop(RMessageQueue* self){
return pop_msg;
}
-int16 RMessageQueue_getSize(RMessageQueue* self) {
+etInt16 etMessageQueue_getSize(etMessageQueue* self) {
return self->size;
}
-RMessage* RMessageQueue_getFirst(RMessageQueue* self){
+etMessage* etMessageQueue_getFirst(etMessageQueue* self){
return self->first;
}
-RMessage* RMessageQueue_getLast(RMessageQueue* self){
+etMessage* etMessageQueue_getLast(etMessageQueue* self){
return self->last;
}
-boool RMessageQueue_isNotEmpty(RMessageQueue* self){
+etBool etMessageQueue_isNotEmpty(etMessageQueue* self){
return self->last != NULL;
}
-int16 RMessageQueue_getHightWaterMark(RMessageQueue* self) {
+etInt16 etMessageQueue_getHightWaterMark(etMessageQueue* self) {
return self->highWaterMark;
}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.h
new file mode 100644
index 000000000..7fa27ff8a
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessageQueue.h
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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 _ETMESSAGEQUEUE_H_
+#define _ETMESSAGEQUEUE_H_
+
+#include "etMessage.h"
+#include <stddef.h>
+
+typedef struct etMessageQueue {
+ etMessage* first;
+ etMessage* last;
+ etInt16 highWaterMark;
+ etInt16 size;
+
+} etMessageQueue;
+
+void etMessageQueue_init(etMessageQueue* self);
+
+void etMessageQueue_push(etMessageQueue* self, etMessage* msg);
+
+etMessage* etMessageQueue_pop(etMessageQueue* self);
+
+etMessage* etMessageQueue_getFirst(etMessageQueue* self);
+
+etMessage* etMessageQueue_getLast(etMessageQueue* self);
+
+etBool etMessageQueue_isNotEmpty(etMessageQueue* self);
+
+etInt16 etMessageQueue_getHightWaterMark(etMessageQueue* self);
+
+etInt16 etMessageQueue_getSize(etMessageQueue* self);
+
+
+
+#endif /* _RMESSAGEQUEUE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.c b/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.c
new file mode 100644
index 000000000..dcf04e0ba
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.c
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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 "etMessageService.h"
+
+void etMessageService_init(etMessageService* self, etUInt8* buffer, etUInt16 maxBlocks, etUInt16 blockSize){
+ self->messageBuffer.buffer = buffer;
+ self->messageBuffer.maxBlocks = maxBlocks;
+ self->messageBuffer.blockSize = blockSize;
+ etMessageQueue_init(&self->messagePool);
+ etMessageQueue_init(&self->messageQueue);
+
+ etMessageService_initMessagePool(self);
+}
+
+/*
+ * initialize message pool with block buffer
+ * all blocks are added to pool
+ */
+void etMessageService_initMessagePool(etMessageService* self){
+ etInt16 i;
+
+ for (i=0; i<self->messageBuffer.maxBlocks; i++){
+ etMessage* block = (etMessage*) &self->messageBuffer.buffer[i*self->messageBuffer.blockSize];
+ etMessageQueue_push(&self->messagePool, block);
+ }
+}
+
+void etMessageService_pushMessage(etMessageService* self, etMessage* msg){
+ etMessageQueue_push(&self->messageQueue, msg);
+
+}
+
+etMessage* etMessageService_popMessage(etMessageService* self){
+ return etMessageQueue_pop(&self->messageQueue);
+}
+
+
+etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 size){
+ if (size<=self->messageBuffer.blockSize){
+ if (self->messagePool.size>0){
+ return etMessageQueue_pop(&self->messagePool);
+ }
+ }
+ return NULL;
+}
+
+void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer){
+ etMessageQueue_push(&self->messagePool, buffer);
+}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.h b/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.h
new file mode 100644
index 000000000..12f02885b
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/etMessageService.h
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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 _ETMESSAGESERVICE_H_
+#define _ETMESSAGESERVICE_H_
+
+#include <stddef.h>
+#include "etDatatypes.h"
+#include "etMessageQueue.h"
+
+
+typedef struct RBuffer{
+ etUInt8 *buffer;
+ etUInt16 maxBlocks;
+ etUInt16 blockSize;
+} RBuffer;
+
+typedef struct etMessageService {
+ etMessageQueue messageQueue;
+ etMessageQueue messagePool;
+ RBuffer messageBuffer;
+} etMessageService;
+
+void etMessageService_init(etMessageService* self, etUInt8* buffer, etUInt16 maxBlocks, etUInt16 blockSize);
+
+void etMessageService_initMessagePool(etMessageService* self);
+
+void etMessageService_pushMessage(etMessageService* self, etMessage* msg);
+etMessage* etMessageService_popMessage(etMessageService* self);
+
+
+etMessage* etMessageService_getMessageBuffer(etMessageService* self, etUInt16 size);
+void etMessageService_returnMessageBuffer(etMessageService* self, etMessage* buffer);
+
+#endif /* RMESSAGESERVICE_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RUnit.c b/runtime/org.eclipse.etrice.runtime.c/src/etUnit.c
index 2a68f5f8f..3fc5e70b6 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/RUnit.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/etUnit.c
@@ -10,34 +10,34 @@
*
*******************************************************************************/
-#include "RUnit.h"
+#include "etUnit.h"
#include <string.h>
/*** member variables */
/* file handling */
-static FILE* RUnit_reportfile = NULL;
+static FILE* etUnit_reportfile = NULL;
/* names */
-static char* RUnit_TestFileName = NULL;
-static char* RUnit_TestResultPath = NULL;
+static char* etUnit_TestFileName = NULL;
+static char* etUnit_TestResultPath = NULL;
-static char* RUnit_TestSuiteName = NULL;
-static char* RUnit_TestCaseName = NULL;
+static char* etUnit_TestSuiteName = NULL;
+static char* etUnit_TestCaseName = NULL;
/* counters */
-static etInt32 RUnit_passCount = 0;
-static etInt32 RUnit_failCount = 0;
+static etInt32 etUnit_passCount = 0;
+static etInt32 etUnit_failCount = 0;
-static boool etUnit_testcaseSuccess = TRUE;
+static etBool 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;
+static clock_t etUnit_startTime = 0;
+static clock_t etUnit_currentTime = 0;
/* */
@@ -45,88 +45,88 @@ static clock_t RUnit_currentTime = 0;
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);
+void etUnit_writeTestLog(const char *testcase, etBool result, const char *resulttext);
+void etUnit_handleExpect(etBool result, const char *resulttext);
/* public functions */
-void RUnit_open(char* testResultPath, char* testFileName) {
- RUnit_passCount = 0;
- RUnit_failCount = 0;
+void etUnit_open(char* testResultPath, char* testFileName) {
+ etUnit_passCount = 0;
+ etUnit_failCount = 0;
strcpy(etUnit_failureText,"");
- RUnit_TestFileName = testFileName;
- RUnit_TestResultPath = testResultPath;
+ etUnit_TestFileName = testFileName;
+ etUnit_TestResultPath = testResultPath;
- printf("************* TEST START (%s) **************\n", RUnit_TestFileName);
+ printf("************* TEST START (%s) **************\n", etUnit_TestFileName);
char filename[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(filename, "%s/%s.xml", RUnit_TestResultPath, RUnit_TestFileName);
+ sprintf(filename, "%s/%s.xml", etUnit_TestResultPath, etUnit_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);
+ if (etUnit_reportfile == NULL) {
+ etUnit_reportfile = fopen(filename, "w+");
+ if (etUnit_reportfile != NULL) {
+ fprintf(etUnit_reportfile, "<testsuites name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n",
+ etUnit_TestFileName);
} else {
- printf("Unable to open file %s/%s.xml\n", RUnit_TestResultPath, RUnit_TestFileName);
+ printf("Unable to open file %s/%s.xml\n", etUnit_TestResultPath, etUnit_TestFileName);
}
}
// prepare time measurement
- RUnit_startTime = clock();
- RUnit_currentTime = clock();
- printf("Start Time: %ld\n", RUnit_startTime);
+ etUnit_startTime = clock();
+ etUnit_currentTime = clock();
+ printf("Start Time: %ld\n", etUnit_startTime);
}
-void RUnit_close(void) {
+void etUnit_close(void) {
printf("\n");
- if (RUnit_failCount > 0) {
+ if (etUnit_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("Number of Tests: %ld\n", etUnit_failCount + etUnit_passCount);
+ printf("Failed: %ld\n", etUnit_failCount);
+ printf("Passed: %ld\n", etUnit_passCount);
+ printf("Total Time: %ld\n", clock() - etUnit_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;
+ if (etUnit_reportfile != NULL) {
+ fprintf(etUnit_reportfile, "</testsuites>\n");
+ fclose(etUnit_reportfile);
+ etUnit_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 etUnit_openTestSuite(char* testSuiteName) {
+ etUnit_TestSuiteName = testSuiteName;
+ if (etUnit_reportfile != NULL) {
+ fprintf(etUnit_reportfile, "\t<testsuite name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n",
+ etUnit_TestSuiteName);
}
}
-void RUnit_closeTestSuite(void) {
- if (RUnit_reportfile != NULL) {
- fprintf(RUnit_reportfile, "\t</testsuite>\n");
+void etUnit_closeTestSuite(void) {
+ if (etUnit_reportfile != NULL) {
+ fprintf(etUnit_reportfile, "\t</testsuite>\n");
}
}
-void RUnit_openTestCase(char* testCaseName) {
- RUnit_TestCaseName = testCaseName;
+void etUnit_openTestCase(char* testCaseName) {
+ etUnit_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 etUnit_closeTestCase(void) {
+ if (etUnit_reportfile != NULL && etUnit_TestSuiteName != NULL) {
+ etUnit_writeTestLog(etUnit_TestCaseName, etUnit_testcaseSuccess, etUnit_failureText);
}
}
-void EXPECT_TRUE(const char* message, boool condition) {
+void EXPECT_TRUE(const char* message, etBool condition) {
if (condition == FALSE) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
sprintf(testresult, "%s: *** EXPECT_TRUE == FALSE", message);
@@ -136,7 +136,7 @@ void EXPECT_TRUE(const char* message, boool condition) {
}
}
-void EXPECT_FALSE(const char* message, boool condition) {
+void EXPECT_FALSE(const char* message, etBool condition) {
if (condition == TRUE) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
sprintf(testresult, "%s: EXPECT_FALSE == TRUE", message);
@@ -226,7 +226,7 @@ void expect_equal_void_ptr(const char* message, const void* expected, const void
//_________
-void etUnit_handleExpect(boool result, const char *resulttext){
+void etUnit_handleExpect(etBool result, const char *resulttext){
if (result == TRUE) {
/* nothing to do because no failure */
}
@@ -242,7 +242,7 @@ void etUnit_handleExpect(boool result, const char *resulttext){
}
}
-void RUnit_buildTestLogXML(char* xml, const char *testcase, boool result, const char *resulttext, clock_t time) {
+void etUnit_buildTestLogXML(char* xml, const char *testcase, etBool result, const char *resulttext, clock_t time) {
if (result == TRUE) {
sprintf(xml, "\t\t<testcase name=\"%s\" time=\"%ld\"/>\n", testcase, time);
} else {
@@ -253,25 +253,25 @@ void RUnit_buildTestLogXML(char* xml, const char *testcase, boool result, const
}
}
-void RUnit_writeTestLog(const char *testcase, boool result, const char *resulttext) {
+void etUnit_writeTestLog(const char *testcase, etBool result, const char *resulttext) {
char writeBuffer[ETUNIT_FAILURE_TEXT_LEN];
// counting
if (result == TRUE) {
- RUnit_passCount++;
+ etUnit_passCount++;
printf("PASS: %s: %s\n", testcase, resulttext);
} else {
- RUnit_failCount++;
+ etUnit_failCount++;
printf("FAIL: %s: %s\n", testcase, resulttext);
}
- clock_t time = clock() - RUnit_currentTime;
- RUnit_currentTime = clock();
+ clock_t time = clock() - etUnit_currentTime;
+ etUnit_currentTime = clock();
// writing to file
- if (RUnit_reportfile != NULL) {
- RUnit_buildTestLogXML(writeBuffer, testcase, result, resulttext, time);
- fprintf(RUnit_reportfile, writeBuffer);
+ if (etUnit_reportfile != NULL) {
+ etUnit_buildTestLogXML(writeBuffer, testcase, result, resulttext, time);
+ fprintf(etUnit_reportfile, writeBuffer);
}
}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RUnit.h b/runtime/org.eclipse.etrice.runtime.c/src/etUnit.h
index c29b8809d..e98615c5c 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/RUnit.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/etUnit.h
@@ -10,21 +10,21 @@
*
*******************************************************************************/
-#ifndef _RUNIT_H_
-#define _RUNIT_H_
+#ifndef _ETUNIT_H_
+#define _ETUNIT_H_
-#include "datatypes.h"
+#include "etDatatypes.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);
+void etUnit_open(char* testResultPath, char* testFileName);
+void etUnit_close(void);
+void etUnit_openTestSuite(char* testSuiteName);
+void etUnit_closeTestSuite(void);
+void etUnit_openTestCase(char* testCaseName);
+void etUnit_closeTestCase(void);
/* boolean values */
void EXPECT_TRUE(const char* testcase, etBool condition);
@@ -53,9 +53,9 @@ void expect_equal_void_ptr(const char* testcase, const void* expected, const voi
/* Helpers for adding testcases */
#define ADD_TESTCASE(testcase) \
- RUnit_openTestCase(#testcase); \
+ etUnit_openTestCase(#testcase); \
testcase(); \
- RUnit_closeTestCase();
+ etUnit_closeTestCase();
-#endif /* _RUNIT_H_ */
+#endif /* _ETUNIT_H_ */

Back to the top