diff options
Diffstat (limited to 'examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessage.c')
-rw-r--r-- | examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessage.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessage.c b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessage.c new file mode 100644 index 000000000..a9d7b6aee --- /dev/null +++ b/examples/org.eclipse.etrice.generator.c.reference/src/test/TestEtMessage.c @@ -0,0 +1,48 @@ +/******************************************************************************* + * 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 "TestEtMessage.h" + +#include <stddef.h> +#include "RUnit.h" +#include "RMessage.h" + + + +void TestEtMessage_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_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_INT16("msg1.NextMsg", msg2.evtID, msg1.next->evtID); + EXPECT_EQUAL_INT16("msg2.NextMsg", msg1.evtID, msg2.next->evtID); + + RUnit_closeTestCase(); +} + + +void TestEtMessage_runSuite(void){ + RUnit_openTestSuite("TestMessage"); + TestEtMessage_testBasicMessage(); + RUnit_closeTestSuite(); +} + |