浏览代码

Newly generated the Testmodels for C (#1469)

jthoene 8 年之前
父节点
当前提交
b9b367738b
共有 100 个文件被更改,包括 830 次插入754 次删除
  1. 8 9
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AlwaysOncycleTest/AlwaysOncycle.c
  2. 6 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AlwaysOncycleTest/AlwaysOncycle.h
  3. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AlwaysOncycleTest/AlwaysOncycle.sgen
  4. 41 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AlwaysOncycle/AlwaysOncycleTest.cc
  5. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AlwaysOncycle/sc_types.h
  6. 0 41
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AlwaysOncycleTest/AlwaysOncycleTest.cc
  7. 15 16
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpressionTest/AssignmentAsExpression.c
  8. 13 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpressionTest/AssignmentAsExpression.h
  9. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpressionTest/AssignmentAsExpression.sgen
  10. 57 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpression/AssignmentAsExpressionTest.cc
  11. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpression/sc_types.h
  12. 0 57
      test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpressionTest/AssignmentAsExpressionTest.cc
  13. 8 9
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressionsTest/BitExpressions.c
  14. 6 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressionsTest/BitExpressions.h
  15. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressionsTest/BitExpressions.sgen
  16. 40 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressions/BitExpressionsTest.cc
  17. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressions/sc_types.h
  18. 0 40
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressionsTest/BitExpressionsTest.cc
  19. 8 9
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressionsTest/BooleanExpressions.c
  20. 6 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressionsTest/BooleanExpressions.h
  21. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressionsTest/BooleanExpressions.sgen
  22. 39 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressions/BooleanExpressionsTest.cc
  23. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressions/sc_types.h
  24. 0 39
      test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressionsTest/BooleanExpressionsTest.cc
  25. 12 13
      test-plugins/org.yakindu.sct.generator.c.test/gtests/CKeywordsTest/CKeywords.c
  26. 8 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/CKeywordsTest/CKeywords.h
  27. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/CKeywordsTest/CKeywords.sgen
  28. 9 9
      test-plugins/org.yakindu.sct.generator.c.test/gtests/CKeywordsTest/CKeywordsTest.cc
  29. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/CKeywords/sc_types.h
  30. 9 10
      test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressionsTest/CastExpressions.c
  31. 7 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressionsTest/CastExpressions.h
  32. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressionsTest/CastExpressions.sgen
  33. 10 10
      test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressionsTest/CastExpressionsTest.cc
  34. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressions/sc_types.h
  35. 9 10
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ChoiceTest/Choice.c
  36. 7 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ChoiceTest/Choice.h
  37. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ChoiceTest/Choice.sgen
  38. 81 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/Choice/ChoiceTest.cc
  39. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/Choice/sc_types.h
  40. 0 81
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ChoiceTest/ChoiceTest.cc
  41. 9 9
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConditionalExpression/ConditionalExpression.cc
  42. 8 9
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConditionalExpression/ConditionalExpressions.c
  43. 6 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConditionalExpression/ConditionalExpressions.h
  44. 9 10
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyDefaultScopeTest/ConstOnlyDefaultScope.c
  45. 7 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyDefaultScopeTest/ConstOnlyDefaultScope.h
  46. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyDefaultScopeTest/ConstOnlyDefaultScope.sgen
  47. 8 8
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyDefaultScopeTest/ConstOnlyDefaultScopeTest.cc
  48. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyDefaultScope/sc_types.h
  49. 9 10
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyInternalScopeTest/ConstOnlyInternalScope.c
  50. 7 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyInternalScopeTest/ConstOnlyInternalScope.h
  51. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyInternalScopeTest/ConstOnlyInternalScope.sgen
  52. 8 8
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyInternalScopeTest/ConstOnlyInternalScopeTest.cc
  53. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyInternalScope/sc_types.h
  54. 9 10
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyNamedScopeTest/ConstOnlyNamedScope.c
  55. 7 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyNamedScopeTest/ConstOnlyNamedScope.h
  56. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyNamedScopeTest/ConstOnlyNamedScope.sgen
  57. 8 8
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyNamedScopeTest/ConstOnlyNamedScopeTest.cc
  58. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyNamedScope/sc_types.h
  59. 9 10
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstantsTests/Constants.c
  60. 7 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstantsTests/Constants.h
  61. 18 18
      test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstantsTests/ConstantsTests.cc
  62. 8 9
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeclarationsTest/Declarations.c
  63. 6 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeclarationsTest/Declarations.h
  64. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeclarationsTest/Declarations.sgen
  65. 3 3
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeclarationsTest/DeclarationsTest.cc
  66. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/Declarations/sc_types.h
  67. 21 22
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntryTest/DeepEntry.c
  68. 14 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntryTest/DeepEntry.h
  69. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntryTest/DeepEntry.sgen
  70. 31 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntry/DeepEntryTest.cc
  71. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntry/sc_types.h
  72. 0 44
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntryTest/DeepEntryTest.cc
  73. 18 19
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistoryTest/DeepHistory.c
  74. 13 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistoryTest/DeepHistory.h
  75. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistoryTest/DeepHistory.sgen
  76. 46 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistory/DeepHistoryTest.cc
  77. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistory/sc_types.h
  78. 0 46
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistoryTest/DeepHistoryTest.cc
  79. 9 10
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DynamicChoiceTest/DynamicChoice.c
  80. 7 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DynamicChoiceTest/DynamicChoice.h
  81. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DynamicChoiceTest/DynamicChoice.sgen
  82. 6 6
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DynamicChoiceTest/DynamicChoiceTest.cc
  83. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/DynamicChoice/sc_types.h
  84. 8 9
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EmptyTransitionTest/EmptyTransition.c
  85. 6 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EmptyTransitionTest/EmptyTransition.h
  86. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EmptyTransitionTest/EmptyTransition.sgen
  87. 6 6
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EmptyTransitionTest/EmptyTransitionTest.cc
  88. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EmptyTransition/sc_types.h
  89. 11 12
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterStateTest/EnterState.c
  90. 8 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterStateTest/EnterState.h
  91. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterStateTest/EnterState.sgen
  92. 46 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterState/EnterStateTest.cc
  93. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterState/sc_types.h
  94. 0 46
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterStateTest/EnterStateTest.cc
  95. 7 8
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryChoiceTest/EntryChoice.c
  96. 5 2
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryChoiceTest/EntryChoice.h
  97. 1 1
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryChoiceTest/EntryChoice.sgen
  98. 6 6
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryChoiceTest/EntryChoiceTest.cc
  99. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryChoice/sc_types.h
  100. 0 0
      test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryExitSelfTransitionTest/EntryExitSelfTransition.c

+ 8 - 9
test-plugins/org.yakindu.sct.generator.c.test/gtests/AlwaysOncycleTest/AlwaysOncycle.c

@@ -65,15 +65,14 @@ void alwaysOncycle_exit(AlwaysOncycle* handle)
 
 sc_boolean alwaysOncycle_isActive(const AlwaysOncycle* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != AlwaysOncycle_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < ALWAYSONCYCLE_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != AlwaysOncycle_last_state;
 	}
+	
 	return result;
 }
 
@@ -130,11 +129,11 @@ sc_boolean alwaysOncycle_isStateActive(const AlwaysOncycle* handle, AlwaysOncycl
 	switch (state)
 	{
 		case AlwaysOncycle_main_region_StateA :
-			result = (sc_boolean) (handle->stateConfVector[0] == AlwaysOncycle_main_region_StateA
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ALWAYSONCYCLE_MAIN_REGION_STATEA] == AlwaysOncycle_main_region_StateA
 			);
 			break;
 		case AlwaysOncycle_main_region_StateB :
-			result = (sc_boolean) (handle->stateConfVector[0] == AlwaysOncycle_main_region_StateB
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ALWAYSONCYCLE_MAIN_REGION_STATEB] == AlwaysOncycle_main_region_StateB
 			);
 			break;
 		default:

+ 6 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/AlwaysOncycleTest/AlwaysOncycle.h

@@ -14,9 +14,9 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	AlwaysOncycle_last_state,
 	AlwaysOncycle_main_region_StateA,
-	AlwaysOncycle_main_region_StateB,
-	AlwaysOncycle_last_state
+	AlwaysOncycle_main_region_StateB
 } AlwaysOncycleStates;
 
 /*! Type definition of the data structure for the AlwaysOncycleIface interface scope. */
@@ -30,6 +30,10 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define ALWAYSONCYCLE_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_ALWAYSONCYCLE_MAIN_REGION_STATEA 0
+#define SCVI_ALWAYSONCYCLE_MAIN_REGION_STATEB 0
+
 /*! 
  * Type definition of the data structure for the AlwaysOncycle state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/AlwaysOncycleTest/AlwaysOncycle.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart AlwaysOncycle {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "AlwaysOncycleTest"
+			targetFolder = "AlwaysOncycle"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

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

@@ -0,0 +1,41 @@
+/**
+* Copyright (c) 2017 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 "gtest/gtest.h"
+#include "AlwaysOncycle.h"
+
+static AlwaysOncycle statechart;
+
+class StatemachineTest : public ::testing::Test{
+	protected:
+	virtual void SetUp() {
+		alwaysOncycle_init(&statechart);
+	}
+};
+
+
+TEST_F(StatemachineTest, alwaysOnCycleTest) {					
+	alwaysOncycle_enter(&statechart);
+	EXPECT_TRUE(alwaysOncycle_isStateActive(&statechart, AlwaysOncycle_main_region_StateA));
+	while (alwaysOncycleIface_get_value(&statechart)< 5l) {
+		alwaysOncycle_runCycle(&statechart);
+		EXPECT_TRUE(alwaysOncycle_isStateActive(&statechart, AlwaysOncycle_main_region_StateA));
+	}
+	alwaysOncycle_runCycle(&statechart);
+	EXPECT_TRUE(alwaysOncycle_isStateActive(&statechart, AlwaysOncycle_main_region_StateB));
+	while (alwaysOncycleIface_get_value(&statechart)< 5l) {
+		alwaysOncycle_runCycle(&statechart);
+		EXPECT_TRUE(alwaysOncycle_isStateActive(&statechart, AlwaysOncycle_main_region_StateB));
+	}
+	alwaysOncycle_runCycle(&statechart);
+	EXPECT_TRUE(alwaysOncycle_isStateActive(&statechart, AlwaysOncycle_main_region_StateA));
+}
+
+

test-plugins/org.yakindu.sct.generator.c.test/gtests/AlwaysOncycleTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/AlwaysOncycle/sc_types.h


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

@@ -1,41 +0,0 @@
-/**
-* Copyright (c) 2017 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 "gtest/gtest.h"
-#include "AlwaysOncycle.h"
-
-AlwaysOncycle handle;
-
-class StatemachineTest : public ::testing::Test{
-	protected:
-	virtual void SetUp() {
-		alwaysOncycle_init(&handle);
-	}
-};
-
-
-TEST_F(StatemachineTest, alwaysOncycleTest) {					
-	alwaysOncycle_enter(&handle);
-	EXPECT_TRUE(alwaysOncycle_isStateActive(&handle, AlwaysOncycle_main_region_StateA));
-	while (alwaysOncycleIface_get_value(&handle)< 5l) {
-		alwaysOncycle_runCycle(&handle);
-		EXPECT_TRUE(alwaysOncycle_isStateActive(&handle, AlwaysOncycle_main_region_StateA));
-	}
-	alwaysOncycle_runCycle(&handle);
-	EXPECT_TRUE(alwaysOncycle_isStateActive(&handle, AlwaysOncycle_main_region_StateB));
-	while (alwaysOncycleIface_get_value(&handle)< 5l) {
-		alwaysOncycle_runCycle(&handle);
-		EXPECT_TRUE(alwaysOncycle_isStateActive(&handle, AlwaysOncycle_main_region_StateB));
-	}
-	alwaysOncycle_runCycle(&handle);
-	EXPECT_TRUE(alwaysOncycle_isStateActive(&handle, AlwaysOncycle_main_region_StateA));
-}
-
-

+ 15 - 16
test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpressionTest/AssignmentAsExpression.c

@@ -122,15 +122,14 @@ void assignmentAsExpression_exit(AssignmentAsExpression* handle)
 
 sc_boolean assignmentAsExpression_isActive(const AssignmentAsExpression* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != AssignmentAsExpression_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < ASSIGNMENTASEXPRESSION_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != AssignmentAsExpression_last_state;
 	}
+	
 	return result;
 }
 
@@ -222,39 +221,39 @@ sc_boolean assignmentAsExpression_isStateActive(const AssignmentAsExpression* ha
 	switch (state)
 	{
 		case AssignmentAsExpression_main_region_Add :
-			result = (sc_boolean) (handle->stateConfVector[0] == AssignmentAsExpression_main_region_Add
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_ADD] == AssignmentAsExpression_main_region_Add
 			);
 			break;
 		case AssignmentAsExpression_main_region_Multiply :
-			result = (sc_boolean) (handle->stateConfVector[0] == AssignmentAsExpression_main_region_Multiply
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_MULTIPLY] == AssignmentAsExpression_main_region_Multiply
 			);
 			break;
 		case AssignmentAsExpression_main_region_Divide :
-			result = (sc_boolean) (handle->stateConfVector[0] == AssignmentAsExpression_main_region_Divide
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_DIVIDE] == AssignmentAsExpression_main_region_Divide
 			);
 			break;
 		case AssignmentAsExpression_main_region_Modulo :
-			result = (sc_boolean) (handle->stateConfVector[0] == AssignmentAsExpression_main_region_Modulo
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_MODULO] == AssignmentAsExpression_main_region_Modulo
 			);
 			break;
 		case AssignmentAsExpression_main_region_Shift :
-			result = (sc_boolean) (handle->stateConfVector[0] == AssignmentAsExpression_main_region_Shift
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_SHIFT] == AssignmentAsExpression_main_region_Shift
 			);
 			break;
 		case AssignmentAsExpression_main_region_boolean_And :
-			result = (sc_boolean) (handle->stateConfVector[0] == AssignmentAsExpression_main_region_boolean_And
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_BOOLEAN_AND] == AssignmentAsExpression_main_region_boolean_And
 			);
 			break;
 		case AssignmentAsExpression_main_region_boolean_Or :
-			result = (sc_boolean) (handle->stateConfVector[0] == AssignmentAsExpression_main_region_boolean_Or
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_BOOLEAN_OR] == AssignmentAsExpression_main_region_boolean_Or
 			);
 			break;
 		case AssignmentAsExpression_main_region_boolean_Xor :
-			result = (sc_boolean) (handle->stateConfVector[0] == AssignmentAsExpression_main_region_boolean_Xor
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_BOOLEAN_XOR] == AssignmentAsExpression_main_region_boolean_Xor
 			);
 			break;
 		case AssignmentAsExpression_main_region_Subtract :
-			result = (sc_boolean) (handle->stateConfVector[0] == AssignmentAsExpression_main_region_Subtract
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_SUBTRACT] == AssignmentAsExpression_main_region_Subtract
 			);
 			break;
 		default:

+ 13 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpressionTest/AssignmentAsExpression.h

@@ -14,6 +14,7 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	AssignmentAsExpression_last_state,
 	AssignmentAsExpression_main_region_Add,
 	AssignmentAsExpression_main_region_Multiply,
 	AssignmentAsExpression_main_region_Divide,
@@ -22,8 +23,7 @@ typedef enum
 	AssignmentAsExpression_main_region_boolean_And,
 	AssignmentAsExpression_main_region_boolean_Or,
 	AssignmentAsExpression_main_region_boolean_Xor,
-	AssignmentAsExpression_main_region_Subtract,
-	AssignmentAsExpression_last_state
+	AssignmentAsExpression_main_region_Subtract
 } AssignmentAsExpressionStates;
 
 /*! Type definition of the data structure for the AssignmentAsExpressionIface interface scope. */
