InternalEventLifeCycle.cc 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * Copyright (c) 2013 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 "InternalEventLifeCycle.h"
  14. TEST(StatemachineTest, InternalEventLifeCycleTest) {
  15. InternalEventLifeCycle handle;
  16. internalEventLifeCycle_init(&handle);
  17. internalEventLifeCycle_enter(&handle);
  18. EXPECT_TRUE(internalEventLifeCycle_isActive(&handle, InternalEventLifeCycle_r1_A));
  19. EXPECT_TRUE(internalEventLifeCycle_isActive(&handle, InternalEventLifeCycle_r2_C));
  20. internalEventLifeCycleIface_raise_e(&handle);
  21. internalEventLifeCycle_runCycle(&handle);
  22. EXPECT_TRUE(internalEventLifeCycle_isActive(&handle, InternalEventLifeCycle_r1_A));
  23. EXPECT_TRUE(internalEventLifeCycle_isActive(&handle, InternalEventLifeCycle_r2_D));
  24. internalEventLifeCycle_runCycle(&handle);
  25. EXPECT_TRUE(internalEventLifeCycle_isActive(&handle, InternalEventLifeCycle_r1_A));
  26. EXPECT_TRUE(internalEventLifeCycle_isActive(&handle, InternalEventLifeCycle_r2_D));
  27. internalEventLifeCycleIface_raise_f(&handle);
  28. internalEventLifeCycle_runCycle(&handle);
  29. EXPECT_TRUE(internalEventLifeCycle_isActive(&handle, InternalEventLifeCycle_r1_A));
  30. EXPECT_TRUE(internalEventLifeCycle_isActive(&handle, InternalEventLifeCycle_r2_C));
  31. internalEventLifeCycle_runCycle(&handle);
  32. EXPECT_TRUE(internalEventLifeCycle_isActive(&handle, InternalEventLifeCycle_r1_A));
  33. EXPECT_TRUE(internalEventLifeCycle_isActive(&handle, InternalEventLifeCycle_r2_C));
  34. }