StatechartActiveTest.cc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * Copyright (c) 2015 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 "StatechartActive.h"
  14. TEST(StatemachineTest, inactiveBeforeEnter) {
  15. StatechartActive* statechart = new StatechartActive();
  16. statechart->init();
  17. EXPECT_TRUE(!statechart->isActive());
  18. delete statechart;
  19. }
  20. TEST(StatemachineTest, activeAfterEnter) {
  21. StatechartActive* statechart = new StatechartActive();
  22. statechart->init();
  23. statechart->enter();
  24. EXPECT_TRUE(statechart->isActive());
  25. delete statechart;
  26. }
  27. TEST(StatemachineTest, inactiveAfterExit) {
  28. StatechartActive* statechart = new StatechartActive();
  29. statechart->init();
  30. statechart->enter();
  31. statechart->exit();
  32. EXPECT_TRUE(!statechart->isActive());
  33. delete statechart;
  34. }
  35. TEST(StatemachineTest, activeAfterReenter) {
  36. StatechartActive* statechart = new StatechartActive();
  37. statechart->init();
  38. statechart->enter();
  39. statechart->exit();
  40. statechart->enter();
  41. EXPECT_TRUE(statechart->isActive());
  42. delete statechart;
  43. }