@@ -58,6 +58,17 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define ASSIGNMENTASEXPRESSION_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_ADD 0
+#define SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_MULTIPLY 0
+#define SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_DIVIDE 0
+#define SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_MODULO 0
+#define SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_SHIFT 0
+#define SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_BOOLEAN_AND 0
+#define SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_BOOLEAN_OR 0
+#define SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_BOOLEAN_XOR 0
+#define SCVI_ASSIGNMENTASEXPRESSION_MAIN_REGION_SUBTRACT 0
+
 /*! 
  * Type definition of the data structure for the AssignmentAsExpression state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpressionTest/AssignmentAsExpression.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart AssignmentAsExpression {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "AssignmentAsExpressionTest"
+			targetFolder = "AssignmentAsExpression"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 57 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpression/AssignmentAsExpressionTest.cc

@@ -0,0 +1,57 @@
+/**
+* Copyright (c) 2017 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 "gtest/gtest.h"
+#include "AssignmentAsExpression.h"
+
+static AssignmentAsExpression statechart;
+
+class StatemachineTest : public ::testing::Test{
+	protected:
+	virtual void SetUp() {
+		assignmentAsExpression_init(&statechart);
+	}
+};
+
+
+TEST_F(StatemachineTest, simpleAssignment) {					
+	assignmentAsExpression_enter(&statechart);
+	EXPECT_TRUE(assignmentAsExpression_isStateActive(&statechart, AssignmentAsExpression_main_region_Add));
+	EXPECT_TRUE(assignmentAsExpressionIface_get_b(&statechart)== 5l);
+	EXPECT_TRUE(assignmentAsExpressionIface_get_a(&statechart)== 9l);
+	assignmentAsExpression_runCycle(&statechart);
+	EXPECT_TRUE(assignmentAsExpression_isStateActive(&statechart, AssignmentAsExpression_main_region_Subtract));
+	EXPECT_TRUE(assignmentAsExpressionIface_get_d(&statechart)== 6l);
+	assignmentAsExpression_runCycle(&statechart);
+	EXPECT_TRUE(assignmentAsExpression_isStateActive(&statechart, AssignmentAsExpression_main_region_Multiply));
+	EXPECT_TRUE(assignmentAsExpressionIface_get_e(&statechart)== 15l);
+	assignmentAsExpression_runCycle(&statechart);
+	EXPECT_TRUE(assignmentAsExpression_isStateActive(&statechart, AssignmentAsExpression_main_region_Divide));
+	EXPECT_TRUE(assignmentAsExpressionIface_get_g(&statechart)== 1l);
+	assignmentAsExpression_runCycle(&statechart);
+	EXPECT_TRUE(assignmentAsExpression_isStateActive(&statechart, AssignmentAsExpression_main_region_Modulo));
+	EXPECT_TRUE(assignmentAsExpressionIface_get_i(&statechart)== 1l);
+	assignmentAsExpression_runCycle(&statechart);
+	EXPECT_TRUE(assignmentAsExpression_isStateActive(&statechart, AssignmentAsExpression_main_region_Shift));
+	EXPECT_TRUE(assignmentAsExpressionIface_get_j(&statechart)== 16l);
+	EXPECT_TRUE(assignmentAsExpressionIface_get_k(&statechart)== 4l);
+	assignmentAsExpression_runCycle(&statechart);
+	EXPECT_TRUE(assignmentAsExpression_isStateActive(&statechart, AssignmentAsExpression_main_region_boolean_And));
+	EXPECT_TRUE(assignmentAsExpressionIface_get_l(&statechart)== 1l);
+	assignmentAsExpression_runCycle(&statechart);
+	EXPECT_TRUE(assignmentAsExpression_isStateActive(&statechart, AssignmentAsExpression_main_region_boolean_Or));
+	EXPECT_TRUE(assignmentAsExpressionIface_get_p(&statechart)== 15l);
+	assignmentAsExpression_runCycle(&statechart);
+	EXPECT_TRUE(assignmentAsExpression_isStateActive(&statechart, AssignmentAsExpression_main_region_boolean_Xor));
+	EXPECT_TRUE(assignmentAsExpressionIface_get_u(&statechart)== 12l);
+	assignmentAsExpression_exit(&statechart);
+}
+
+

test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpressionTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpression/sc_types.h


+ 0 - 57
test-plugins/org.yakindu.sct.generator.c.test/gtests/AssignmentAsExpressionTest/AssignmentAsExpressionTest.cc

@@ -1,57 +0,0 @@
-/**
-* Copyright (c) 2017 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 "gtest/gtest.h"
-#include "AssignmentAsExpression.h"
-
-AssignmentAsExpression handle;
-
-class StatemachineTest : public ::testing::Test{
-	protected:
-	virtual void SetUp() {
-		assignmentAsExpression_init(&handle);
-	}
-};
-
-
-TEST_F(StatemachineTest, simpleAssignment) {					
-	assignmentAsExpression_enter(&handle);
-	EXPECT_TRUE(assignmentAsExpression_isStateActive(&handle, AssignmentAsExpression_main_region_Add));
-	EXPECT_TRUE(assignmentAsExpressionIface_get_b(&handle)== 5l);
-	EXPECT_TRUE(assignmentAsExpressionIface_get_a(&handle)== 9l);
-	assignmentAsExpression_runCycle(&handle);
-	EXPECT_TRUE(assignmentAsExpression_isStateActive(&handle, AssignmentAsExpression_main_region_Subtract));
-	EXPECT_TRUE(assignmentAsExpressionIface_get_d(&handle)== 6l);
-	assignmentAsExpression_runCycle(&handle);
-	EXPECT_TRUE(assignmentAsExpression_isStateActive(&handle, AssignmentAsExpression_main_region_Multiply));
-	EXPECT_TRUE(assignmentAsExpressionIface_get_e(&handle)== 15l);
-	assignmentAsExpression_runCycle(&handle);
-	EXPECT_TRUE(assignmentAsExpression_isStateActive(&handle, AssignmentAsExpression_main_region_Divide));
-	EXPECT_TRUE(assignmentAsExpressionIface_get_g(&handle)== 1l);
-	assignmentAsExpression_runCycle(&handle);
-	EXPECT_TRUE(assignmentAsExpression_isStateActive(&handle, AssignmentAsExpression_main_region_Modulo));
-	EXPECT_TRUE(assignmentAsExpressionIface_get_i(&handle)== 1l);
-	assignmentAsExpression_runCycle(&handle);
-	EXPECT_TRUE(assignmentAsExpression_isStateActive(&handle, AssignmentAsExpression_main_region_Shift));
-	EXPECT_TRUE(assignmentAsExpressionIface_get_j(&handle)== 16l);
-	EXPECT_TRUE(assignmentAsExpressionIface_get_k(&handle)== 4l);
-	assignmentAsExpression_runCycle(&handle);
-	EXPECT_TRUE(assignmentAsExpression_isStateActive(&handle, AssignmentAsExpression_main_region_boolean_And));
-	EXPECT_TRUE(assignmentAsExpressionIface_get_l(&handle)== 1l);
-	assignmentAsExpression_runCycle(&handle);
-	EXPECT_TRUE(assignmentAsExpression_isStateActive(&handle, AssignmentAsExpression_main_region_boolean_Or));
-	EXPECT_TRUE(assignmentAsExpressionIface_get_p(&handle)== 15l);
-	assignmentAsExpression_runCycle(&handle);
-	EXPECT_TRUE(assignmentAsExpression_isStateActive(&handle, AssignmentAsExpression_main_region_boolean_Xor));
-	EXPECT_TRUE(assignmentAsExpressionIface_get_u(&handle)== 12l);
-	assignmentAsExpression_exit(&handle);
-}
-
-

+ 8 - 9
test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressionsTest/BitExpressions.c

@@ -65,15 +65,14 @@ void bitExpressions_exit(BitExpressions* handle)
 
 sc_boolean bitExpressions_isActive(const BitExpressions* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != BitExpressions_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < BITEXPRESSIONS_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != BitExpressions_last_state;
 	}
+	
 	return result;
 }
 
@@ -131,11 +130,11 @@ sc_boolean bitExpressions_isStateActive(const BitExpressions* handle, BitExpress
 	switch (state)
 	{
 		case BitExpressions_main_region_StateA :
-			result = (sc_boolean) (handle->stateConfVector[0] == BitExpressions_main_region_StateA
+			result = (sc_boolean) (handle->stateConfVector[SCVI_BITEXPRESSIONS_MAIN_REGION_STATEA] == BitExpressions_main_region_StateA
 			);
 			break;
 		case BitExpressions_main_region_StateB :
-			result = (sc_boolean) (handle->stateConfVector[0] == BitExpressions_main_region_StateB
+			result = (sc_boolean) (handle->stateConfVector[SCVI_BITEXPRESSIONS_MAIN_REGION_STATEB] == BitExpressions_main_region_StateB
 			);
 			break;
 		default:

+ 6 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressionsTest/BitExpressions.h

@@ -14,9 +14,9 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	BitExpressions_last_state,
 	BitExpressions_main_region_StateA,
-	BitExpressions_main_region_StateB,
-	BitExpressions_last_state
+	BitExpressions_main_region_StateB
 } BitExpressionsStates;
 
 /*! Type definition of the data structure for the BitExpressionsIface interface scope. */
