StatechartActive.cc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Copyright (c) 2016 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. StatechartActive handle;
  15. TEST(StatemachineTest, inactiveBeforeEnter) {
  16. statechartActive_init(&handle);
  17. EXPECT_TRUE(!statechartActive_isActive(&handle));
  18. }
  19. TEST(StatemachineTest, activeAfterEnter) {
  20. statechartActive_init(&handle);
  21. statechartActive_enter(&handle);
  22. EXPECT_TRUE(statechartActive_isActive(&handle));
  23. }
  24. TEST(StatemachineTest, inactiveAfterExit) {
  25. statechartActive_init(&handle);
  26. statechartActive_enter(&handle);
  27. statechartActive_exit(&handle);
  28. EXPECT_TRUE(!statechartActive_isActive(&handle));
  29. }
  30. TEST(StatemachineTest, activeAfterReenter) {
  31. statechartActive_init(&handle);
  32. statechartActive_enter(&handle);
  33. statechartActive_exit(&handle);
  34. statechartActive_enter(&handle);
  35. EXPECT_TRUE(statechartActive_isActive(&handle));
  36. }