OutEventLifeCycleTest.cc 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 "OutEventLifeCycle.h"
  14. TEST(StatemachineTest, availableAfterCycle) {
  15. OutEventLifeCycle* statechart = new OutEventLifeCycle();
  16. statechart->init();
  17. statechart->enter();
  18. statechart->raise_e();
  19. statechart->runCycle();
  20. EXPECT_TRUE(statechart->getDefaultSCI()->isRaised_f());
  21. delete statechart;
  22. }
  23. TEST(StatemachineTest, availableWithinCycle) {
  24. OutEventLifeCycle* statechart = new OutEventLifeCycle();
  25. statechart->init();
  26. statechart->enter();
  27. statechart->raise_e();
  28. statechart->runCycle();
  29. EXPECT_TRUE(statechart->getDefaultSCI()->get_f_available_in_cycle());
  30. delete statechart;
  31. }
  32. TEST(StatemachineTest, unvailableWithin2ndCycle) {
  33. OutEventLifeCycle* statechart = new OutEventLifeCycle();
  34. statechart->init();
  35. statechart->enter();
  36. statechart->raise_e();
  37. statechart->runCycle();
  38. statechart->runCycle();
  39. EXPECT_TRUE(!statechart->getDefaultSCI()->get_f_available_in_next_cycle());
  40. delete statechart;
  41. }
  42. TEST(StatemachineTest, unvailableAfter2ndCycle) {
  43. OutEventLifeCycle* statechart = new OutEventLifeCycle();
  44. statechart->init();
  45. statechart->enter();
  46. statechart->raise_e();
  47. statechart->runCycle();
  48. statechart->runCycle();
  49. EXPECT_TRUE(!statechart->getDefaultSCI()->isRaised_f());
  50. delete statechart;
  51. }