@@ -37,6 +37,10 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define BITEXPRESSIONS_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_BITEXPRESSIONS_MAIN_REGION_STATEA 0
+#define SCVI_BITEXPRESSIONS_MAIN_REGION_STATEB 0
+
 /*! 
  * Type definition of the data structure for the BitExpressions state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressionsTest/BitExpressions.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart BitExpressions {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "BitExpressionsTest"
+			targetFolder = "BitExpressions"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 40 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressions/BitExpressionsTest.cc

@@ -0,0 +1,40 @@
+/**
+* Copyright (c) 2017 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 "gtest/gtest.h"
+#include "BitExpressions.h"
+
+static BitExpressions statechart;
+
+class StatemachineTest : public ::testing::Test{
+	protected:
+	virtual void SetUp() {
+		bitExpressions_init(&statechart);
+	}
+};
+
+
+TEST_F(StatemachineTest, BitExpressions) {					
+	bitExpressions_enter(&statechart);
+	EXPECT_TRUE(bitExpressions_isStateActive(&statechart, BitExpressions_main_region_StateA));
+	EXPECT_TRUE(bitExpressionsIface_get_myBit1(&statechart)== 5l);
+	EXPECT_TRUE(bitExpressionsIface_get_myBit2(&statechart)== 7l);
+	bitExpressionsIface_raise_e1(&statechart);
+	bitExpressions_runCycle(&statechart);
+	EXPECT_TRUE(bitExpressions_isStateActive(&statechart, BitExpressions_main_region_StateB));
+	EXPECT_TRUE(bitExpressionsIface_get_leftBitshift(&statechart)== 10l);
+	EXPECT_TRUE(bitExpressionsIface_get_rightBitshift(&statechart)== 2l);
+	EXPECT_TRUE(bitExpressionsIface_get_complementBitshift(&statechart)== - 6l );
+	EXPECT_TRUE(bitExpressionsIface_get_bitwiseAnd(&statechart)== 5l);
+	EXPECT_TRUE(bitExpressionsIface_get_bitwiseOr(&statechart)== 7l);
+	EXPECT_TRUE(bitExpressionsIface_get_bitwiseXor(&statechart)== 2l);
+}
+
+

test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressionsTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressions/sc_types.h


+ 0 - 40
test-plugins/org.yakindu.sct.generator.c.test/gtests/BitExpressionsTest/BitExpressionsTest.cc

@@ -1,40 +0,0 @@
-/**
-* Copyright (c) 2017 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 "gtest/gtest.h"
-#include "BitExpressions.h"
-
-BitExpressions handle;
-
-class StatemachineTest : public ::testing::Test{
-	protected:
-	virtual void SetUp() {
-		bitExpressions_init(&handle);
-	}
-};
-
-
-TEST_F(StatemachineTest, BitExpressions) {					
-	bitExpressions_enter(&handle);
-	EXPECT_TRUE(bitExpressions_isStateActive(&handle, BitExpressions_main_region_StateA));
-	EXPECT_TRUE(bitExpressionsIface_get_myBit1(&handle)== 5l);
-	EXPECT_TRUE(bitExpressionsIface_get_myBit2(&handle)== 7l);
-	bitExpressionsIface_raise_e1(&handle);
-	bitExpressions_runCycle(&handle);
-	EXPECT_TRUE(bitExpressions_isStateActive(&handle, BitExpressions_main_region_StateB));
-	EXPECT_TRUE(bitExpressionsIface_get_leftBitshift(&handle)== 10l);
-	EXPECT_TRUE(bitExpressionsIface_get_rightBitshift(&handle)== 2l);
-	EXPECT_TRUE(bitExpressionsIface_get_complementBitshift(&handle)== - 6l );
-	EXPECT_TRUE(bitExpressionsIface_get_bitwiseAnd(&handle)== 5l);
-	EXPECT_TRUE(bitExpressionsIface_get_bitwiseOr(&handle)== 7l);
-	EXPECT_TRUE(bitExpressionsIface_get_bitwiseXor(&handle)== 2l);
-}
-
-

+ 8 - 9
test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressionsTest/BooleanExpressions.c

@@ -64,15 +64,14 @@ void booleanExpressions_exit(BooleanExpressions* handle)
 
 sc_boolean booleanExpressions_isActive(const BooleanExpressions* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != BooleanExpressions_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < BOOLEANEXPRESSIONS_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != BooleanExpressions_last_state;
 	}
+	
 	return result;
 }
 
@@ -130,11 +129,11 @@ sc_boolean booleanExpressions_isStateActive(const BooleanExpressions* handle, Bo
 	switch (state)
 	{
 		case BooleanExpressions_main_region_StateA :
-			result = (sc_boolean) (handle->stateConfVector[0] == BooleanExpressions_main_region_StateA
+			result = (sc_boolean) (handle->stateConfVector[SCVI_BOOLEANEXPRESSIONS_MAIN_REGION_STATEA] == BooleanExpressions_main_region_StateA
 			);
 			break;
 		case BooleanExpressions_main_region_StateB :
-			result = (sc_boolean) (handle->stateConfVector[0] == BooleanExpressions_main_region_StateB
+			result = (sc_boolean) (handle->stateConfVector[SCVI_BOOLEANEXPRESSIONS_MAIN_REGION_STATEB] == BooleanExpressions_main_region_StateB
 			);
 			break;
 		default:

+ 6 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressionsTest/BooleanExpressions.h

@@ -14,9 +14,9 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	BooleanExpressions_last_state,
 	BooleanExpressions_main_region_StateA,
-	BooleanExpressions_main_region_StateB,
-	BooleanExpressions_last_state
+	BooleanExpressions_main_region_StateB
 } BooleanExpressionsStates;
 
 /*! Type definition of the data structure for the BooleanExpressionsIface interface scope. */
@@ -36,6 +36,10 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define BOOLEANEXPRESSIONS_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_BOOLEANEXPRESSIONS_MAIN_REGION_STATEA 0
+#define SCVI_BOOLEANEXPRESSIONS_MAIN_REGION_STATEB 0
+
 /*! 
  * Type definition of the data structure for the BooleanExpressions state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressionsTest/BooleanExpressions.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart BooleanExpressions {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "BooleanExpressionsTest"
+			targetFolder = "BooleanExpressions"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 39 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressions/BooleanExpressionsTest.cc

@@ -0,0 +1,39 @@
+/**
+* Copyright (c) 2017 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 "gtest/gtest.h"
+#include "BooleanExpressions.h"
+
+static BooleanExpressions statechart;
+
+class StatemachineTest : public ::testing::Test{
+	protected:
+	virtual void SetUp() {
+		booleanExpressions_init(&statechart);
+	}
+};
+
+
+TEST_F(StatemachineTest, booleanExpressions) {					
+	booleanExpressions_enter(&statechart);
+	EXPECT_TRUE(booleanExpressions_isStateActive(&statechart, BooleanExpressions_main_region_StateA));
+	EXPECT_TRUE(booleanExpressionsIface_get_myBool1(&statechart)== true);
+	EXPECT_TRUE(booleanExpressionsIface_get_myBool2(&statechart)== false);
+	booleanExpressionsIface_raise_e1(&statechart);
+	booleanExpressions_runCycle(&statechart);
+	EXPECT_TRUE(booleanExpressions_isStateActive(&statechart, BooleanExpressions_main_region_StateB));
+	EXPECT_TRUE(booleanExpressionsIface_get_and(&statechart)== false);
+	EXPECT_TRUE(booleanExpressionsIface_get_or(&statechart)== true);
+	EXPECT_TRUE(booleanExpressionsIface_get_not(&statechart)== false);
+	EXPECT_TRUE(booleanExpressionsIface_get_equal(&statechart)== false);
+	EXPECT_TRUE(booleanExpressionsIface_get_notequal(&statechart)== true);
+}
+
+

test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressionsTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressions/sc_types.h


+ 0 - 39
test-plugins/org.yakindu.sct.generator.c.test/gtests/BooleanExpressionsTest/BooleanExpressionsTest.cc

@@ -1,39 +0,0 @@
-/**
-* Copyright (c) 2017 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 "gtest/gtest.h"
-#include "BooleanExpressions.h"
-
-BooleanExpressions handle;
-
-class StatemachineTest : public ::testing::Test{
-	protected:
-	virtual void SetUp() {
-		booleanExpressions_init(&handle);
-	}
-};
-
-
-TEST_F(StatemachineTest, booleanExpressions) {					
-	booleanExpressions_enter(&handle);
-	EXPECT_TRUE(booleanExpressions_isStateActive(&handle, BooleanExpressions_main_region_StateA));
-	EXPECT_TRUE(booleanExpressionsIface_get_myBool1(&handle)== true);
-	EXPECT_TRUE(booleanExpressionsIface_get_myBool2(&handle)== false);
-	booleanExpressionsIface_raise_e1(&handle);
-	booleanExpressions_runCycle(&handle);
-	EXPECT_TRUE(booleanExpressions_isStateActive(&handle, BooleanExpressions_main_region_StateB));
-	EXPECT_TRUE(booleanExpressionsIface_get_and(&handle)== false);
-	EXPECT_TRUE(booleanExpressionsIface_get_or(&handle)== true);
-	EXPECT_TRUE(booleanExpressionsIface_get_not(&handle)== false);
-	EXPECT_TRUE(booleanExpressionsIface_get_equal(&handle)== false);
-	EXPECT_TRUE(booleanExpressionsIface_get_notequal(&handle)== true);
-}
-
-

+ 12 - 13
test-plugins/org.yakindu.sct.generator.c.test/gtests/CKeywordsTest/CKeywords.c

@@ -97,15 +97,14 @@ void cKeywords_exit(CKeywords* handle)
 
 sc_boolean cKeywords_isActive(const CKeywords* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != CKeywords_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < CKEYWORDS_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != CKeywords_last_state;
 	}
+	
 	return result;
 }
 
@@ -164,19 +163,19 @@ sc_boolean cKeywords_isStateActive(const CKeywords* handle, CKeywordsStates stat
 	switch (state)
 	{
 		case CKeywords_auto_char :
-			result = (sc_boolean) (handle->stateConfVector[0] == CKeywords_auto_char
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CKEYWORDS_AUTO_CHAR] == CKeywords_auto_char
 			);
 			break;
 		case CKeywords_auto_loop :
-			result = (sc_boolean) (handle->stateConfVector[0] >= CKeywords_auto_loop
-				&& handle->stateConfVector[0] <= CKeywords_auto_loop_switch_case_enum_asm);
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CKEYWORDS_AUTO_LOOP] >= CKeywords_auto_loop
+				&& handle->stateConfVector[SCVI_CKEYWORDS_AUTO_LOOP] <= CKeywords_auto_loop_switch_case_enum_asm);
 			break;
 		case CKeywords_auto_loop_switch_case :
-			result = (sc_boolean) (handle->stateConfVector[0] >= CKeywords_auto_loop_switch_case
-				&& handle->stateConfVector[0] <= CKeywords_auto_loop_switch_case_enum_asm);
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CKEYWORDS_AUTO_LOOP_SWITCH_CASE] >= CKeywords_auto_loop_switch_case
+				&& handle->stateConfVector[SCVI_CKEYWORDS_AUTO_LOOP_SWITCH_CASE] <= CKeywords_auto_loop_switch_case_enum_asm);
 			break;
 		case CKeywords_auto_loop_switch_case_enum_asm :
-			result = (sc_boolean) (handle->stateConfVector[0] == CKeywords_auto_loop_switch_case_enum_asm
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CKEYWORDS_AUTO_LOOP_SWITCH_CASE_ENUM_ASM] == CKeywords_auto_loop_switch_case_enum_asm
 			);
 			break;
 		default:

+ 8 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/CKeywordsTest/CKeywords.h

@@ -14,11 +14,11 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	CKeywords_last_state,
 	CKeywords_auto_char,
 	CKeywords_auto_loop,
 	CKeywords_auto_loop_switch_case,
-	CKeywords_auto_loop_switch_case_enum_asm,
-	CKeywords_last_state
+	CKeywords_auto_loop_switch_case_enum_asm
 } CKeywordsStates;
 
 /*! Type definition of the data structure for the CKeywordsIface interface scope. */
@@ -60,6 +60,12 @@ typedef struct
 	/*! Define dimension of the state configuration vector for history states. */
 #define CKEYWORDS_MAX_HISTORY_STATES 2
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_CKEYWORDS_AUTO_CHAR 0
+#define SCVI_CKEYWORDS_AUTO_LOOP 0
+#define SCVI_CKEYWORDS_AUTO_LOOP_SWITCH_CASE 0
+#define SCVI_CKEYWORDS_AUTO_LOOP_SWITCH_CASE_ENUM_ASM 0
+
 /*! 
  * Type definition of the data structure for the CKeywords state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/CKeywordsTest/CKeywords.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart CKeywords {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "CKeywordsTest"
+			targetFolder = "CKeywords"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 9 - 9
test-plugins/org.yakindu.sct.generator.c.test/gtests/CKeywordsTest/CKeywordsTest.cc

@@ -11,24 +11,24 @@
 #include "gtest/gtest.h"
 #include "CKeywords.h"
 
-CKeywords handle;
+static CKeywords statechart;
 
 class StatemachineTest : public ::testing::Test{
 	protected:
 	virtual void SetUp() {
-		cKeywords_init(&handle);
+		cKeywords_init(&statechart);
 	}
 };
 
 
 TEST_F(StatemachineTest, CKeywordsTest) {					
-	cKeywords_enter(&handle);
-	EXPECT_TRUE(cKeywords_isStateActive(&handle, CKeywords_auto_char));
-	cKeywordsIface_raise_auto(&handle);
-	cKeywords_runCycle(&handle);
-	EXPECT_TRUE(cKeywords_isStateActive(&handle, CKeywords_auto_loop));
-	EXPECT_TRUE(cKeywords_isStateActive(&handle, CKeywords_auto_loop_switch_case));
-	EXPECT_TRUE(cKeywords_isStateActive(&handle, CKeywords_auto_loop_switch_case_enum_asm));
+	cKeywords_enter(&statechart);
+	EXPECT_TRUE(cKeywords_isStateActive(&statechart, CKeywords_auto_char));
+	cKeywordsIface_raise_auto(&statechart);
+	cKeywords_runCycle(&statechart);
+	EXPECT_TRUE(cKeywords_isStateActive(&statechart, CKeywords_auto_loop));
+	EXPECT_TRUE(cKeywords_isStateActive(&statechart, CKeywords_auto_loop_switch_case));
+	EXPECT_TRUE(cKeywords_isStateActive(&statechart, CKeywords_auto_loop_switch_case_enum_asm));
 }
 
 

test-plugins/org.yakindu.sct.generator.c.test/gtests/CKeywordsTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/CKeywords/sc_types.h


+ 9 - 10
test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressionsTest/CastExpressions.c

@@ -64,15 +64,14 @@ void castExpressions_exit(CastExpressions* handle)
 
 sc_boolean castExpressions_isActive(const CastExpressions* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != CastExpressions_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < CASTEXPRESSIONS_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != CastExpressions_last_state;
 	}
+	
 	return result;
 }
 
@@ -134,15 +133,15 @@ sc_boolean castExpressions_isStateActive(const CastExpressions* handle, CastExpr
 	switch (state)
 	{
 		case CastExpressions_main_region_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == CastExpressions_main_region_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CASTEXPRESSIONS_MAIN_REGION_A] == CastExpressions_main_region_A
 			);
 			break;
 		case CastExpressions_main_region_B :
-			result = (sc_boolean) (handle->stateConfVector[0] == CastExpressions_main_region_B
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CASTEXPRESSIONS_MAIN_REGION_B] == CastExpressions_main_region_B
 			);
 			break;
 		case CastExpressions_main_region_C :
-			result = (sc_boolean) (handle->stateConfVector[0] == CastExpressions_main_region_C
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CASTEXPRESSIONS_MAIN_REGION_C] == CastExpressions_main_region_C
 			);
 			break;
 		default:

+ 7 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressionsTest/CastExpressions.h

@@ -14,10 +14,10 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	CastExpressions_last_state,
 	CastExpressions_main_region_A,
 	CastExpressions_main_region_B,
-	CastExpressions_main_region_C,
-	CastExpressions_last_state
+	CastExpressions_main_region_C
 } CastExpressionsStates;
 
 /*! Type definition of the data structure for the CastExpressionsIface interface scope. */
