ExitOnSelfTransitionTest.cc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 "ExitOnSelfTransition.h"
  13. ExitOnSelfTransition handle;
  14. class StatemachineTest : public ::testing::Test{
  15. protected:
  16. virtual void SetUp() {
  17. exitOnSelfTransition_init(&handle);
  18. }
  19. };
  20. TEST_F(StatemachineTest, ExitOnSelfTransitionTest) {
  21. exitOnSelfTransition_enter(&handle);
  22. EXPECT_TRUE(exitOnSelfTransition_isStateActive(&handle, ExitOnSelfTransition_main_region_A));
  23. EXPECT_TRUE(exitOnSelfTransitionIface_get_entryCount(&handle)== 1l);
  24. EXPECT_TRUE(exitOnSelfTransitionIface_get_exitCount(&handle)== 0l);
  25. exitOnSelfTransitionIface_raise_e(&handle);
  26. exitOnSelfTransition_runCycle(&handle);
  27. EXPECT_TRUE(exitOnSelfTransitionIface_get_entryCount(&handle)== 2l);
  28. EXPECT_TRUE(exitOnSelfTransitionIface_get_exitCount(&handle)== 1l);
  29. exitOnSelfTransitionIface_raise_f(&handle);
  30. exitOnSelfTransition_runCycle(&handle);
  31. EXPECT_TRUE(exitOnSelfTransitionIface_get_entryCount(&handle)== 2l);
  32. EXPECT_TRUE(exitOnSelfTransitionIface_get_exitCount(&handle)== 2l);
  33. }