Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Schuetz2012-01-11 08:41:08 -0500
committerThomas Schuetz2012-01-11 08:41:08 -0500
commit9752cfdd90ae33721e8761bd211f76b3d0728876 (patch)
treeb74c770eedf9431e14cabac1d0d51f480def5ef7 /examples/org.eclipse.etrice.generator.c.reference
parentdf35a49da5a4aadb7875e37d938afc605251868d (diff)
downloadorg.eclipse.etrice-9752cfdd90ae33721e8761bd211f76b3d0728876.tar.gz
org.eclipse.etrice-9752cfdd90ae33721e8761bd211f76b3d0728876.tar.xz
org.eclipse.etrice-9752cfdd90ae33721e8761bd211f76b3d0728876.zip
[generator.c.reference] extended datatypes.h for standardized eTrice C-runtime types (etUInt32 ...), changed types for RUnit to runtime types
Diffstat (limited to 'examples/org.eclipse.etrice.generator.c.reference')
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/.settings/org.eclipse.cdt.ui.prefs3
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/model/cGenRef.room69
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/model/diagrams/cGenRef.Broadcast.behavior458
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/SSRunner.c25
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.c214
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.h79
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/runtime/datatypes.h25
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/TestMessage.c17
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageQueue.c40
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageService.c46
-rw-r--r--examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml17
11 files changed, 830 insertions, 163 deletions
diff --git a/examples/org.eclipse.etrice.generator.c.reference/.settings/org.eclipse.cdt.ui.prefs b/examples/org.eclipse.etrice.generator.c.reference/.settings/org.eclipse.cdt.ui.prefs
new file mode 100644
index 000000000..ea816250e
--- /dev/null
+++ b/examples/org.eclipse.etrice.generator.c.reference/.settings/org.eclipse.cdt.ui.prefs
@@ -0,0 +1,3 @@
+#Wed Jan 11 10:35:04 CET 2012
+eclipse.preferences.version=1
+formatter_settings_version=1
diff --git a/examples/org.eclipse.etrice.generator.c.reference/model/cGenRef.room b/examples/org.eclipse.etrice.generator.c.reference/model/cGenRef.room
index 6ecd60223..9abeb2133 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/model/cGenRef.room
+++ b/examples/org.eclipse.etrice.generator.c.reference/model/cGenRef.room
@@ -1,40 +1,5 @@
RoomModel cGenRef {
- ProtocolClass CommunicationProtocol {
- incoming {
- Message sendData(data: int32)
- Message sendData2(data: DataClass1)
-
- }
- outgoing {
- Message receivedData()
- }
- }
-
-
- DataClass DataClass1 {
- usercode1 {"// usercode1"}
- usercode2 {"// usercode2"}
- usercode3 {"// usercode3"}
- Attribute Attr1: int32
- Attribute ComplexAttr: DataClass2
- Attribute Attr3: float32
-
- Operation MultiplyWithAttr1(value: int32): int32 {
- "return self->Attr1*value;"
- }
- Operation MultiplyWithAttr3(value: float32): float32 {
- "return self->Attr3*value;"
- }
- }
-
- DataClass DataClass2 {
- Attribute Attr1: int32
- Attribute Attr2: float32
- Attribute Attr3: int32
- Operation Operation1(): void {"/*nothing to do*/"}
- }
-
SubSystemClass SS {
ActorRef Receiver: Receiver
ActorRef Sender: Sender
@@ -174,5 +139,39 @@ RoomModel cGenRef {
}
}
+ ProtocolClass CommunicationProtocol {
+ incoming {
+ Message sendData(data: int32)
+ Message sendData2(data: DataClass1)
+
+ }
+ outgoing {
+ Message receivedData()
+ }
+ }
+
+
+ DataClass DataClass1 {
+ usercode1 {"// usercode1"}
+ usercode2 {"// usercode2"}
+ usercode3 {"// usercode3"}
+ Attribute Attr1: int32
+ Attribute ComplexAttr: DataClass2
+ Attribute Attr3: float32
+
+ Operation MultiplyWithAttr1(value: int32): int32 {
+ "return self->Attr1*value;"
+ }
+ Operation MultiplyWithAttr3(value: float32): float32 {
+ "return self->Attr3*value;"
+ }
+ }
+
+ DataClass DataClass2 {
+ Attribute Attr1: int32
+ Attribute Attr2: float32
+ Attribute Attr3: int32
+ Operation Operation1(): void {"/*nothing to do*/"}
+ }
} \ No newline at end of file
diff --git a/examples/org.eclipse.etrice.generator.c.reference/model/diagrams/cGenRef.Broadcast.behavior b/examples/org.eclipse.etrice.generator.c.reference/model/diagrams/cGenRef.Broadcast.behavior
new file mode 100644
index 000000000..5fb0a165b
--- /dev/null
+++ b/examples/org.eclipse.etrice.generator.c.reference/model/diagrams/cGenRef.Broadcast.behavior
@@ -0,0 +1,458 @@
+<?xml version="1.0" encoding="ASCII"?>
+<pi:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:al="http://eclipse.org/graphiti/mm/algorithms" xmlns:pi="http://eclipse.org/graphiti/mm/pictograms" visible="true" diagramTypeId="room.behavior" name="Behavior of Broadcast" showGuides="true" pictogramLinks="//@link //@children.0/@link //@children.0/@children.1/@link //@children.0/@children.2/@link //@children.0/@children.3/@link //@children.0/@children.4/@link //@children.1/@link //@children.1/@children.1/@link //@children.0/@children.3/@children.1/@link //@children.1/@children.2/@link //@children.0/@children.3/@children.2/@link //@children.1/@children.3/@link //@children.1/@children.4/@link //@children.1/@children.5/@link //@connections.0/@link //@connections.1/@link //@connections.2/@link //@connections.3/@link //@connections.4/@link //@connections.5/@link //@connections.6/@link //@connections.7/@link" verticalGridUnit="0">
+ <graphicsAlgorithm xsi:type="al:Rectangle" background="//@colors.1" foreground="//@colors.0" lineWidth="1" transparency="0.0" width="1000" height="1000"/>
+ <link>
+ <businessObjects href="../cGenRef.room#ActorClass:Broadcast"/>
+ </link>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="sg"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="40" y="40">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="4" transparency="0.5" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/>
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#StateMachine:Broadcast$sg"/>
+ </link>
+ <children visible="true">
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="800" height="80" y="40" font="//@fonts.1" horizontalAlignment="ALIGNMENT_RIGHT" verticalAlignment="ALIGNMENT_TOP" value="/"/>
+ </children>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="trp"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="40" height="40" x="100" y="100">
+ <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="20" height="20" x="10" y="10"/>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#StateMachine:Broadcast$sg"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.5" referencedGraphicsAlgorithm="//@children.0/@children.1/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children visible="true">
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="40" height="20" y="10" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="I"/>
+ </children>
+ </children>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="state"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="120" height="90" x="170" y="80">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="60" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="35" y="3" cornerHeight="5" cornerWidth="5"/>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24">
+ <points x="-3" y="-3"/>
+ <points x="-3" y="3"/>
+ <points x="-11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24">
+ <points x="3" y="-3"/>
+ <points x="3" y="3"/>
+ <points x="11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24">
+ <points x="-2" y="-3"/>
+ <points x="-2" y="3"/>
+ <points x="2" y="3"/>
+ <points x="2" y="-3"/>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#BaseState:Broadcast$Idle"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.6" incomingConnections="//@connections.5"/>
+ <children visible="true">
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="60" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="Idle"/>
+ </children>
+ </children>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="state"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="120" height="90" x="370" y="80">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="60" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0" width="15" height="8" x="35" y="3" cornerHeight="5" cornerWidth="5"/>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24">
+ <points x="-3" y="-3"/>
+ <points x="-3" y="3"/>
+ <points x="-11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24">
+ <points x="3" y="-3"/>
+ <points x="3" y="3"/>
+ <points x="11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="30" y="24">
+ <points x="-2" y="-3"/>
+ <points x="-2" y="3"/>
+ <points x="2" y="3"/>
+ <points x="2" y="-3"/>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#BaseState:Broadcast$Sending"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" referencedGraphicsAlgorithm="//@children.0/@children.3/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children visible="true">
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="60" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="Sending"/>
+ </children>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="trp"/>
+ <properties key="item-kind" value="entp"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="60" height="60" x="19">
+ <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="11" height="11" x="25" y="25"/>
+ <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0">
+ <points x="27" y="33"/>
+ <points x="33" y="27"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0">
+ <points x="27" y="27"/>
+ <points x="33" y="33"/>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#EntryPoint:Broadcast$Sending$tp0"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" incomingConnections="//@connections.6" referencedGraphicsAlgorithm="//@children.0/@children.3/@children.1/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children visible="true">
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="60" height="22" font="//@fonts.0" verticalAlignment="ALIGNMENT_BOTTOM" value="tp0"/>
+ </children>
+ </children>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="trp"/>
+ <properties key="item-kind" value="extp"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="60" height="60" x="39">
+ <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="11" height="11" x="25" y="25"/>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" transparency="0.0" x="25" y="25">
+ <points x="5"/>
+ <points x="11" y="5"/>
+ <points x="5" y="11"/>
+ <points y="5"/>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#ExitPoint:Broadcast$Sending$tp1"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.7" referencedGraphicsAlgorithm="//@children.0/@children.3/@children.2/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children visible="true">
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="60" height="22" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" verticalAlignment="ALIGNMENT_BOTTOM" value="tp1"/>
+ </children>
+ </children>
+ </children>
+ <children xsi:type="pi:ContainerShape" visible="true" active="true">
+ <properties key="obj-type" value="state"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="149" height="90" x="556" y="80">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="89" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="64" y="3" cornerHeight="5" cornerWidth="5"/>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="44" y="24">
+ <points x="-3" y="-3"/>
+ <points x="-3" y="3"/>
+ <points x="-11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="44" y="24">
+ <points x="3" y="-3"/>
+ <points x="3" y="3"/>
+ <points x="11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="44" y="24">
+ <points x="-2" y="-3"/>
+ <points x="-2" y="3"/>
+ <points x="2" y="3"/>
+ <points x="2" y="-3"/>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#BaseState:Broadcast$ReceivedBoth"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" incomingConnections="//@connections.7" referencedGraphicsAlgorithm="//@children.0/@children.4/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children visible="true">
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="89" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="ReceivedBoth"/>
+ </children>
+ </children>
+ </children>
+ <children xsi:type="pi:ContainerShape" active="true">
+ <properties key="obj-type" value="sg"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="880" height="580" x="40" y="40">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.1" foreground="//@colors.2" lineWidth="4" transparency="0.5" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/>
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="4" filled="false" transparency="0.0" width="800" height="500" x="40" y="40" cornerHeight="20" cornerWidth="20"/>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#PlainStateGraph:Broadcast$Sending$sg"/>
+ </link>
+ <children>
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="800" height="80" y="40" font="//@fonts.1" horizontalAlignment="ALIGNMENT_RIGHT" verticalAlignment="ALIGNMENT_TOP" value="/Sending"/>
+ </children>
+ <children xsi:type="pi:ContainerShape" active="true">
+ <properties key="obj-type" value="trp"/>
+ <properties key="item-kind" value="entp"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="80" height="80" x="256">
+ <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="20" height="20" x="30" y="30"/>
+ <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="2" filled="false" transparency="0.0">
+ <points x="33" y="47"/>
+ <points x="47" y="33"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="2" filled="false" transparency="0.0">
+ <points x="33" y="33"/>
+ <points x="47" y="47"/>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#EntryPoint:Broadcast$Sending$tp0"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.1/@children.1/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children>
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="80" height="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" verticalAlignment="ALIGNMENT_BOTTOM" value="tp0"/>
+ </children>
+ </children>
+ <children xsi:type="pi:ContainerShape" active="true">
+ <properties key="obj-type" value="trp"/>
+ <properties key="item-kind" value="extp"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="80" height="80" x="522">
+ <graphicsAlgorithmChildren xsi:type="al:Ellipse" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" width="20" height="20" x="30" y="30"/>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="2" transparency="0.0" x="30" y="30">
+ <points x="10"/>
+ <points x="20" y="10"/>
+ <points x="10" y="20"/>
+ <points y="10"/>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#ExitPoint:Broadcast$Sending$tp1"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" incomingConnections="//@connections.3 //@connections.4" referencedGraphicsAlgorithm="//@children.1/@children.2/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children>
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="80" height="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" verticalAlignment="ALIGNMENT_BOTTOM" value="tp1"/>
+ </children>
+ </children>
+ <children xsi:type="pi:ContainerShape" active="true">
+ <properties key="obj-type" value="state"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="185" height="90" x="138" y="80">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="125" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="100" y="3" cornerHeight="5" cornerWidth="5"/>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="62" y="24">
+ <points x="-3" y="-3"/>
+ <points x="-3" y="3"/>
+ <points x="-11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="62" y="24">
+ <points x="3" y="-3"/>
+ <points x="3" y="3"/>
+ <points x="11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="62" y="24">
+ <points x="-2" y="-3"/>
+ <points x="-2" y="3"/>
+ <points x="2" y="3"/>
+ <points x="2" y="-3"/>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#BaseState:Broadcast$Sending$WaitingForReceived"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.1 //@connections.2" incomingConnections="//@connections.0" referencedGraphicsAlgorithm="//@children.1/@children.3/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children>
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="125" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="WaitingForReceived"/>
+ </children>
+ </children>
+ <children xsi:type="pi:ContainerShape" active="true">
+ <properties key="obj-type" value="state"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="146" height="90" x="357" y="80">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="86" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="61" y="3" cornerHeight="5" cornerWidth="5"/>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="43" y="24">
+ <points x="-3" y="-3"/>
+ <points x="-3" y="3"/>
+ <points x="-11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="43" y="24">
+ <points x="3" y="-3"/>
+ <points x="3" y="3"/>
+ <points x="11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="43" y="24">
+ <points x="-2" y="-3"/>
+ <points x="-2" y="3"/>
+ <points x="2" y="3"/>
+ <points x="2" y="-3"/>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#BaseState:Broadcast$Sending$ReceivedOne"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.3" incomingConnections="//@connections.1" referencedGraphicsAlgorithm="//@children.1/@children.4/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children>
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="86" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="ReceivedOne"/>
+ </children>
+ </children>
+ <children xsi:type="pi:ContainerShape" active="true">
+ <properties key="obj-type" value="state"/>
+ <graphicsAlgorithm xsi:type="al:Rectangle" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="175" height="90" x="543" y="80">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" background="//@colors.3" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="115" height="30" x="30" y="30" cornerHeight="20" cornerWidth="20">
+ <graphicsAlgorithmChildren xsi:type="al:RoundedRectangle" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" width="15" height="8" x="90" y="3" cornerHeight="5" cornerWidth="5"/>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="57" y="24">
+ <points x="-3" y="-3"/>
+ <points x="-3" y="3"/>
+ <points x="-11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="57" y="24">
+ <points x="3" y="-3"/>
+ <points x="3" y="3"/>
+ <points x="11" y="3"/>
+ </graphicsAlgorithmChildren>
+ <graphicsAlgorithmChildren xsi:type="al:Polygon" foreground="//@colors.2" lineWidth="1" filled="false" lineVisible="false" transparency="0.0" x="57" y="24">
+ <points x="-2" y="-3"/>
+ <points x="-2" y="3"/>
+ <points x="2" y="3"/>
+ <points x="2" y="-3"/>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithmChildren>
+ </graphicsAlgorithm>
+ <link>
+ <businessObjects href="../cGenRef.room#BaseState:Broadcast$Sending$ReceivedTheOther"/>
+ </link>
+ <anchors xsi:type="pi:ChopboxAnchor" outgoingConnections="//@connections.4" incomingConnections="//@connections.2" referencedGraphicsAlgorithm="//@children.1/@children.5/@graphicsAlgorithm/@graphicsAlgorithmChildren.0"/>
+ <children>
+ <graphicsAlgorithm xsi:type="al:Text" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0" width="115" height="30" x="30" y="30" font="//@fonts.0" horizontalAlignment="ALIGNMENT_CENTER" value="ReceivedTheOther"/>
+ </children>
+ </children>
+ </children>
+ <connections xsi:type="pi:FreeFormConnection" active="true" start="//@children.1/@children.1/@anchors.0" end="//@children.1/@children.3/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../cGenRef.room#ContinuationTransition:Broadcast$Sending$tr0"/>
+ </link>
+ <connectionDecorators locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" transparency="0.0" x="10" font="//@fonts.0" value="tr0: "/>
+ </connectionDecorators>
+ </connections>
+ <connections xsi:type="pi:FreeFormConnection" active="true" start="//@children.1/@children.3/@anchors.0" end="//@children.1/@children.4/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../cGenRef.room#TriggeredTransition:Broadcast$Sending$tr1"/>
+ </link>
+ <connectionDecorators locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" transparency="0.0" x="10" font="//@fonts.0" value="tr1: &lt;receivedData:d..."/>
+ </connectionDecorators>
+ </connections>
+ <connections xsi:type="pi:FreeFormConnection" active="true" start="//@children.1/@children.3/@anchors.0" end="//@children.1/@children.5/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../cGenRef.room#TriggeredTransition:Broadcast$Sending$tr2"/>
+ </link>
+ <connectionDecorators locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" transparency="0.0" x="10" font="//@fonts.0" value="tr2: &lt;receivedData:d..."/>
+ </connectionDecorators>
+ </connections>
+ <connections xsi:type="pi:FreeFormConnection" active="true" start="//@children.1/@children.4/@anchors.0" end="//@children.1/@children.2/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../cGenRef.room#TriggeredTransition:Broadcast$Sending$tr3"/>
+ </link>
+ <connectionDecorators locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" transparency="0.0" x="10" font="//@fonts.0" value="tr3: &lt;receivedData:d..."/>
+ </connectionDecorators>
+ </connections>
+ <connections xsi:type="pi:FreeFormConnection" active="true" start="//@children.1/@children.5/@anchors.0" end="//@children.1/@children.2/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../cGenRef.room#TriggeredTransition:Broadcast$Sending$tr4"/>
+ </link>
+ <connectionDecorators locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" transparency="0.0" x="10" font="//@fonts.0" value="tr4: &lt;receivedData:d..."/>
+ </connectionDecorators>
+ </connections>
+ <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.1/@anchors.0" end="//@children.0/@children.2/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../cGenRef.room#InitialTransition:Broadcast$initial"/>
+ </link>
+ <connectionDecorators visible="true" locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.1" foreground="//@colors.2" lineWidth="1" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" transparency="0.0" x="10" font="//@fonts.0" value="init"/>
+ </connectionDecorators>
+ </connections>
+ <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.2/@anchors.0" end="//@children.0/@children.3/@children.1/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../cGenRef.room#TriggeredTransition:Broadcast$tr0"/>
+ </link>
+ <connectionDecorators visible="true" locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" transparency="0.0" x="10" font="//@fonts.0" value="tr0: &lt;sendData:dataI..."/>
+ </connectionDecorators>
+ </connections>
+ <connections xsi:type="pi:FreeFormConnection" visible="true" active="true" start="//@children.0/@children.3/@children.2/@anchors.0" end="//@children.0/@children.4/@anchors.0">
+ <properties key="obj-type" value="trans"/>
+ <graphicsAlgorithm xsi:type="al:Polyline" foreground="//@colors.2" lineWidth="1" filled="false" transparency="0.0"/>
+ <link>
+ <businessObjects href="../cGenRef.room#ContinuationTransition:Broadcast$tr1"/>
+ </link>
+ <connectionDecorators visible="true" locationRelative="true" location="1.0">
+ <graphicsAlgorithm xsi:type="al:Polygon" background="//@colors.2" foreground="//@colors.2" lineWidth="1" transparency="0.0">
+ <points x="-15" y="5"/>
+ <points/>
+ <points x="-15" y="-5"/>
+ </graphicsAlgorithm>
+ </connectionDecorators>
+ <connectionDecorators visible="true" active="true" locationRelative="true" location="0.5">
+ <graphicsAlgorithm xsi:type="al:Text" foreground="//@colors.2" lineWidth="1" transparency="0.0" x="10" font="//@fonts.0" value="tr1: "/>
+ </connectionDecorators>
+ </connections>
+ <colors red="227" green="238" blue="249"/>
+ <colors red="255" green="255" blue="255"/>
+ <colors/>
+ <colors red="200" green="200" blue="200"/>
+ <fonts name="Arial" size="8"/>
+ <fonts name="Arial" size="9" bold="true"/>
+</pi:Diagram>
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 8f99b462a..bc6c96be3 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/SSRunner.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/SSRunner.c
@@ -28,7 +28,9 @@ int main(void){
}
void testDataClassDeepCopy(void){
- RUnit_open("testGeneratedDataClass");
+ RUnit_openTestSuite("testGeneratedDataClass");
+ RUnit_openTestCase("testDataClassDeepCopy");
+
DataClass1 d, e;
d.Attr1 = 123;
@@ -39,22 +41,27 @@ void testDataClassDeepCopy(void){
DataClass1_deepCopy(&d,&e);
- EXPECT_EQUAL_INT("Attr1", 123, e.Attr1);
- EXPECT_EQUAL_INT("ComplexAttr.Attr1", 456, e.ComplexAttr.Attr1);
- EXPECT_EQUAL_FLOAT("ComplexAttr.Attr2", 789.123, e.ComplexAttr.Attr2);
- EXPECT_EQUAL_INT("ComplexAttr.Attr3", 789, e.ComplexAttr.Attr3);
- EXPECT_EQUAL_FLOAT("Attr3", 321.123, e.Attr3);
+ EXPECT_EQUAL_INT32("Attr1", 123, e.Attr1);
+ EXPECT_EQUAL_INT32("ComplexAttr.Attr1", 456, e.ComplexAttr.Attr1);
+ EXPECT_EQUAL_FLOAT32("ComplexAttr.Attr2", 789.123, e.ComplexAttr.Attr2, 0.001);
+ EXPECT_EQUAL_INT32("ComplexAttr.Attr3", 789, e.ComplexAttr.Attr3);
+ EXPECT_EQUAL_FLOAT32("Attr3", 321.123, e.Attr3, 0.0001);
- EXPECT_EQUAL_INT("Operation DataClass1_MultiplyWithAttr1", 246, DataClass1_MultiplyWithAttr1(&d, 2));
- EXPECT_EQUAL_FLOAT("Operation DataClass1_MultiplyWithAttr3", 642.246, DataClass1_MultiplyWithAttr3(&d, 2));
+ EXPECT_EQUAL_INT32("Operation DataClass1_MultiplyWithAttr1", 246, DataClass1_MultiplyWithAttr1(&d, 2));
+ EXPECT_EQUAL_FLOAT32("Operation DataClass1_MultiplyWithAttr3", 642.246, DataClass1_MultiplyWithAttr3(&d, 2), 0.0001);
- RUnit_close();
+ RUnit_closeTestCase();
+ RUnit_closeTestSuite();
}
void runTestCases(void){
+ RUnit_open("tmp/testlog","TestMessageService");
+
testDataClassDeepCopy();
TestMessage_runSuite();
TestMessageQueue_runSuite();
TestRMessageService_runSuite();
+
+ RUnit_close();
}
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
index 0ab3e7dce..2a68f5f8f 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.c
@@ -11,25 +11,65 @@
*******************************************************************************/
#include "RUnit.h"
+#include <string.h>
+/*** member variables */
-void RUnit_open(const char *testSuiteName) {
+/* 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;
- printf("************* TEST START (%s) **************\n", testSuiteName);
+ strcpy(etUnit_failureText,"");
+
+ RUnit_TestFileName = testFileName;
+ RUnit_TestResultPath = testResultPath;
+
+ printf("************* TEST START (%s) **************\n", RUnit_TestFileName);
- char filename[256];
- sprintf(filename, "%s.xml", testSuiteName);
+ 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,
- "<testsuite name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n",
- testSuiteName);
+ fprintf(RUnit_reportfile, "<testsuites name=\"%s\" tests=\"0\" failures=\"0\" errors=\"0\" time=\"0\">\n",
+ RUnit_TestFileName);
} else {
- printf("Unable to open file!");
+ printf("Unable to open file %s/%s.xml\n", RUnit_TestResultPath, RUnit_TestFileName);
}
}
// prepare time measurement
@@ -38,8 +78,8 @@ void RUnit_open(const char *testSuiteName) {
printf("Start Time: %ld\n", RUnit_startTime);
}
- void RUnit_close(void) {
+void RUnit_close(void) {
printf("\n");
if (RUnit_failCount > 0) {
printf("************* TEST FAILED *************\n");
@@ -53,57 +93,179 @@ void RUnit_open(const char *testSuiteName) {
printf("End Time: %ld, CLOCKS_PER_SEC: %ld\n", clock(), CLOCKS_PER_SEC);
printf("***************************************\n");
-
-
if (RUnit_reportfile != NULL) {
- fprintf(RUnit_reportfile, "</testsuite>\n");
+ 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 EXPECT_TRUE(const char* testcase, boool condition) {
+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) {
- RUnit_writeTestLog(testcase, FALSE, "*** FAIL: EXPECT_TRUE == FALSE");
+ char testresult[ETUNIT_FAILURE_TEXT_LEN];
+ sprintf(testresult, "%s: *** EXPECT_TRUE == FALSE", message);
+ etUnit_handleExpect(FALSE, testresult);
} else {
- RUnit_writeTestLog(testcase, TRUE, "");
+ etUnit_handleExpect(TRUE, "");
}
}
-void EXPECT_FALSE(const char* testcase, boool condition) {
+void EXPECT_FALSE(const char* message, boool condition) {
if (condition == TRUE) {
- RUnit_writeTestLog(testcase, FALSE, "*** FAIL: EXPECT_FALSE == 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 {
- RUnit_writeTestLog(testcase, FALSE, "");
+ 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<testcase name=\"%s\" classname=\"none\" time=\"0.0000\"/>\n", testcase);
+ sprintf(xml, "\t\t<testcase name=\"%s\" time=\"%ld\"/>\n", testcase, time);
} else {
- sprintf(xml, "\t<testcase name=\"%s\" classname=\"none\" time=\"0.0000\">\n\t\t<failure message=\"%s\" type=\"\"/>\n\t</testcase>\n", testcase, resulttext);
+ 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[256]; // TODO TS: write secure buffers for string handling ...
-
+ char writeBuffer[ETUNIT_FAILURE_TEXT_LEN];
// counting
if (result == TRUE) {
RUnit_passCount++;
printf("PASS: %s: %s\n", testcase, resulttext);
- }
- else {
+ } else {
RUnit_failCount++;
printf("FAIL: %s: %s\n", testcase, resulttext);
}
- clock_t time = clock()-RUnit_currentTime;
+ clock_t time = clock() - RUnit_currentTime;
RUnit_currentTime = clock();
// writing to file
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
index f0f865f2e..a3badcc7e 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.h
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/RUnit.h
@@ -17,56 +17,37 @@
#include <stdio.h>
#include <time.h>
-//*** global variables
-// file handling
-static FILE* RUnit_reportfile = NULL;
-// counters
-static int32 RUnit_passCount = 0;
-static int32 RUnit_failCount = 0;
-
-// time measuring
-static clock_t RUnit_startTime = 0;
-static clock_t RUnit_currentTime = 0;
-
-
-// forward declarations
-void RUnit_open(const char *testSuiteName);
+// open / close
+void RUnit_open(char* testResultPath, char* testFileName);
void RUnit_close(void);
-void RUnit_writeTestLog(const char *testcase, boool result, const char *resulttext);
-
-
-void EXPECT_TRUE(const char* testcase, boool condition);
-void EXPECT_FALSE(const char* testcase, boool condition);
-
-//void EXPECT_EQUAL(const char* testcase, int8 expected, int8 actual);
-//void EXPECT_EQUAL(const char* testcase, int16 expected, int16 actual);
-//void EXPECT_EQUAL(const char* testcase, int32 expected, int32 actual);
-//void EXPECT_EQUAL(const char* testcase, uint8 expected, uint8 actual);
-//void EXPECT_EQUAL(const char* testcase, uint16 expected, uint16 actual);
-//void EXPECT_EQUAL(const char* testcase, uint32 expected, uint32 actual);
-
-
-#define EXPECT_EQUAL_INT(testcase, expected, actual) \
- if (expected != actual) { \
- char testresult[256]; \
- sprintf(testresult, "expected=%ld, actual=%ld", expected, actual); \
- RUnit_writeTestLog(testcase, FALSE, testresult); \
- } \
- else { \
- RUnit_writeTestLog(testcase, TRUE, ""); \
- }
-
-#define FLOAT_PRECISION 0.0001
-
-#define EXPECT_EQUAL_FLOAT(testcase, expected, actual) \
- if (expected-actual < -FLOAT_PRECISION || expected-actual > FLOAT_PRECISION) { \
- char testresult[256]; \
- sprintf(testresult, "expected=%f, actual=%f", expected, actual); \
- RUnit_writeTestLog(testcase, FALSE, testresult); \
- } \
- else { \
- RUnit_writeTestLog(testcase, TRUE, ""); \
- }
+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
index ff97c8489..7bcc4826a 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/runtime/datatypes.h
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/runtime/datatypes.h
@@ -13,15 +13,23 @@
#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;
@@ -36,5 +44,22 @@ typedef char boool; /* TODO: bool, Bool, Boolean, and boolean are already defin
#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/TestMessage.c
index 848bbe94c..56c2ecd51 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestMessage.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestMessage.c
@@ -19,29 +19,30 @@
void TestMessage_testBasicMessage(void){
+ RUnit_openTestCase("TestMessage_testBasicMessage");
RMessage msg1 = {(RMessage*)1234567, 123,456,};
RMessage msg2 = {NULL, 222,333};
// basic checks -> detects structure changes that would cause problems for generated code
- EXPECT_EQUAL_INT("Message.next", 1234567,msg1.next);
- EXPECT_EQUAL_INT("Message.address", 123,msg1.address);
- EXPECT_EQUAL_INT("Message.evtID", 456,msg1.evtID);
+ EXPECT_EQUAL_PTR("Message.next", 1234567, msg1.next);
+ EXPECT_EQUAL_INT16("Message.address", 123, msg1.address);
+ EXPECT_EQUAL_INT16("Message.evtID", 456, msg1.evtID);
// build pointer ring
msg1.next = &msg2;
msg2.next = &msg1;
- EXPECT_EQUAL_INT("msg1.NextMsg", msg2.evtID, msg1.next->evtID);
- EXPECT_EQUAL_INT("msg2.NextMsg", msg1.evtID, msg2.next->evtID);
-
+ EXPECT_EQUAL_INT16("msg1.NextMsg", msg2.evtID, msg1.next->evtID);
+ EXPECT_EQUAL_INT16("msg2.NextMsg", msg1.evtID, msg2.next->evtID);
+ RUnit_closeTestCase();
}
void TestMessage_runSuite(void){
- RUnit_open("testMessage");
+ RUnit_openTestSuite("TestMessage");
TestMessage_testBasicMessage();
- RUnit_close();
+ RUnit_closeTestSuite();
}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageQueue.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageQueue.c
index 1bc7b2772..d50af956d 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageQueue.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageQueue.c
@@ -15,6 +15,8 @@
#include "RMessageQueue.h"
void testPushPop(void){
+ RUnit_openTestCase("testPushPop");
+
RMessage msg1 = {NULL, 123, 456};
RMessage msg2 = {NULL, 222, 333};
@@ -24,34 +26,37 @@ void testPushPop(void){
RMessageQueue_push(&queue1, &msg1);
RMessageQueue_push(&queue1, &msg2);
- EXPECT_EQUAL_INT("RMessageQueue.size before", 2,queue1.size);
- EXPECT_EQUAL_INT("RMessageQueue.highWaterMark before", 2,queue1.highWaterMark);
+ EXPECT_EQUAL_INT16("RMessageQueue.size before", 2,queue1.size);
+ EXPECT_EQUAL_INT16("RMessageQueue.highWaterMark before", 2,queue1.highWaterMark);
RMessage* rcvMsg1 = RMessageQueue_pop(&queue1);
RMessage* rcvMsg2 = RMessageQueue_pop(&queue1);
- EXPECT_EQUAL_INT("RMessageQueue.size after", 0,queue1.size);
- EXPECT_EQUAL_INT("RMessageQueue.highWaterMark after", 2,queue1.highWaterMark);
+ EXPECT_EQUAL_INT16("RMessageQueue.size after", 0,queue1.size);
+ EXPECT_EQUAL_INT16("RMessageQueue.highWaterMark after", 2,queue1.highWaterMark);
- EXPECT_EQUAL_INT("rcvMsg1->address", 123, rcvMsg1->address);
- EXPECT_EQUAL_INT("rcvMsg1->evtID", 456, rcvMsg1->evtID);
- EXPECT_EQUAL_INT("rcvMsg1->next", NULL, rcvMsg1->next);
+ EXPECT_EQUAL_INT16("rcvMsg1->address", 123, rcvMsg1->address);
+ EXPECT_EQUAL_INT16("rcvMsg1->evtID", 456, rcvMsg1->evtID);
+ EXPECT_EQUAL_PTR("rcvMsg1->next", NULL, rcvMsg1->next);
- EXPECT_EQUAL_INT("rcvMsg2->address", 222, rcvMsg2->address);
- EXPECT_EQUAL_INT("rcvMsg2->evtID", 333, rcvMsg2->evtID);
- EXPECT_EQUAL_INT("rcvMsg2->next", NULL, rcvMsg2->next);
+ EXPECT_EQUAL_INT16("rcvMsg2->address", 222, rcvMsg2->address);
+ EXPECT_EQUAL_INT16("rcvMsg2->evtID", 333, rcvMsg2->evtID);
+ EXPECT_EQUAL_PTR("rcvMsg2->next", NULL, rcvMsg2->next);
- EXPECT_EQUAL_INT("RMessageQueue->first", NULL, queue1.first);
- EXPECT_EQUAL_INT("RMessageQueue->last", NULL, queue1.last);
+ EXPECT_EQUAL_PTR("RMessageQueue->first", NULL, queue1.first);
+ EXPECT_EQUAL_PTR("RMessageQueue->last", NULL, queue1.last);
RMessage* rcvMsg3 = RMessageQueue_pop(&queue1);
- EXPECT_EQUAL_INT("RMessageQueue_pop if empty", NULL, rcvMsg3);
+ EXPECT_EQUAL_PTR("RMessageQueue_pop if empty", NULL, rcvMsg3);
+ RUnit_closeTestCase();
}
#define MAX 1000
void testMassiveMessaging(void){
+ RUnit_openTestCase("MassiveMessaging");
+
RMessage msgArray[MAX];
printf("sizeof(RMessage):%d\n", sizeof(RMessage));
printf("size(msgArray):%d\n", sizeof(msgArray));
@@ -59,7 +64,7 @@ void testMassiveMessaging(void){
RMessageQueue queue1;
RMessageQueue_init(&queue1);
- int i;
+ int32 i;
for(i=0; i<MAX; i++){
//RMessage_init(&msgArray[i]);
msgArray[i].address = i;
@@ -87,13 +92,14 @@ void testMassiveMessaging(void){
break;
}
}
- EXPECT_EQUAL_INT("i==MAX", MAX, i);
+ EXPECT_EQUAL_INT32("i==MAX", MAX, i);
}
+ RUnit_closeTestCase();
}
void TestMessageQueue_runSuite(void){
- RUnit_open("TestRMessageQueue");
+ RUnit_openTestSuite("TestRMessageQueue");
testPushPop();
testMassiveMessaging();
- RUnit_close();
+ RUnit_closeTestSuite();
}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageService.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageService.c
index e11e3c556..4baff7079 100644
--- a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageService.c
+++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestRMessageService.c
@@ -16,6 +16,8 @@
void testRMessageService_init(void){
+ RUnit_openTestCase("testRMessageService_init");
+
RMessageService msgService;
int16 max = 6;
int16 blockSize = 32;
@@ -24,16 +26,18 @@ void testRMessageService_init(void){
RMessageService_init(&msgService, msgBuffer, max, blockSize);
- EXPECT_EQUAL_INT("msgService.messagePool.first", msgBuffer, msgService.messagePool.first);
- EXPECT_EQUAL_INT("msgService.messagePool in between", &msgBuffer[3*blockSize], msgService.messagePool.first->next->next->next);
- EXPECT_EQUAL_INT("msgService.messagePool.last(1)", &msgBuffer[5*blockSize], msgService.messagePool.first->next->next->next->next->next);
- EXPECT_EQUAL_INT("msgService.messagePool.last(2)", &msgBuffer[5*blockSize], msgService.messagePool.last);
- EXPECT_EQUAL_INT("msgService.messagePool.last.next", NULL, msgService.messagePool.last->next);
-
+ EXPECT_EQUAL_PTR("msgService.messagePool.first", msgBuffer, msgService.messagePool.first);
+ EXPECT_EQUAL_PTR("msgService.messagePool in between", &msgBuffer[3*blockSize], msgService.messagePool.first->next->next->next);
+ EXPECT_EQUAL_PTR("msgService.messagePool.last(1)", &msgBuffer[5*blockSize], msgService.messagePool.first->next->next->next->next->next);
+ EXPECT_EQUAL_PTR("msgService.messagePool.last(2)", &msgBuffer[5*blockSize], msgService.messagePool.last);
+ EXPECT_EQUAL_PTR("msgService.messagePool.last.next", 0, msgService.messagePool.last->next);
+ RUnit_closeTestCase();
}
void testRMessageService_GetPushPopReturn(void){
+ RUnit_openTestCase("testRMessageService_GetPushPopReturn");
+
RMessageService msgService;
int16 max = 6;
int16 blockSize = 32;
@@ -45,7 +49,7 @@ void testRMessageService_GetPushPopReturn(void){
RMessage* msg1 = RMessageService_getMessageBuffer(&msgService, sizeof(RMessage));
RMessage* msg2 = RMessageService_getMessageBuffer(&msgService, sizeof(RMessage));
- EXPECT_EQUAL_INT("msgService.messagePool.size", 4, msgService.messagePool.size);
+ EXPECT_EQUAL_INT16("msgService.messagePool.size", 4, msgService.messagePool.size);
// define content
msg1->address = 11;
@@ -57,28 +61,31 @@ void testRMessageService_GetPushPopReturn(void){
RMessageService_pushMessage(&msgService, msg2);
RMessageService_pushMessage(&msgService, msg1);
- EXPECT_EQUAL_INT("msgService.messageQueue.size", 2, msgService.messageQueue.size);
+ EXPECT_EQUAL_INT16("msgService.messageQueue.size", 2, msgService.messageQueue.size);
// pop messages from queue
RMessage* rcvMsg1 = RMessageService_popMessage(&msgService);
RMessage* rcvMsg2 = RMessageService_popMessage(&msgService);
- EXPECT_EQUAL_INT("msgService.messageQueue.size",0, msgService.messageQueue.size);
+ EXPECT_EQUAL_INT16("msgService.messageQueue.size",0, msgService.messageQueue.size);
- EXPECT_EQUAL_INT("msgService.popMessage", 22, rcvMsg1->address);
- EXPECT_EQUAL_INT("msgService.popMessage", 222, rcvMsg1->evtID);
- EXPECT_EQUAL_INT("msgService.popMessage", 11, rcvMsg2->address);
- EXPECT_EQUAL_INT("msgService.popMessage", 111, rcvMsg2->evtID);
+ EXPECT_EQUAL_INT16("msgService.popMessage", 22, rcvMsg1->address);
+ EXPECT_EQUAL_INT16("msgService.popMessage", 222, rcvMsg1->evtID);
+ EXPECT_EQUAL_INT16("msgService.popMessage", 11, rcvMsg2->address);
+ EXPECT_EQUAL_INT16("msgService.popMessage", 111, rcvMsg2->evtID);
RMessageService_returnMessageBuffer(&msgService, rcvMsg1);
RMessageService_returnMessageBuffer(&msgService, rcvMsg2);
- EXPECT_EQUAL_INT("msgService.messagePool.size", 6, msgService.messagePool.size);
+ EXPECT_EQUAL_INT16("msgService.messagePool.size", 6, msgService.messagePool.size);
+ RUnit_closeTestCase();
}
void testRMessageService_GetReturn(void){
+ RUnit_openTestCase("testRMessageService_GetReturn");
+
RMessageService msgService;
int16 max = 2;
int16 blockSize = 32;
@@ -92,23 +99,24 @@ void testRMessageService_GetReturn(void){
RMessage* msg3 = RMessageService_getMessageBuffer(&msgService, sizeof(RMessage));
EXPECT_TRUE("msgService getMessageBuffer", msg1!=NULL);
EXPECT_TRUE("msgService getMessageBuffer", msg2!=NULL);
- EXPECT_EQUAL_INT("msgService getMessageBuffer", msg3, NULL);
+ EXPECT_EQUAL_PTR("msgService getMessageBuffer", msg3, NULL);
// return messages
RMessageService_returnMessageBuffer(&msgService, msg1);
RMessageService_returnMessageBuffer(&msgService, msg2);
- EXPECT_EQUAL_INT("msgService.messagePool.size", 2, msgService.messagePool.size);
+ EXPECT_EQUAL_INT16("msgService.messagePool.size", 2, msgService.messagePool.size);
// get message bigger than blocksize
RMessage* msg4 = RMessageService_getMessageBuffer(&msgService, 33);
- EXPECT_EQUAL_INT("msgService getMessageBuffer", msg4, NULL);
+ EXPECT_EQUAL_PTR("msgService getMessageBuffer", msg4, NULL);
+ RUnit_closeTestCase();
}
void TestRMessageService_runSuite(void){
- RUnit_open("TestRMessageService");
+ RUnit_openTestSuite("TestRMessageService");
testRMessageService_init();
testRMessageService_GetPushPopReturn();
testRMessageService_GetReturn();
- RUnit_close();
+ RUnit_closeTestSuite();
}
diff --git a/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml
new file mode 100644
index 000000000..26e811bc0
--- /dev/null
+++ b/examples/org.eclipse.etrice.generator.c.reference/tmp/testlog/TestMessageService.xml
@@ -0,0 +1,17 @@
+<testsuites name="TestMessageService" tests="0" failures="0" errors="0" time="0">
+ <testsuite name="testGeneratedDataClass" tests="0" failures="0" errors="0" time="0">
+ <testcase name="testDataClassDeepCopy" time="0"/>
+ </testsuite>
+ <testsuite name="TestMessage" tests="0" failures="0" errors="0" time="0">
+ <testcase name="TestMessage_testBasicMessage" time="0"/>
+ </testsuite>
+ <testsuite name="TestRMessageQueue" tests="0" failures="0" errors="0" time="0">
+ <testcase name="testPushPop" time="0"/>
+ <testcase name="MassiveMessaging" time="0"/>
+ </testsuite>
+ <testsuite name="TestRMessageService" tests="0" failures="0" errors="0" time="0">
+ <testcase name="testRMessageService_init" time="0"/>
+ <testcase name="testRMessageService_GetPushPopReturn" time="0"/>
+ <testcase name="testRMessageService_GetReturn" time="0"/>
+ </testsuite>
+</testsuites>

Back to the top