@@ -31,6 +31,11 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define CASTEXPRESSIONS_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_CASTEXPRESSIONS_MAIN_REGION_A 0
+#define SCVI_CASTEXPRESSIONS_MAIN_REGION_B 0
+#define SCVI_CASTEXPRESSIONS_MAIN_REGION_C 0
+
 /*! 
  * Type definition of the data structure for the CastExpressions state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressionsTest/CastExpressions.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart CastExpressions {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "CastExpressionsTest"
+			targetFolder = "CastExpressions"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 10 - 10
test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressionsTest/CastExpressionsTest.cc

@@ -11,25 +11,25 @@
 #include "gtest/gtest.h"
 #include "CastExpressions.h"
 
-CastExpressions handle;
+static CastExpressions statechart;
 
 class StatemachineTest : public ::testing::Test{
 	protected:
 	virtual void SetUp() {
-		castExpressions_init(&handle);
+		castExpressions_init(&statechart);
 	}
 };
 
 
 TEST_F(StatemachineTest, CastExpressionTest) {					
-	castExpressions_enter(&handle);
-	EXPECT_TRUE(castExpressionsIface_get_realValue(&handle)== 5l);
-	EXPECT_TRUE(castExpressionsIface_get_intValue(&handle)== 5l);
-	castExpressions_runCycle(&handle);
-	EXPECT_TRUE(castExpressionsIface_get_realValue(&handle)== 15l);
-	castExpressions_runCycle(&handle);
-	EXPECT_TRUE(castExpressions_isStateActive(&handle, CastExpressions_main_region_C));
-	EXPECT_TRUE(castExpressionsIface_get_realValue(&handle)== 757l);
+	castExpressions_enter(&statechart);
+	EXPECT_TRUE(castExpressionsIface_get_realValue(&statechart)== 5l);
+	EXPECT_TRUE(castExpressionsIface_get_intValue(&statechart)== 5l);
+	castExpressions_runCycle(&statechart);
+	EXPECT_TRUE(castExpressionsIface_get_realValue(&statechart)== 15l);
+	castExpressions_runCycle(&statechart);
+	EXPECT_TRUE(castExpressions_isStateActive(&statechart, CastExpressions_main_region_C));
+	EXPECT_TRUE(castExpressionsIface_get_realValue(&statechart)== 757l);
 }
 
 

test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressionsTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/CastExpressions/sc_types.h


+ 9 - 10
test-plugins/org.yakindu.sct.generator.c.test/gtests/ChoiceTest/Choice.c

@@ -89,15 +89,14 @@ void choice_exit(Choice* handle)
 
 sc_boolean choice_isActive(const Choice* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != Choice_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < CHOICE_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != Choice_last_state;
 	}
+	
 	return result;
 }
 
@@ -163,15 +162,15 @@ sc_boolean choice_isStateActive(const Choice* handle, ChoiceStates state)
 	switch (state)
 	{
 		case Choice_main_region_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == Choice_main_region_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CHOICE_MAIN_REGION_A] == Choice_main_region_A
 			);
 			break;
 		case Choice_main_region_B :
-			result = (sc_boolean) (handle->stateConfVector[0] == Choice_main_region_B
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CHOICE_MAIN_REGION_B] == Choice_main_region_B
 			);
 			break;
 		case Choice_main_region_C :
-			result = (sc_boolean) (handle->stateConfVector[0] == Choice_main_region_C
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CHOICE_MAIN_REGION_C] == Choice_main_region_C
 			);
 			break;
 		default:

+ 7 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/ChoiceTest/Choice.h

@@ -14,10 +14,10 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	Choice_last_state,
 	Choice_main_region_A,
 	Choice_main_region_B,
-	Choice_main_region_C,
-	Choice_last_state
+	Choice_main_region_C
 } ChoiceStates;
 
 /*! Type definition of the data structure for the ChoiceIface interface scope. */
@@ -34,6 +34,11 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define CHOICE_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_CHOICE_MAIN_REGION_A 0
+#define SCVI_CHOICE_MAIN_REGION_B 0
+#define SCVI_CHOICE_MAIN_REGION_C 0
+
 /*! 
  * Type definition of the data structure for the Choice state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/ChoiceTest/Choice.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart Choice {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "ChoiceTest"
+			targetFolder = "Choice"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 81 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/Choice/ChoiceTest.cc

@@ -0,0 +1,81 @@
+/**
+* Copyright (c) 2017 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 "gtest/gtest.h"
+#include "Choice.h"
+
+static Choice statechart;
+
+class StatemachineTest : public ::testing::Test{
+	protected:
+	virtual void SetUp() {
+		choice_init(&statechart);
+	}
+};
+
+void initForEventE(bool valueForC){
+	choice_enter(&statechart);
+	EXPECT_TRUE(choice_isStateActive(&statechart, Choice_main_region_A));
+	choiceIface_set_c(&statechart,valueForC);
+	choiceIface_raise_e(&statechart);
+	choice_runCycle(&statechart);
+}
+void initForEventF(bool valueForC){
+	choice_enter(&statechart);
+	EXPECT_TRUE(choice_isStateActive(&statechart, Choice_main_region_A));
+	choiceIface_set_c(&statechart,valueForC);
+	choiceIface_raise_f(&statechart);
+	choice_runCycle(&statechart);
+}
+void initForEventG(bool valueForC){
+	choice_enter(&statechart);
+	EXPECT_TRUE(choice_isStateActive(&statechart, Choice_main_region_A));
+	choiceIface_set_c(&statechart,valueForC);
+	choiceIface_raise_g(&statechart);
+	choice_runCycle(&statechart);
+}
+void initForEventH(bool valueForC){
+	choice_enter(&statechart);
+	EXPECT_TRUE(choice_isStateActive(&statechart, Choice_main_region_A));
+	choiceIface_set_c(&statechart,valueForC);
+	choiceIface_raise_h(&statechart);
+	choice_runCycle(&statechart);
+}
+
+TEST_F(StatemachineTest, elseChoiceUsingNonDefaultTransition) {					
+	initForEventE(true);
+	EXPECT_TRUE(choice_isStateActive(&statechart, Choice_main_region_C));
+}
+TEST_F(StatemachineTest, elseChoiceUsingDefaultTransition) {					
+	initForEventE(false);
+	EXPECT_TRUE(choice_isStateActive(&statechart, Choice_main_region_B));
+}
+TEST_F(StatemachineTest, defaultChoiceUsingNonDefaultTransition) {					
+	initForEventG(true);
+	EXPECT_TRUE(choice_isStateActive(&statechart, Choice_main_region_C));
+}
+TEST_F(StatemachineTest, defaultChoiceUsingDefaultTransition) {					
+	initForEventG(false);
+	EXPECT_TRUE(choice_isStateActive(&statechart, Choice_main_region_B));
+}
+TEST_F(StatemachineTest, uncheckedChoiceUsingNonDefaultTransition) {					
+	initForEventF(true);
+	EXPECT_TRUE(choice_isStateActive(&statechart, Choice_main_region_C));
+}
+TEST_F(StatemachineTest, uncheckedChoiceUsingDefaultTransition) {					
+	initForEventF(false);
+	EXPECT_TRUE(choice_isStateActive(&statechart, Choice_main_region_B));
+}
+TEST_F(StatemachineTest, alwaysTrueTransitionInChoice) {					
+	initForEventH(true);
+	EXPECT_TRUE(choice_isStateActive(&statechart, Choice_main_region_C));
+}
+
+

test-plugins/org.yakindu.sct.generator.c.test/gtests/ChoiceTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/Choice/sc_types.h


+ 0 - 81
test-plugins/org.yakindu.sct.generator.c.test/gtests/ChoiceTest/ChoiceTest.cc

@@ -1,81 +0,0 @@
-/**
-* Copyright (c) 2017 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 "gtest/gtest.h"
-#include "Choice.h"
-
-Choice handle;
-
-class StatemachineTest : public ::testing::Test{
-	protected:
-	virtual void SetUp() {
-		choice_init(&handle);
-	}
-};
-
-void initForEventE(bool valueForC){
-	choice_enter(&handle);
-	EXPECT_TRUE(choice_isStateActive(&handle, Choice_main_region_A));
-	choiceIface_set_c(&handle,valueForC);
-	choiceIface_raise_e(&handle);
-	choice_runCycle(&handle);
-}
-void initForEventF(bool valueForC){
-	choice_enter(&handle);
-	EXPECT_TRUE(choice_isStateActive(&handle, Choice_main_region_A));
-	choiceIface_set_c(&handle,valueForC);
-	choiceIface_raise_f(&handle);
-	choice_runCycle(&handle);
-}
-void initForEventG(bool valueForC){
-	choice_enter(&handle);
-	EXPECT_TRUE(choice_isStateActive(&handle, Choice_main_region_A));
-	choiceIface_set_c(&handle,valueForC);
-	choiceIface_raise_g(&handle);
-	choice_runCycle(&handle);
-}
-void initForEventH(bool valueForC){
-	choice_enter(&handle);
-	EXPECT_TRUE(choice_isStateActive(&handle, Choice_main_region_A));
-	choiceIface_set_c(&handle,valueForC);
-	choiceIface_raise_h(&handle);
-	choice_runCycle(&handle);
-}
-
-TEST_F(StatemachineTest, elseChoiceUsingNonDefaultTransition) {					
-	initForEventE(true);
-	EXPECT_TRUE(choice_isStateActive(&handle, Choice_main_region_C));
-}
-TEST_F(StatemachineTest, elseChoiceUsingDefaultTransition) {					
-	initForEventE(false);
-	EXPECT_TRUE(choice_isStateActive(&handle, Choice_main_region_B));
-}
-TEST_F(StatemachineTest, defaultChoiceUsingNonDefaultTransition) {					
-	initForEventG(true);
-	EXPECT_TRUE(choice_isStateActive(&handle, Choice_main_region_C));
-}
-TEST_F(StatemachineTest, defaultChoiceUsingDefaultTransition) {					
-	initForEventG(false);
-	EXPECT_TRUE(choice_isStateActive(&handle, Choice_main_region_B));
-}
-TEST_F(StatemachineTest, uncheckedChoiceUsingNonDefaultTransition) {					
-	initForEventF(true);
-	EXPECT_TRUE(choice_isStateActive(&handle, Choice_main_region_C));
-}
-TEST_F(StatemachineTest, uncheckedChoiceUsingDefaultTransition) {					
-	initForEventF(false);
-	EXPECT_TRUE(choice_isStateActive(&handle, Choice_main_region_B));
-}
-TEST_F(StatemachineTest, alwaysTrueTransitionInChoice) {					
-	initForEventH(true);
-	EXPECT_TRUE(choice_isStateActive(&handle, Choice_main_region_C));
-}
-
-

+ 9 - 9
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConditionalExpression/ConditionalExpression.cc

@@ -11,24 +11,24 @@
 #include "gtest/gtest.h"
 #include "ConditionalExpressions.h"
 
-ConditionalExpressions handle;
+static ConditionalExpressions statechart;
 
 class StatemachineTest : public ::testing::Test{
 	protected:
 	virtual void SetUp() {
-		conditionalExpressions_init(&handle);
+		conditionalExpressions_init(&statechart);
 	}
 };
 
 
 TEST_F(StatemachineTest, ConditionalExpressionTest) {					
-	conditionalExpressions_enter(&handle);
-	EXPECT_TRUE(conditionalExpressions_isStateActive(&handle, ConditionalExpressions_main_region_A));
-	EXPECT_TRUE(conditionalExpressionsIface_get_condition(&handle)== 1l);
-	conditionalExpressionsIface_raise_e(&handle);
-	conditionalExpressions_runCycle(&handle);
-	EXPECT_TRUE(conditionalExpressions_isStateActive(&handle, ConditionalExpressions_main_region_B));
-	EXPECT_TRUE(conditionalExpressionsIface_get_condition(&handle)== 2l);
+	conditionalExpressions_enter(&statechart);
+	EXPECT_TRUE(conditionalExpressions_isStateActive(&statechart, ConditionalExpressions_main_region_A));
+	EXPECT_TRUE(conditionalExpressionsIface_get_condition(&statechart)== 1l);
+	conditionalExpressionsIface_raise_e(&statechart);
+	conditionalExpressions_runCycle(&statechart);
+	EXPECT_TRUE(conditionalExpressions_isStateActive(&statechart, ConditionalExpressions_main_region_B));
+	EXPECT_TRUE(conditionalExpressionsIface_get_condition(&statechart)== 2l);
 }
 
 

+ 8 - 9
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConditionalExpression/ConditionalExpressions.c

@@ -59,15 +59,14 @@ void conditionalExpressions_exit(ConditionalExpressions* handle)
 
 sc_boolean conditionalExpressions_isActive(const ConditionalExpressions* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != ConditionalExpressions_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < CONDITIONALEXPRESSIONS_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != ConditionalExpressions_last_state;
 	}
+	
 	return result;
 }
 
@@ -125,11 +124,11 @@ sc_boolean conditionalExpressions_isStateActive(const ConditionalExpressions* ha
 	switch (state)
 	{
 		case ConditionalExpressions_main_region_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == ConditionalExpressions_main_region_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONDITIONALEXPRESSIONS_MAIN_REGION_A] == ConditionalExpressions_main_region_A
 			);
 			break;
 		case ConditionalExpressions_main_region_B :
-			result = (sc_boolean) (handle->stateConfVector[0] == ConditionalExpressions_main_region_B
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONDITIONALEXPRESSIONS_MAIN_REGION_B] == ConditionalExpressions_main_region_B
 			);
 			break;
 		default:

+ 6 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConditionalExpression/ConditionalExpressions.h

@@ -14,9 +14,9 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	ConditionalExpressions_last_state,
 	ConditionalExpressions_main_region_A,
-	ConditionalExpressions_main_region_B,
-	ConditionalExpressions_last_state
+	ConditionalExpressions_main_region_B
 } ConditionalExpressionsStates;
 
 /*! Type definition of the data structure for the ConditionalExpressionsIface interface scope. */
