StatechartLocalReactionsTest.cc 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /**
  2. * Copyright (c) 2017 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 "gtest/gtest.h"
  12. #include "StatechartLocalReactions.h"
  13. StatechartLocalReactions handle;
  14. class StatemachineTest : public ::testing::Test{
  15. protected:
  16. virtual void SetUp() {
  17. statechartLocalReactions_init(&handle);
  18. }
  19. };
  20. TEST_F(StatemachineTest, statechartLocalReactionsTest) {
  21. statechartLocalReactions_enter(&handle);
  22. EXPECT_TRUE(statechartLocalReactions_isStateActive(&handle, StatechartLocalReactions_main_region_S1));
  23. EXPECT_TRUE(statechartLocalReactions_isStateActive(&handle, StatechartLocalReactions_region2_a));
  24. while (statechartLocalReactionsIface_get_myInt(&handle)< 10l) {
  25. EXPECT_TRUE(statechartLocalReactions_isStateActive(&handle, StatechartLocalReactions_region2_a));
  26. if (statechartLocalReactionsIface_get_myInt(&handle)%2l== 0l) {
  27. EXPECT_TRUE(statechartLocalReactions_isStateActive(&handle, StatechartLocalReactions_main_region_S1));
  28. }
  29. else {
  30. EXPECT_TRUE(statechartLocalReactions_isStateActive(&handle, StatechartLocalReactions_main_region_S2));
  31. }
  32. statechartLocalReactions_runCycle(&handle);
  33. }
  34. }