DeepHistoryTest.cc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * Copyright (c) 2014 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 "DeepHistory.h"
  14. TEST(StatemachineTest, deepHistoryTest) {
  15. DeepHistory* statechart = new DeepHistory();
  16. statechart->init();
  17. statechart->enter();
  18. statechart->raise_event1();
  19. statechart->runCycle();
  20. statechart->raise_event3();
  21. statechart->runCycle();
  22. statechart->raise_event5();
  23. statechart->runCycle();
  24. statechart->raise_event7();
  25. statechart->runCycle();
  26. EXPECT_TRUE(!statechart->isActive(DeepHistory::State1));
  27. EXPECT_TRUE(statechart->isActive(DeepHistory::State9));
  28. statechart->raise_event2();
  29. statechart->runCycle();
  30. EXPECT_TRUE(statechart->isActive(DeepHistory::State1));
  31. EXPECT_TRUE(!statechart->isActive(DeepHistory::State9));
  32. statechart->raise_event1();
  33. statechart->runCycle();
  34. EXPECT_TRUE(!statechart->isActive(DeepHistory::State1));
  35. EXPECT_TRUE(statechart->isActive(DeepHistory::State9));
  36. delete statechart;
  37. }