@@ -31,6 +31,10 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define CONDITIONALEXPRESSIONS_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_CONDITIONALEXPRESSIONS_MAIN_REGION_A 0
+#define SCVI_CONDITIONALEXPRESSIONS_MAIN_REGION_B 0
+
 /*! 
  * Type definition of the data structure for the ConditionalExpressions state machine.
  * This data structure has to be allocated by the client code. 

+ 9 - 10
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyDefaultScopeTest/ConstOnlyDefaultScope.c

@@ -61,15 +61,14 @@ void constOnlyDefaultScope_exit(ConstOnlyDefaultScope* handle)
 
 sc_boolean constOnlyDefaultScope_isActive(const ConstOnlyDefaultScope* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != ConstOnlyDefaultScope_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < CONSTONLYDEFAULTSCOPE_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != ConstOnlyDefaultScope_last_state;
 	}
+	
 	return result;
 }
 
@@ -132,15 +131,15 @@ sc_boolean constOnlyDefaultScope_isStateActive(const ConstOnlyDefaultScope* hand
 	switch (state)
 	{
 		case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPE_MAIN_REGION_A] == ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_A
 			);
 			break;
 		case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_B :
-			result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_B
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPE_MAIN_REGION_B] == ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_B
 			);
 			break;
 		case ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_C :
-			result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_C
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPE_MAIN_REGION_C] == ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_C
 			);
 			break;
 		default:

+ 7 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyDefaultScopeTest/ConstOnlyDefaultScope.h

@@ -14,10 +14,10 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	ConstOnlyDefaultScope_last_state,
 	ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_A,
 	ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_B,
-	ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_C,
-	ConstOnlyDefaultScope_last_state
+	ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_C
 } ConstOnlyDefaultScopeStates;
 
 /* Declaration of constants for scope ConstOnlyDefaultScopeIface. */
@@ -35,6 +35,11 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define CONSTONLYDEFAULTSCOPE_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPE_MAIN_REGION_A 0
+#define SCVI_CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPE_MAIN_REGION_B 0
+#define SCVI_CONSTONLYDEFAULTSCOPE_CONSTONLYDEFAULTSCOPE_MAIN_REGION_C 0
+
 /*! 
  * Type definition of the data structure for the ConstOnlyDefaultScope state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyDefaultScopeTest/ConstOnlyDefaultScope.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart declarations.ConstOnlyDefaultScope {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "ConstOnlyDefaultScopeTest"
+			targetFolder = "ConstOnlyDefaultScope"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 8 - 8
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyDefaultScopeTest/ConstOnlyDefaultScopeTest.cc

@@ -11,25 +11,25 @@
 #include "gtest/gtest.h"
 #include "ConstOnlyDefaultScope.h"
 
-ConstOnlyDefaultScope handle;
+static ConstOnlyDefaultScope statechart;
 
 class StatemachineTest : public ::testing::Test{
 	protected:
 	virtual void SetUp() {
-		constOnlyDefaultScope_init(&handle);
+		constOnlyDefaultScope_init(&statechart);
 	}
 };
 
 
 TEST_F(StatemachineTest, statechartEntry) {					
-	constOnlyDefaultScope_enter(&handle);
-	EXPECT_TRUE(constOnlyDefaultScope_isStateActive(&handle, ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_A));
+	constOnlyDefaultScope_enter(&statechart);
+	EXPECT_TRUE(constOnlyDefaultScope_isStateActive(&statechart, ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_A));
 }
 TEST_F(StatemachineTest, stateTransition) {					
-	constOnlyDefaultScope_enter(&handle);
-	constOnlyDefaultScopeIfaceA_raise_e(&handle, 1l);
-	constOnlyDefaultScope_runCycle(&handle);
-	EXPECT_TRUE(constOnlyDefaultScope_isStateActive(&handle, ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_B));
+	constOnlyDefaultScope_enter(&statechart);
+	constOnlyDefaultScopeIfaceA_raise_e(&statechart, 1l);
+	constOnlyDefaultScope_runCycle(&statechart);
+	EXPECT_TRUE(constOnlyDefaultScope_isStateActive(&statechart, ConstOnlyDefaultScope_ConstOnlyDefaultScope_main_region_B));
 }
 
 

test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyDefaultScopeTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyDefaultScope/sc_types.h


+ 9 - 10
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyInternalScopeTest/ConstOnlyInternalScope.c

@@ -61,15 +61,14 @@ void constOnlyInternalScope_exit(ConstOnlyInternalScope* handle)
 
 sc_boolean constOnlyInternalScope_isActive(const ConstOnlyInternalScope* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != ConstOnlyInternalScope_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < CONSTONLYINTERNALSCOPE_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != ConstOnlyInternalScope_last_state;
 	}
+	
 	return result;
 }
 
@@ -132,15 +131,15 @@ sc_boolean constOnlyInternalScope_isStateActive(const ConstOnlyInternalScope* ha
 	switch (state)
 	{
 		case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPE_MAIN_REGION_A] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A
 			);
 			break;
 		case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B :
-			result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPE_MAIN_REGION_B] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B
 			);
 			break;
 		case ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C :
-			result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPE_MAIN_REGION_C] == ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C
 			);
 			break;
 		default:

+ 7 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyInternalScopeTest/ConstOnlyInternalScope.h

@@ -14,10 +14,10 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	ConstOnlyInternalScope_last_state,
 	ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A,
 	ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B,
-	ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C,
-	ConstOnlyInternalScope_last_state
+	ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_C
 } ConstOnlyInternalScopeStates;
 
 /*! Type definition of the data structure for the ConstOnlyInternalScopeIface interface scope. */
@@ -31,6 +31,11 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define CONSTONLYINTERNALSCOPE_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPE_MAIN_REGION_A 0
+#define SCVI_CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPE_MAIN_REGION_B 0
+#define SCVI_CONSTONLYINTERNALSCOPE_CONSTONLYINTERNALSCOPE_MAIN_REGION_C 0
+
 /*! 
  * Type definition of the data structure for the ConstOnlyInternalScope state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyInternalScopeTest/ConstOnlyInternalScope.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart declarations.ConstOnlyInternalScope {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "ConstOnlyInternalScopeTest"
+			targetFolder = "ConstOnlyInternalScope"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 8 - 8
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyInternalScopeTest/ConstOnlyInternalScopeTest.cc

@@ -11,25 +11,25 @@
 #include "gtest/gtest.h"
 #include "ConstOnlyInternalScope.h"
 
-ConstOnlyInternalScope handle;
+static ConstOnlyInternalScope statechart;
 
 class StatemachineTest : public ::testing::Test{
 	protected:
 	virtual void SetUp() {
-		constOnlyInternalScope_init(&handle);
+		constOnlyInternalScope_init(&statechart);
 	}
 };
 
 
 TEST_F(StatemachineTest, statechartEntry) {					
-	constOnlyInternalScope_enter(&handle);
-	EXPECT_TRUE(constOnlyInternalScope_isStateActive(&handle, ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A));
+	constOnlyInternalScope_enter(&statechart);
+	EXPECT_TRUE(constOnlyInternalScope_isStateActive(&statechart, ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_A));
 }
 TEST_F(StatemachineTest, stateTransition) {					
-	constOnlyInternalScope_enter(&handle);
-	constOnlyInternalScopeIface_raise_e(&handle, 1l);
-	constOnlyInternalScope_runCycle(&handle);
-	EXPECT_TRUE(constOnlyInternalScope_isStateActive(&handle, ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B));
+	constOnlyInternalScope_enter(&statechart);
+	constOnlyInternalScopeIface_raise_e(&statechart, 1l);
+	constOnlyInternalScope_runCycle(&statechart);
+	EXPECT_TRUE(constOnlyInternalScope_isStateActive(&statechart, ConstOnlyInternalScope_ConstOnlyInternalScope_main_region_B));
 }
 
 

test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyInternalScopeTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyInternalScope/sc_types.h


+ 9 - 10
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyNamedScopeTest/ConstOnlyNamedScope.c

@@ -61,15 +61,14 @@ void constOnlyNamedScope_exit(ConstOnlyNamedScope* handle)
 
 sc_boolean constOnlyNamedScope_isActive(const ConstOnlyNamedScope* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != ConstOnlyNamedScope_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < CONSTONLYNAMEDSCOPE_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != ConstOnlyNamedScope_last_state;
 	}
+	
 	return result;
 }
 
@@ -132,15 +131,15 @@ sc_boolean constOnlyNamedScope_isStateActive(const ConstOnlyNamedScope* handle,
 	switch (state)
 	{
 		case ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYNAMEDSCOPE_CONSTONLYNAMEDSCOPE_MAIN_REGION_A] == ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_A
 			);
 			break;
 		case ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_B :
-			result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_B
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYNAMEDSCOPE_CONSTONLYNAMEDSCOPE_MAIN_REGION_B] == ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_B
 			);
 			break;
 		case ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_C :
-			result = (sc_boolean) (handle->stateConfVector[0] == ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_C
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTONLYNAMEDSCOPE_CONSTONLYNAMEDSCOPE_MAIN_REGION_C] == ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_C
 			);
 			break;
 		default:

+ 7 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyNamedScopeTest/ConstOnlyNamedScope.h

@@ -14,10 +14,10 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	ConstOnlyNamedScope_last_state,
 	ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_A,
 	ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_B,
-	ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_C,
-	ConstOnlyNamedScope_last_state
+	ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_C
 } ConstOnlyNamedScopeStates;
 
 /*! Type definition of the data structure for the ConstOnlyNamedScopeIface interface scope. */
@@ -35,6 +35,11 @@ extern const sc_integer CONSTONLYNAMEDSCOPE_CONSTONLYNAMEDSCOPEIFACEA_C;
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define CONSTONLYNAMEDSCOPE_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_CONSTONLYNAMEDSCOPE_CONSTONLYNAMEDSCOPE_MAIN_REGION_A 0
+#define SCVI_CONSTONLYNAMEDSCOPE_CONSTONLYNAMEDSCOPE_MAIN_REGION_B 0
+#define SCVI_CONSTONLYNAMEDSCOPE_CONSTONLYNAMEDSCOPE_MAIN_REGION_C 0
+
 /*! 
  * Type definition of the data structure for the ConstOnlyNamedScope state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyNamedScopeTest/ConstOnlyNamedScope.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart declarations.ConstOnlyNamedScope {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "ConstOnlyNamedScopeTest"
+			targetFolder = "ConstOnlyNamedScope"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 8 - 8
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyNamedScopeTest/ConstOnlyNamedScopeTest.cc

@@ -11,25 +11,25 @@
 #include "gtest/gtest.h"
 #include "ConstOnlyNamedScope.h"
 
-ConstOnlyNamedScope handle;
+static ConstOnlyNamedScope statechart;
 
 class StatemachineTest : public ::testing::Test{
 	protected:
 	virtual void SetUp() {
-		constOnlyNamedScope_init(&handle);
+		constOnlyNamedScope_init(&statechart);
 	}
 };
 
 
 TEST_F(StatemachineTest, statechartEntry) {					
-	constOnlyNamedScope_enter(&handle);
-	EXPECT_TRUE(constOnlyNamedScope_isStateActive(&handle, ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_A));
+	constOnlyNamedScope_enter(&statechart);
+	EXPECT_TRUE(constOnlyNamedScope_isStateActive(&statechart, ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_A));
 }
 TEST_F(StatemachineTest, stateTransition) {					
-	constOnlyNamedScope_enter(&handle);
-	constOnlyNamedScopeIface_raise_e(&handle, 1l);
-	constOnlyNamedScope_runCycle(&handle);
-	EXPECT_TRUE(constOnlyNamedScope_isStateActive(&handle, ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_B));
+	constOnlyNamedScope_enter(&statechart);
+	constOnlyNamedScopeIface_raise_e(&statechart, 1l);
+	constOnlyNamedScope_runCycle(&statechart);
+	EXPECT_TRUE(constOnlyNamedScope_isStateActive(&statechart, ConstOnlyNamedScope_ConstOnlyNamedScope_main_region_B));
 }
 
 

test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyNamedScopeTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstOnlyNamedScope/sc_types.h


+ 9 - 10
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstantsTests/Constants.c

@@ -70,15 +70,14 @@ void constants_exit(Constants* handle)
 
 sc_boolean constants_isActive(const Constants* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != Constants_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < CONSTANTS_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != Constants_last_state;
 	}
+	
 	return result;
 }
 
@@ -142,15 +141,15 @@ sc_boolean constants_isStateActive(const Constants* handle, ConstantsStates stat
 	switch (state)
 	{
 		case Constants_main_region_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == Constants_main_region_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTANTS_MAIN_REGION_A] == Constants_main_region_A
 			);
 			break;
 		case Constants_main_region_B :
-			result = (sc_boolean) (handle->stateConfVector[0] == Constants_main_region_B
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTANTS_MAIN_REGION_B] == Constants_main_region_B
 			);
 			break;
 		case Constants_main_region_C :
-			result = (sc_boolean) (handle->stateConfVector[0] == Constants_main_region_C
+			result = (sc_boolean) (handle->stateConfVector[SCVI_CONSTANTS_MAIN_REGION_C] == Constants_main_region_C
 			);
 			break;
 		default:

+ 7 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstantsTests/Constants.h

@@ -14,10 +14,10 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	Constants_last_state,
 	Constants_main_region_A,
 	Constants_main_region_B,
-	Constants_main_region_C,
-	Constants_last_state
+	Constants_main_region_C
 } ConstantsStates;
 
 /*! Type definition of the data structure for the ConstantsIface interface scope. */
