StatechartLocalReactions.cc 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * Copyright (c) 2013 committers of YAKINDU and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. *
  8. * Contributors:
  9. * committers of YAKINDU - initial API and implementation
  10. */
  11. #include <string>
  12. #include "gtest/gtest.h"
  13. #include "StatechartLocalReactions.h"
  14. TEST(StatemachineTest, statechartLocalReactionsTest) {
  15. StatechartLocalReactions handle;
  16. statechartLocalReactions_init(&handle);
  17. statechartLocalReactions_enter(&handle);
  18. EXPECT_TRUE(statechartLocalReactions_isActive(&handle, StatechartLocalReactions_main_region_S1));
  19. EXPECT_TRUE(statechartLocalReactions_isActive(&handle, StatechartLocalReactions_region2_a));
  20. while (statechartLocalReactionsIface_get_myInt(&handle) < 10) {
  21. EXPECT_TRUE(statechartLocalReactions_isActive(&handle, StatechartLocalReactions_region2_a));
  22. if (statechartLocalReactionsIface_get_myInt(&handle) %2== 0) {
  23. EXPECT_TRUE(statechartLocalReactions_isActive(&handle, StatechartLocalReactions_main_region_S1));;
  24. }
  25. else {
  26. EXPECT_TRUE(statechartLocalReactions_isActive(&handle, StatechartLocalReactions_main_region_S2));;
  27. }
  28. statechartLocalReactions_runCycle(&handle);
  29. }
  30. }