DeepEntryTest.cc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  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 "DeepEntry.h"
  14. TEST(StatemachineTest, enterToSubstate) {
  15. DeepEntry* statechart = new DeepEntry();
  16. statechart->init();
  17. EXPECT_TRUE(statechart->getSCInterface()->get_x()== 0);
  18. EXPECT_TRUE(statechart->getSCInterface()->get_y()== 0);
  19. EXPECT_TRUE(statechart->getSCInterface()->get_z()== 0);
  20. statechart->enter();
  21. EXPECT_TRUE(statechart->getSCInterface()->get_x()== 1);
  22. EXPECT_TRUE(statechart->getSCInterface()->get_y()== 1);
  23. EXPECT_TRUE(statechart->getSCInterface()->get_z()== 2);
  24. statechart->raise_e();
  25. statechart->runCycle();
  26. EXPECT_TRUE(statechart->isActive(DeepEntry::BB));
  27. statechart->raise_f();
  28. statechart->runCycle();
  29. EXPECT_TRUE(statechart->isActive(DeepEntry::C));
  30. statechart->raise_f();
  31. statechart->runCycle();
  32. EXPECT_TRUE(statechart->isActive(DeepEntry::BB));
  33. EXPECT_TRUE(statechart->getSCInterface()->get_y()== 1);
  34. delete statechart;
  35. }