@@ -41,6 +41,11 @@ extern const sc_integer CONSTANTS_CONSTANTSIFACENAMED_TWO;
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define CONSTANTS_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_CONSTANTS_MAIN_REGION_A 0
+#define SCVI_CONSTANTS_MAIN_REGION_B 0
+#define SCVI_CONSTANTS_MAIN_REGION_C 0
+
 /*! 
  * Type definition of the data structure for the Constants state machine.
  * This data structure has to be allocated by the client code. 

+ 18 - 18
test-plugins/org.yakindu.sct.generator.c.test/gtests/ConstantsTests/ConstantsTests.cc

@@ -11,33 +11,33 @@
 #include "gtest/gtest.h"
 #include "Constants.h"
 
-Constants handle;
+static Constants statechart;
 
 class StatemachineTest : public ::testing::Test{
 	protected:
 	virtual void SetUp() {
-		constants_init(&handle);
+		constants_init(&statechart);
 	}
 };
 
 
 TEST_F(StatemachineTest, constantDefinition) {					
-	constants_enter(&handle);
-	EXPECT_TRUE(constants_isStateActive(&handle, Constants_main_region_A));
-	EXPECT_TRUE(constantsIface_get_x(&handle)== 10l);
-	EXPECT_TRUE(constantsIface_get_y(&handle)== 20l);
-	EXPECT_TRUE(strcmp(constantsIfaceNamed_get_y(&handle) , "Hello World") == 0);
-	constantsIface_raise_e(&handle);
-	constants_runCycle(&handle);
-	EXPECT_TRUE(constantsIface_get_result(&handle)== 20l);
-	constantsIface_raise_e(&handle);
-	constants_runCycle(&handle);
-	EXPECT_TRUE(constants_isStateActive(&handle, Constants_main_region_C));
-	EXPECT_TRUE(constantsIface_get_result(&handle)== 100l);
-	constantsIface_raise_e2(&handle, constantsIface_get_x(&handle));
-	constants_runCycle(&handle);
-	EXPECT_TRUE(constantsIface_get_result(&handle)== 1000l);
-	EXPECT_TRUE(constants_isStateActive(&handle, Constants_main_region_A));
+	constants_enter(&statechart);
+	EXPECT_TRUE(constants_isStateActive(&statechart, Constants_main_region_A));
+	EXPECT_TRUE(constantsIface_get_x(&statechart)== 10l);
+	EXPECT_TRUE(constantsIface_get_y(&statechart)== 20l);
+	EXPECT_TRUE(strcmp(constantsIfaceNamed_get_y(&statechart) , "Hello World") == 0);
+	constantsIface_raise_e(&statechart);
+	constants_runCycle(&statechart);
+	EXPECT_TRUE(constantsIface_get_result(&statechart)== 20l);
+	constantsIface_raise_e(&statechart);
+	constants_runCycle(&statechart);
+	EXPECT_TRUE(constants_isStateActive(&statechart, Constants_main_region_C));
+	EXPECT_TRUE(constantsIface_get_result(&statechart)== 100l);
+	constantsIface_raise_e2(&statechart, constantsIface_get_x(&statechart));
+	constants_runCycle(&statechart);
+	EXPECT_TRUE(constantsIface_get_result(&statechart)== 1000l);
+	EXPECT_TRUE(constants_isStateActive(&statechart, Constants_main_region_A));
 }
 
 

+ 8 - 9
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeclarationsTest/Declarations.c

@@ -81,15 +81,14 @@ void declarations_exit(Declarations* handle)
 
 sc_boolean declarations_isActive(const Declarations* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != Declarations_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < DECLARATIONS_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != Declarations_last_state;
 	}
+	
 	return result;
 }
 
@@ -164,11 +163,11 @@ sc_boolean declarations_isStateActive(const Declarations* handle, DeclarationsSt
 	switch (state)
 	{
 		case Declarations_main_region_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == Declarations_main_region_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DECLARATIONS_MAIN_REGION_A] == Declarations_main_region_A
 			);
 			break;
 		case Declarations_main_region_B :
-			result = (sc_boolean) (handle->stateConfVector[0] == Declarations_main_region_B
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DECLARATIONS_MAIN_REGION_B] == Declarations_main_region_B
 			);
 			break;
 		default:

+ 6 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeclarationsTest/Declarations.h

@@ -14,9 +14,9 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	Declarations_last_state,
 	Declarations_main_region_A,
-	Declarations_main_region_B,
-	Declarations_last_state
+	Declarations_main_region_B
 } DeclarationsStates;
 
 /*! Type definition of the data structure for the DeclarationsIface interface scope. */
@@ -83,6 +83,10 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define DECLARATIONS_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_DECLARATIONS_MAIN_REGION_A 0
+#define SCVI_DECLARATIONS_MAIN_REGION_B 0
+
 /*! 
  * Type definition of the data structure for the Declarations state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeclarationsTest/Declarations.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart Declarations {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "DeclarationsTest"
+			targetFolder = "Declarations"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 3 - 3
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeclarationsTest/DeclarationsTest.cc

@@ -11,18 +11,18 @@
 #include "gtest/gtest.h"
 #include "Declarations.h"
 
-Declarations handle;
+static Declarations statechart;
 
 class StatemachineTest : public ::testing::Test{
 	protected:
 	virtual void SetUp() {
-		declarations_init(&handle);
+		declarations_init(&statechart);
 	}
 };
 
 
 TEST_F(StatemachineTest, declarationsTest) {					
-	declarations_enter(&handle);
+	declarations_enter(&statechart);
 }
 
 

test-plugins/org.yakindu.sct.generator.c.test/gtests/DeclarationsTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/Declarations/sc_types.h


+ 21 - 22
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntryTest/DeepEntry.c

@@ -106,15 +106,14 @@ void deepEntry_exit(DeepEntry* handle)
 
 sc_boolean deepEntry_isActive(const DeepEntry* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != DeepEntry_last_state || handle->stateConfVector[1] != DeepEntry_last_state || handle->stateConfVector[2] != DeepEntry_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < DEEPENTRY_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != DeepEntry_last_state;
 	}
+	
 	return result;
 }
 
@@ -188,43 +187,43 @@ sc_boolean deepEntry_isStateActive(const DeepEntry* handle, DeepEntryStates stat
 	switch (state)
 	{
 		case DeepEntry_r_A :
-			result = (sc_boolean) (handle->stateConfVector[0] >= DeepEntry_r_A
-				&& handle->stateConfVector[0] <= DeepEntry_r_A_r_B);
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPENTRY_R_A] >= DeepEntry_r_A
+				&& handle->stateConfVector[SCVI_DEEPENTRY_R_A] <= DeepEntry_r_A_r_B);
 			break;
 		case DeepEntry_r_A_r_B :
-			result = (sc_boolean) (handle->stateConfVector[0] == DeepEntry_r_A_r_B
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPENTRY_R_A_R_B] == DeepEntry_r_A_r_B
 			);
 			break;
 		case DeepEntry_r2_B :
-			result = (sc_boolean) (handle->stateConfVector[1] >= DeepEntry_r2_B
-				&& handle->stateConfVector[1] <= DeepEntry_r2_B_r_BB);
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPENTRY_R2_B] >= DeepEntry_r2_B
+				&& handle->stateConfVector[SCVI_DEEPENTRY_R2_B] <= DeepEntry_r2_B_r_BB);
 			break;
 		case DeepEntry_r2_B_r_BA :
-			result = (sc_boolean) (handle->stateConfVector[1] >= DeepEntry_r2_B_r_BA
-				&& handle->stateConfVector[1] <= DeepEntry_r2_B_r_BA_r_BAA);
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPENTRY_R2_B_R_BA] >= DeepEntry_r2_B_r_BA
+				&& handle->stateConfVector[SCVI_DEEPENTRY_R2_B_R_BA] <= DeepEntry_r2_B_r_BA_r_BAA);
 			break;
 		case DeepEntry_r2_B_r_BA_r_BAA :
-			result = (sc_boolean) (handle->stateConfVector[1] == DeepEntry_r2_B_r_BA_r_BAA
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPENTRY_R2_B_R_BA_R_BAA] == DeepEntry_r2_B_r_BA_r_BAA
 			);
 			break;
 		case DeepEntry_r2_B_r_BB :
-			result = (sc_boolean) (handle->stateConfVector[1] == DeepEntry_r2_B_r_BB
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPENTRY_R2_B_R_BB] == DeepEntry_r2_B_r_BB
 			);
 			break;
 		case DeepEntry_r2_C :
-			result = (sc_boolean) (handle->stateConfVector[1] == DeepEntry_r2_C
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPENTRY_R2_C] == DeepEntry_r2_C
 			);
 			break;
 		case DeepEntry_r3_D :
-			result = (sc_boolean) (handle->stateConfVector[2] >= DeepEntry_r3_D
-				&& handle->stateConfVector[2] <= DeepEntry_r3_D_r_DA_r_DAA);
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPENTRY_R3_D] >= DeepEntry_r3_D
+				&& handle->stateConfVector[SCVI_DEEPENTRY_R3_D] <= DeepEntry_r3_D_r_DA_r_DAA);
 			break;
 		case DeepEntry_r3_D_r_DA :
-			result = (sc_boolean) (handle->stateConfVector[2] >= DeepEntry_r3_D_r_DA
-				&& handle->stateConfVector[2] <= DeepEntry_r3_D_r_DA_r_DAA);
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPENTRY_R3_D_R_DA] >= DeepEntry_r3_D_r_DA
+				&& handle->stateConfVector[SCVI_DEEPENTRY_R3_D_R_DA] <= DeepEntry_r3_D_r_DA_r_DAA);
 			break;
 		case DeepEntry_r3_D_r_DA_r_DAA :
-			result = (sc_boolean) (handle->stateConfVector[2] == DeepEntry_r3_D_r_DA_r_DAA
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPENTRY_R3_D_R_DA_R_DAA] == DeepEntry_r3_D_r_DA_r_DAA
 			);
 			break;
 		default:

+ 14 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntryTest/DeepEntry.h

@@ -14,6 +14,7 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	DeepEntry_last_state,
 	DeepEntry_r_A,
 	DeepEntry_r_A_r_B,
 	DeepEntry_r2_B,
@@ -23,8 +24,7 @@ typedef enum
 	DeepEntry_r2_C,
 	DeepEntry_r3_D,
 	DeepEntry_r3_D_r_DA,
-	DeepEntry_r3_D_r_DA_r_DAA,
-	DeepEntry_last_state
+	DeepEntry_r3_D_r_DA_r_DAA
 } DeepEntryStates;
 
 /*! Type definition of the data structure for the DeepEntryIface interface scope. */
