소스 검색

Generated C tests for StatemachineActive tests

Axel Terfloth 10 년 전
부모
커밋
090c0660a1

+ 41 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/StatechartActive/StatechartActive.cc

@@ -0,0 +1,41 @@
+/**
+* Copyright (c) 2015 committers of YAKINDU and others.
+* 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:
+*     committers of YAKINDU - initial API and implementation
+*/
+#include <string>
+#include "gtest/gtest.h"
+#include "StatechartActive.h"
+
+
+StatechartActive handle;
+
+TEST(StatemachineTest, inactiveBeforeEnter) {
+	statechartActive_init(&handle);
+	EXPECT_TRUE(false);
+}
+TEST(StatemachineTest, activeAfterEnter) {
+	statechartActive_init(&handle);
+	statechartActive_enter(&handle);
+	EXPECT_TRUE(false);
+}
+TEST(StatemachineTest, inactiveAfterExit) {
+	statechartActive_init(&handle);
+	statechartActive_enter(&handle);
+	statechartActive_exit(&handle);
+	EXPECT_TRUE(false);
+}
+TEST(StatemachineTest, activeAfterReenter) {
+	statechartActive_init(&handle);
+	statechartActive_enter(&handle);
+	statechartActive_exit(&handle);
+	statechartActive_enter(&handle);
+	EXPECT_TRUE(false);
+}
+
+		

+ 19 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/StatechartActive/StatechartActive.sgen

@@ -0,0 +1,19 @@
+GeneratorModel for yakindu::c {
+	statechart StatechartActive {
+		feature Outlet {
+			targetProject = "gtests"
+			targetFolder = "StatechartActive"
+		}
+		feature FunctionInlining {
+			inlineReactions = false
+			inlineEntryActions = false
+			inlineEnterSequences = false 
+			inlineExitActions = false
+			inlineExitSequences = false
+			inlineChoices = false
+			inlineEntries = false
+			inlineEnterRegion = false
+			inlineExitRegion = false
+		}
+	}
+}

+ 24 - 0
test-plugins/org.yakindu.sct.generator.c.test/model/test.sgen

@@ -1061,6 +1061,30 @@ GeneratorModel for sctunit::c {
 		}	
 	}
 	
+	test StatechartActive{
+		
+		feature Outlet{ 
+			targetProject = "org.yakindu.sct.generator.c.test" 
+			targetFolder = "test-gen"			
+		}		
+				
+		feature JUnitWrapper {
+			WrapToJUnit =  "true" 
+		}				
+						
+		feature FunctionInlining {
+			inlineReactions = false
+			inlineEntryActions = false
+			inlineExitActions = false
+			inlineEnterSequences = false
+			inlineExitSequences = false
+			inlineChoices = false
+			inlineEnterRegion = false
+			inlineExitRegion = false
+			inlineEntries = false
+		}	
+	}
+			
 	test StateIsActive{
 		
 		feature Outlet{ 

+ 6 - 5
test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/AllTests.java

@@ -29,10 +29,11 @@ import org.junit.runners.Suite.SuiteClasses;
 		NamedInterfaceAccess.class, OutEventLifeCycle.class, Parenthesis.class,
 		PriorityValues.class, RaiseEvent.class, SameNameDifferentRegion.class,
 		ShallowHistory.class, ShallowHistoryWithDeepEntry.class,
-		SimpleEvent.class, StatechartLocalReactions.class,
-		SimpleHierachy.class, StateIsActive.class, StaticChoice.class,
-		STextKeywordsInStatesAndRegions.class, StringExpressions.class,
-		SyncFork.class, SyncJoin.class, TransitionWithoutCondition.class,
-		TriggerGuardExpressions.class, ValuedEvents.class})
+		SimpleEvent.class, SimpleHierachy.class, StatechartActive.class,
+		StatechartLocalReactions.class, StateIsActive.class,
+		StaticChoice.class, STextKeywordsInStatesAndRegions.class,
+		StringExpressions.class, SyncFork.class, SyncJoin.class,
+		TransitionWithoutCondition.class, TriggerGuardExpressions.class,
+		ValuedEvents.class})
 public class AllTests {
 }

+ 39 - 0
test-plugins/org.yakindu.sct.generator.c.test/test-gen/org/yakindu/sct/generator/c/test/StatechartActive.java

@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2015 committers of YAKINDU and others.
+ * 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:
+ *     committers of YAKINDU - initial API and implementation
+ */
+package org.yakindu.sct.generator.c.test;
+
+import java.util.Collection;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.yakindu.sct.generator.c.gtest.GTest;
+import org.yakindu.sct.generator.c.gtest.GTestRunner;
+import org.yakindu.sct.generator.c.gtest.GTestHelper;
+
+@GTest(sourceFile = "gtests/StatechartActive/StatechartActive.cc", program = "gtests/StatechartActive/StatechartActive", model = "testmodels/SCTUnit/StatechartActive.sct")
+@RunWith(GTestRunner.class)
+public class StatechartActive {
+
+	protected final GTestHelper helper = new GTestHelper(this) {
+
+		@Override
+		protected void getSourceFiles(Collection<String> files) {
+			super.getSourceFiles(files);
+			files.add(getFileName(getTestProgram()) + ".c");
+		}
+	};
+
+	@Before
+	public void setUp() {
+		helper.generate();
+		helper.compile();
+	}
+}