Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.c/src')
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/RMessage.c21
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/RMessage.h26
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.c79
-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/RUnit.c277
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/RUnit.h53
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/datatypes.h65
9 files changed, 670 insertions, 0 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/RMessage.c b/runtime/org.eclipse.etrice.runtime.c/src/RMessage.c
new file mode 100644
index 000000000..9e67a84c2
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/RMessage.c
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * 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/runtime/org.eclipse.etrice.runtime.c/src/RMessage.h b/runtime/org.eclipse.etrice.runtime.c/src/RMessage.h
new file mode 100644
index 000000000..dd6927662
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/RMessage.h
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.c b/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.c
new file mode 100644
index 000000000..0c28cdec9
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.c
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * 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/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.h b/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.h
new file mode 100644
index 000000000..b2326eec8
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/RMessageQueue.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 _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
new file mode 100644
index 000000000..2fe28406c
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.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 "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
new file mode 100644
index 000000000..fae4e33bb
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/RMessageService.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 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/RUnit.c b/runtime/org.eclipse.etrice.runtime.c/src/RUnit.c
new file mode 100644
index 000000000..2a68f5f8f
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/RUnit.c
@@ -0,0 +1,277 @@
+/*******************************************************************************
+ * 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/runtime/org.eclipse.etrice.runtime.c/src/RUnit.h b/runtime/org.eclipse.etrice.runtime.c/src/RUnit.h
new file mode 100644
index 000000000..a3badcc7e
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/RUnit.h
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * 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/runtime/org.eclipse.etrice.runtime.c/src/datatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/datatypes.h
new file mode 100644
index 000000000..7bcc4826a
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/datatypes.h
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * 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_ */

Back to the top