@@ -43,6 +43,18 @@ typedef struct
 	/*! Define dimension of the state configuration vector for history states. */
 #define DEEPENTRY_MAX_HISTORY_STATES 4
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_DEEPENTRY_R_A 0
+#define SCVI_DEEPENTRY_R_A_R_B 0
+#define SCVI_DEEPENTRY_R2_B 1
+#define SCVI_DEEPENTRY_R2_B_R_BA 1
+#define SCVI_DEEPENTRY_R2_B_R_BA_R_BAA 1
+#define SCVI_DEEPENTRY_R2_B_R_BB 1
+#define SCVI_DEEPENTRY_R2_C 1
+#define SCVI_DEEPENTRY_R3_D 2
+#define SCVI_DEEPENTRY_R3_D_R_DA 2
+#define SCVI_DEEPENTRY_R3_D_R_DA_R_DAA 2
+
 /*! 
  * Type definition of the data structure for the DeepEntry state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntryTest/DeepEntry.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart DeepEntry {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "DeepEntryTest"
+			targetFolder = "DeepEntry"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 31 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntry/DeepEntryTest.cc

@@ -0,0 +1,31 @@
+/**
+* Copyright (c) 2017 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 "gtest/gtest.h"
+#include "DeepEntry.h"
+
+static DeepEntry statechart;
+
+class StatemachineTest : public ::testing::Test{
+	protected:
+	virtual void SetUp() {
+		deepEntry_init(&statechart);
+	}
+};
+
+
+TEST_F(StatemachineTest, enterToSubstate) {					
+	deepEntry_enter(&statechart);
+	long vergleich = 4l;
+	EXPECT_TRUE(vergleich== 4l);
+	deepEntry_exit(&statechart);
+}
+
+

test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntryTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntry/sc_types.h


+ 0 - 44
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepEntryTest/DeepEntryTest.cc

@@ -1,44 +0,0 @@
-/**
-* Copyright (c) 2017 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 "gtest/gtest.h"
-#include "DeepEntry.h"
-
-DeepEntry handle;
-
-class StatemachineTest : public ::testing::Test{
-	protected:
-	virtual void SetUp() {
-		deepEntry_init(&handle);
-	}
-};
-
-
-TEST_F(StatemachineTest, enterToSubstate) {					
-	EXPECT_TRUE(deepEntryIface_get_x(&handle)== 0l);
-	EXPECT_TRUE(deepEntryIface_get_y(&handle)== 0l);
-	EXPECT_TRUE(deepEntryIface_get_z(&handle)== 0l);
-	deepEntry_enter(&handle);
-	EXPECT_TRUE(deepEntryIface_get_x(&handle)== 1l);
-	EXPECT_TRUE(deepEntryIface_get_y(&handle)== 1l);
-	EXPECT_TRUE(deepEntryIface_get_z(&handle)== 2l);
-	deepEntryIface_raise_e(&handle);
-	deepEntry_runCycle(&handle);
-	EXPECT_TRUE(deepEntry_isStateActive(&handle, DeepEntry_r2_B_r_BB));
-	deepEntryIface_raise_f(&handle);
-	deepEntry_runCycle(&handle);
-	EXPECT_TRUE(deepEntry_isStateActive(&handle, DeepEntry_r2_C));
-	deepEntryIface_raise_f(&handle);
-	deepEntry_runCycle(&handle);
-	EXPECT_TRUE(deepEntry_isStateActive(&handle, DeepEntry_r2_B_r_BB));
-	EXPECT_TRUE(deepEntryIface_get_y(&handle)== 1l);
-}
-
-

+ 18 - 19
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistoryTest/DeepHistory.c

@@ -102,15 +102,14 @@ void deepHistory_exit(DeepHistory* handle)
 
 sc_boolean deepHistory_isActive(const DeepHistory* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != DeepHistory_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < DEEPHISTORY_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != DeepHistory_last_state;
 	}
+	
 	return result;
 }
 
@@ -196,39 +195,39 @@ sc_boolean deepHistory_isStateActive(const DeepHistory* handle, DeepHistoryState
 	switch (state)
 	{
 		case DeepHistory_mainRegion_State1 :
-			result = (sc_boolean) (handle->stateConfVector[0] == DeepHistory_mainRegion_State1
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE1] == DeepHistory_mainRegion_State1
 			);
 			break;
 		case DeepHistory_mainRegion_State2 :
-			result = (sc_boolean) (handle->stateConfVector[0] >= DeepHistory_mainRegion_State2
-				&& handle->stateConfVector[0] <= DeepHistory_mainRegion_State2__region0_State5);
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE2] >= DeepHistory_mainRegion_State2
+				&& handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE2] <= DeepHistory_mainRegion_State2__region0_State5);
 			break;
 		case DeepHistory_mainRegion_State2__region0_a :
-			result = (sc_boolean) (handle->stateConfVector[0] == DeepHistory_mainRegion_State2__region0_a
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_A] == DeepHistory_mainRegion_State2__region0_a
 			);
 			break;
 		case DeepHistory_mainRegion_State2__region0_State4 :
-			result = (sc_boolean) (handle->stateConfVector[0] >= DeepHistory_mainRegion_State2__region0_State4
-				&& handle->stateConfVector[0] <= DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9);
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4] >= DeepHistory_mainRegion_State2__region0_State4
+				&& handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4] <= DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9);
 			break;
 		case DeepHistory_mainRegion_State2__region0_State4__region0_State6 :
-			result = (sc_boolean) (handle->stateConfVector[0] == DeepHistory_mainRegion_State2__region0_State4__region0_State6
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE6] == DeepHistory_mainRegion_State2__region0_State4__region0_State6
 			);
 			break;
 		case DeepHistory_mainRegion_State2__region0_State4__region0_State7 :
-			result = (sc_boolean) (handle->stateConfVector[0] >= DeepHistory_mainRegion_State2__region0_State4__region0_State7
-				&& handle->stateConfVector[0] <= DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9);
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE7] >= DeepHistory_mainRegion_State2__region0_State4__region0_State7
+				&& handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE7] <= DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9);
 			break;
 		case DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State8 :
-			result = (sc_boolean) (handle->stateConfVector[0] == DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State8
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE7__REGION0_STATE8] == DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State8
 			);
 			break;
 		case DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9 :
-			result = (sc_boolean) (handle->stateConfVector[0] == DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE7__REGION0_STATE9] == DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9
 			);
 			break;
 		case DeepHistory_mainRegion_State2__region0_State5 :
-			result = (sc_boolean) (handle->stateConfVector[0] == DeepHistory_mainRegion_State2__region0_State5
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE5] == DeepHistory_mainRegion_State2__region0_State5
 			);
 			break;
 		default:

+ 13 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistoryTest/DeepHistory.h

@@ -14,6 +14,7 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	DeepHistory_last_state,
 	DeepHistory_mainRegion_State1,
 	DeepHistory_mainRegion_State2,
 	DeepHistory_mainRegion_State2__region0_a,
@@ -22,8 +23,7 @@ typedef enum
 	DeepHistory_mainRegion_State2__region0_State4__region0_State7,
 	DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State8,
 	DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9,
-	DeepHistory_mainRegion_State2__region0_State5,
-	DeepHistory_last_state
+	DeepHistory_mainRegion_State2__region0_State5
 } DeepHistoryStates;
 
 /*! Type definition of the data structure for the DeepHistoryIface interface scope. */
@@ -46,6 +46,17 @@ typedef struct
 	/*! Define dimension of the state configuration vector for history states. */
 #define DEEPHISTORY_MAX_HISTORY_STATES 3
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_DEEPHISTORY_MAINREGION_STATE1 0
+#define SCVI_DEEPHISTORY_MAINREGION_STATE2 0
+#define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_A 0
+#define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4 0
+#define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE6 0
+#define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE7 0
+#define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE7__REGION0_STATE8 0
+#define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE4__REGION0_STATE7__REGION0_STATE9 0
+#define SCVI_DEEPHISTORY_MAINREGION_STATE2__REGION0_STATE5 0
+
 /*! 
  * Type definition of the data structure for the DeepHistory state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistoryTest/DeepHistory.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart DeepHistory {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "DeepHistoryTest"
+			targetFolder = "DeepHistory"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 46 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistory/DeepHistoryTest.cc

@@ -0,0 +1,46 @@
+/**
+* Copyright (c) 2017 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 "gtest/gtest.h"
+#include "DeepHistory.h"
+
+static DeepHistory statechart;
+
+class StatemachineTest : public ::testing::Test{
+	protected:
+	virtual void SetUp() {
+		deepHistory_init(&statechart);
+	}
+};
+
+
+TEST_F(StatemachineTest, deepHistoryTest) {					
+	deepHistory_enter(&statechart);
+	deepHistoryIface_raise_event1(&statechart);
+	deepHistory_runCycle(&statechart);
+	deepHistoryIface_raise_event3(&statechart);
+	deepHistory_runCycle(&statechart);
+	deepHistoryIface_raise_event5(&statechart);
+	deepHistory_runCycle(&statechart);
+	deepHistoryIface_raise_event7(&statechart);
+	deepHistory_runCycle(&statechart);
+	EXPECT_TRUE(!deepHistory_isStateActive(&statechart, DeepHistory_mainRegion_State1));
+	EXPECT_TRUE(deepHistory_isStateActive(&statechart, DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9));
+	deepHistoryIface_raise_event2(&statechart);
+	deepHistory_runCycle(&statechart);
+	EXPECT_TRUE(deepHistory_isStateActive(&statechart, DeepHistory_mainRegion_State1));
+	EXPECT_TRUE(!deepHistory_isStateActive(&statechart, DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9));
+	deepHistoryIface_raise_event1(&statechart);
+	deepHistory_runCycle(&statechart);
+	EXPECT_TRUE(!deepHistory_isStateActive(&statechart, DeepHistory_mainRegion_State1));
+	EXPECT_TRUE(deepHistory_isStateActive(&statechart, DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9));
+}
+
+

test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistoryTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistory/sc_types.h


+ 0 - 46
test-plugins/org.yakindu.sct.generator.c.test/gtests/DeepHistoryTest/DeepHistoryTest.cc

@@ -1,46 +0,0 @@
-/**
-* Copyright (c) 2017 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 "gtest/gtest.h"
-#include "DeepHistory.h"
-
-DeepHistory handle;
-
-class StatemachineTest : public ::testing::Test{
-	protected:
-	virtual void SetUp() {
-		deepHistory_init(&handle);
-	}
-};
-
-
-TEST_F(StatemachineTest, deepHistoryTest) {					
-	deepHistory_enter(&handle);
-	deepHistoryIface_raise_event1(&handle);
-	deepHistory_runCycle(&handle);
-	deepHistoryIface_raise_event3(&handle);
-	deepHistory_runCycle(&handle);
-	deepHistoryIface_raise_event5(&handle);
-	deepHistory_runCycle(&handle);
-	deepHistoryIface_raise_event7(&handle);
-	deepHistory_runCycle(&handle);
-	EXPECT_TRUE(!deepHistory_isStateActive(&handle, DeepHistory_mainRegion_State1));
-	EXPECT_TRUE(deepHistory_isStateActive(&handle, DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9));
-	deepHistoryIface_raise_event2(&handle);
-	deepHistory_runCycle(&handle);
-	EXPECT_TRUE(deepHistory_isStateActive(&handle, DeepHistory_mainRegion_State1));
-	EXPECT_TRUE(!deepHistory_isStateActive(&handle, DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9));
-	deepHistoryIface_raise_event1(&handle);
-	deepHistory_runCycle(&handle);
-	EXPECT_TRUE(!deepHistory_isStateActive(&handle, DeepHistory_mainRegion_State1));
-	EXPECT_TRUE(deepHistory_isStateActive(&handle, DeepHistory_mainRegion_State2__region0_State4__region0_State7__region0_State9));
-}
-
-

+ 9 - 10
test-plugins/org.yakindu.sct.generator.c.test/gtests/DynamicChoiceTest/DynamicChoice.c

@@ -65,15 +65,14 @@ void dynamicChoice_exit(DynamicChoice* handle)
 
 sc_boolean dynamicChoice_isActive(const DynamicChoice* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != DynamicChoice_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < DYNAMICCHOICE_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != DynamicChoice_last_state;
 	}
+	
 	return result;
 }
 
@@ -136,15 +135,15 @@ sc_boolean dynamicChoice_isStateActive(const DynamicChoice* handle, DynamicChoic
 	switch (state)
 	{
 		case DynamicChoice_main_region_Start :
-			result = (sc_boolean) (handle->stateConfVector[0] == DynamicChoice_main_region_Start
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DYNAMICCHOICE_MAIN_REGION_START] == DynamicChoice_main_region_Start
 			);
 			break;
 		case DynamicChoice_main_region_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == DynamicChoice_main_region_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DYNAMICCHOICE_MAIN_REGION_A] == DynamicChoice_main_region_A
 			);
 			break;
 		case DynamicChoice_main_region_B :
-			result = (sc_boolean) (handle->stateConfVector[0] == DynamicChoice_main_region_B
+			result = (sc_boolean) (handle->stateConfVector[SCVI_DYNAMICCHOICE_MAIN_REGION_B] == DynamicChoice_main_region_B
 			);
 			break;
 		default:

+ 7 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/DynamicChoiceTest/DynamicChoice.h

@@ -14,10 +14,10 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	DynamicChoice_last_state,
 	DynamicChoice_main_region_Start,
 	DynamicChoice_main_region_A,
-	DynamicChoice_main_region_B,
-	DynamicChoice_last_state
+	DynamicChoice_main_region_B
 } DynamicChoiceStates;
 
 /*! Type definition of the data structure for the DynamicChoiceIface interface scope. */
@@ -31,6 +31,11 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define DYNAMICCHOICE_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_DYNAMICCHOICE_MAIN_REGION_START 0
+#define SCVI_DYNAMICCHOICE_MAIN_REGION_A 0
+#define SCVI_DYNAMICCHOICE_MAIN_REGION_B 0
+
 /*! 
  * Type definition of the data structure for the DynamicChoice state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/DynamicChoiceTest/DynamicChoice.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart DynamicChoice {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "DynamicChoiceTest"
+			targetFolder = "DynamicChoice"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 6 - 6
test-plugins/org.yakindu.sct.generator.c.test/gtests/DynamicChoiceTest/DynamicChoiceTest.cc

@@ -11,21 +11,21 @@
 #include "gtest/gtest.h"
 #include "DynamicChoice.h"
 
-DynamicChoice handle;
+static DynamicChoice statechart;
 
 class StatemachineTest : public ::testing::Test{
 	protected:
 	virtual void SetUp() {
-		dynamicChoice_init(&handle);
+		dynamicChoice_init(&statechart);
 	}
 };
 
 
 TEST_F(StatemachineTest, DynamicChoiceTest) {					
-	dynamicChoice_enter(&handle);
-	EXPECT_TRUE(dynamicChoice_isStateActive(&handle, DynamicChoice_main_region_Start));
-	dynamicChoice_runCycle(&handle);
-	EXPECT_TRUE(dynamicChoice_isStateActive(&handle, DynamicChoice_main_region_A));
+	dynamicChoice_enter(&statechart);
+	EXPECT_TRUE(dynamicChoice_isStateActive(&statechart, DynamicChoice_main_region_Start));
+	dynamicChoice_runCycle(&statechart);
+	EXPECT_TRUE(dynamicChoice_isStateActive(&statechart, DynamicChoice_main_region_A));
 }
 
 

test-plugins/org.yakindu.sct.generator.c.test/gtests/DynamicChoiceTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/DynamicChoice/sc_types.h


+ 8 - 9
test-plugins/org.yakindu.sct.generator.c.test/gtests/EmptyTransitionTest/EmptyTransition.c

@@ -52,15 +52,14 @@ void emptyTransition_exit(EmptyTransition* handle)
 
 sc_boolean emptyTransition_isActive(const EmptyTransition* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != EmptyTransition_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < EMPTYTRANSITION_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != EmptyTransition_last_state;
 	}
+	
 	return result;
 }
 
@@ -117,11 +116,11 @@ sc_boolean emptyTransition_isStateActive(const EmptyTransition* handle, EmptyTra
 	switch (state)
 	{
 		case EmptyTransition_main_region_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == EmptyTransition_main_region_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_EMPTYTRANSITION_MAIN_REGION_A] == EmptyTransition_main_region_A
 			);
 			break;
 		case EmptyTransition_main_region_B :
-			result = (sc_boolean) (handle->stateConfVector[0] == EmptyTransition_main_region_B
+			result = (sc_boolean) (handle->stateConfVector[SCVI_EMPTYTRANSITION_MAIN_REGION_B] == EmptyTransition_main_region_B
 			);
 			break;
 		default:

+ 6 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/EmptyTransitionTest/EmptyTransition.h

@@ -14,15 +14,19 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	EmptyTransition_last_state,
 	EmptyTransition_main_region_A,
-	EmptyTransition_main_region_B,
-	EmptyTransition_last_state
+	EmptyTransition_main_region_B
 } EmptyTransitionStates;
 
 
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define EMPTYTRANSITION_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_EMPTYTRANSITION_MAIN_REGION_A 0
+#define SCVI_EMPTYTRANSITION_MAIN_REGION_B 0
+
 /*! 
  * Type definition of the data structure for the EmptyTransition state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/EmptyTransitionTest/EmptyTransition.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart EmptyTransition {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "EmptyTransitionTest"
+			targetFolder = "EmptyTransition"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 6 - 6
test-plugins/org.yakindu.sct.generator.c.test/gtests/EmptyTransitionTest/EmptyTransitionTest.cc

@@ -11,21 +11,21 @@
 #include "gtest/gtest.h"
 #include "EmptyTransition.h"
 
-EmptyTransition handle;
+static EmptyTransition statechart;
 
 class StatemachineTest : public ::testing::Test{
 	protected:
 	virtual void SetUp() {
-		emptyTransition_init(&handle);
+		emptyTransition_init(&statechart);
 	}
 };
 
 
 TEST_F(StatemachineTest, EmptyTransitionTest) {					
-	emptyTransition_enter(&handle);
-	emptyTransition_runCycle(&handle);
-	EXPECT_TRUE(!emptyTransition_isStateActive(&handle, EmptyTransition_main_region_B));
-	EXPECT_TRUE(emptyTransition_isStateActive(&handle, EmptyTransition_main_region_A));
+	emptyTransition_enter(&statechart);
+	emptyTransition_runCycle(&statechart);
+	EXPECT_TRUE(!emptyTransition_isStateActive(&statechart, EmptyTransition_main_region_B));
+	EXPECT_TRUE(emptyTransition_isStateActive(&statechart, EmptyTransition_main_region_A));
 }
 
 

test-plugins/org.yakindu.sct.generator.c.test/gtests/EmptyTransitionTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/EmptyTransition/sc_types.h


+ 11 - 12
test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterStateTest/EnterState.c

@@ -69,15 +69,14 @@ void enterState_exit(EnterState* handle)
 
 sc_boolean enterState_isActive(const EnterState* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != EnterState_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < ENTERSTATE_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != EnterState_last_state;
 	}
+	
 	return result;
 }
 
@@ -142,19 +141,19 @@ sc_boolean enterState_isStateActive(const EnterState* handle, EnterStateStates s
 	switch (state)
 	{
 		case EnterState_r_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == EnterState_r_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ENTERSTATE_R_A] == EnterState_r_A
 			);
 			break;
 		case EnterState_r_B :
-			result = (sc_boolean) (handle->stateConfVector[0] >= EnterState_r_B
-				&& handle->stateConfVector[0] <= EnterState_r_B_r_F);
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ENTERSTATE_R_B] >= EnterState_r_B
+				&& handle->stateConfVector[SCVI_ENTERSTATE_R_B] <= EnterState_r_B_r_F);
 			break;
 		case EnterState_r_B_r_E :
-			result = (sc_boolean) (handle->stateConfVector[0] == EnterState_r_B_r_E
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ENTERSTATE_R_B_R_E] == EnterState_r_B_r_E
 			);
 			break;
 		case EnterState_r_B_r_F :
-			result = (sc_boolean) (handle->stateConfVector[0] == EnterState_r_B_r_F
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ENTERSTATE_R_B_R_F] == EnterState_r_B_r_F
 			);
 			break;
 		default:

+ 8 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterStateTest/EnterState.h

@@ -14,11 +14,11 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
+	EnterState_last_state,
 	EnterState_r_A,
 	EnterState_r_B,
 	EnterState_r_B_r_E,
-	EnterState_r_B_r_F,
-	EnterState_last_state
+	EnterState_r_B_r_F
 } EnterStateStates;
 
 /*! Type definition of the data structure for the EnterStateIface interface scope. */
@@ -33,6 +33,12 @@ typedef struct
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define ENTERSTATE_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_ENTERSTATE_R_A 0
+#define SCVI_ENTERSTATE_R_B 0
+#define SCVI_ENTERSTATE_R_B_R_E 0
+#define SCVI_ENTERSTATE_R_B_R_F 0
+
 /*! 
  * Type definition of the data structure for the EnterState state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterStateTest/EnterState.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart EnterState {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "EnterStateTest"
+			targetFolder = "EnterState"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 46 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterState/EnterStateTest.cc

@@ -0,0 +1,46 @@
+/**
+* Copyright (c) 2017 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 "gtest/gtest.h"
+#include "EnterState.h"
+
+static EnterState statechart;
+
+class StatemachineTest : public ::testing::Test{
+	protected:
+	virtual void SetUp() {
+		enterState_init(&statechart);
+	}
+};
+
+
+TEST_F(StatemachineTest, defaultEntry) {					
+	enterState_enter(&statechart);
+	EXPECT_TRUE(enterState_isStateActive(&statechart, EnterState_r_A));
+	enterStateIface_raise_e(&statechart);
+	enterState_runCycle(&statechart);
+	EXPECT_TRUE(enterState_isStateActive(&statechart, EnterState_r_B_r_E));
+}
+TEST_F(StatemachineTest, namedEntryThroughNamedTransition) {					
+	enterState_enter(&statechart);
+	EXPECT_TRUE(enterState_isStateActive(&statechart, EnterState_r_A));
+	enterStateIface_raise_f(&statechart);
+	enterState_runCycle(&statechart);
+	EXPECT_TRUE(enterState_isStateActive(&statechart, EnterState_r_B_r_F));
+}
+TEST_F(StatemachineTest, namedEntryThroughDefaultTransition) {					
+	enterState_enter(&statechart);
+	EXPECT_TRUE(enterState_isStateActive(&statechart, EnterState_r_A));
+	enterStateIface_raise_g(&statechart);
+	enterState_runCycle(&statechart);
+	EXPECT_TRUE(enterState_isStateActive(&statechart, EnterState_r_B_r_E));
+}
+
+

test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterStateTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterState/sc_types.h


+ 0 - 46
test-plugins/org.yakindu.sct.generator.c.test/gtests/EnterStateTest/EnterStateTest.cc

@@ -1,46 +0,0 @@
-/**
-* Copyright (c) 2017 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 "gtest/gtest.h"
-#include "EnterState.h"
-
-EnterState handle;
-
-class StatemachineTest : public ::testing::Test{
-	protected:
-	virtual void SetUp() {
-		enterState_init(&handle);
-	}
-};
-
-
-TEST_F(StatemachineTest, defaultEntry) {					
-	enterState_enter(&handle);
-	EXPECT_TRUE(enterState_isStateActive(&handle, EnterState_r_A));
-	enterStateIface_raise_e(&handle);
-	enterState_runCycle(&handle);
-	EXPECT_TRUE(enterState_isStateActive(&handle, EnterState_r_B_r_E));
-}
-TEST_F(StatemachineTest, namedEntryThroughNamedTransition) {					
-	enterState_enter(&handle);
-	EXPECT_TRUE(enterState_isStateActive(&handle, EnterState_r_A));
-	enterStateIface_raise_f(&handle);
-	enterState_runCycle(&handle);
-	EXPECT_TRUE(enterState_isStateActive(&handle, EnterState_r_B_r_F));
-}
-TEST_F(StatemachineTest, namedEntryThroughDefaultTransition) {					
-	enterState_enter(&handle);
-	EXPECT_TRUE(enterState_isStateActive(&handle, EnterState_r_A));
-	enterStateIface_raise_g(&handle);
-	enterState_runCycle(&handle);
-	EXPECT_TRUE(enterState_isStateActive(&handle, EnterState_r_B_r_E));
-}
-
-

+ 7 - 8
test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryChoiceTest/EntryChoice.c

@@ -52,15 +52,14 @@ void entryChoice_exit(EntryChoice* handle)
 
 sc_boolean entryChoice_isActive(const EntryChoice* handle)
 {
-	sc_boolean result;
-	if (handle->stateConfVector[0] != EntryChoice_last_state)
-	{
-		result =  bool_true;
-	}
-	else
+	sc_boolean result = bool_false;
+	int i;
+	
+	for(i = 0; i < ENTRYCHOICE_MAX_ORTHOGONAL_STATES; i++)
 	{
-		result = bool_false;
+		result = result || handle->stateConfVector[i] != EntryChoice_last_state;
 	}
+	
 	return result;
 }
 
@@ -112,7 +111,7 @@ sc_boolean entryChoice_isStateActive(const EntryChoice* handle, EntryChoiceState
 	switch (state)
 	{
 		case EntryChoice_main_region_A :
-			result = (sc_boolean) (handle->stateConfVector[0] == EntryChoice_main_region_A
+			result = (sc_boolean) (handle->stateConfVector[SCVI_ENTRYCHOICE_MAIN_REGION_A] == EntryChoice_main_region_A
 			);
 			break;
 		default:

+ 5 - 2
test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryChoiceTest/EntryChoice.h

@@ -14,14 +14,17 @@ extern "C" {
 /*! Enumeration of all states */ 
 typedef enum
 {
-	EntryChoice_main_region_A,
-	EntryChoice_last_state
+	EntryChoice_last_state,
+	EntryChoice_main_region_A
 } EntryChoiceStates;
 
 
 /*! Define dimension of the state configuration vector for orthogonal states. */
 #define ENTRYCHOICE_MAX_ORTHOGONAL_STATES 1
 
+/*! Define indices of states in the StateConfVector */
+#define SCVI_ENTRYCHOICE_MAIN_REGION_A 0
+
 /*! 
  * Type definition of the data structure for the EntryChoice state machine.
  * This data structure has to be allocated by the client code. 

+ 1 - 1
test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryChoiceTest/EntryChoice.sgen

@@ -2,7 +2,7 @@ GeneratorModel for yakindu::c {
 	statechart EntryChoice {
 		feature Outlet {
 			targetProject = "gtests"
-			targetFolder = "EntryChoiceTest"
+			targetFolder = "EntryChoice"
 		}
 		feature FunctionInlining {
 			inlineReactions = false

+ 6 - 6
test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryChoiceTest/EntryChoiceTest.cc

@@ -11,21 +11,21 @@
 #include "gtest/gtest.h"
 #include "EntryChoice.h"
 
-EntryChoice handle;
+static EntryChoice statechart;
 
 class StatemachineTest : public ::testing::Test{
 	protected:
 	virtual void SetUp() {
-		entryChoice_init(&handle);
+		entryChoice_init(&statechart);
 	}
 };
 
 
 TEST_F(StatemachineTest, EntryChoiceTest) {					
-	entryChoice_enter(&handle);
-	entryChoice_runCycle(&handle);
-	entryChoice_runCycle(&handle);
-	EXPECT_TRUE(entryChoice_isStateActive(&handle, EntryChoice_main_region_A));
+	entryChoice_enter(&statechart);
+	entryChoice_runCycle(&statechart);
+	entryChoice_runCycle(&statechart);
+	EXPECT_TRUE(entryChoice_isStateActive(&statechart, EntryChoice_main_region_A));
 }
 
 

test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryChoiceTest/sc_types.h → test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryChoice/sc_types.h


+ 0 - 0
test-plugins/org.yakindu.sct.generator.c.test/gtests/EntryExitSelfTransitionTest/EntryExitSelfTransition.c


部分文件因为文件数量过多而无法显示