PriorityValues.cc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Copyright (c) 2015 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 "PriorityValues.h"
  14. PriorityValues handle;
  15. TEST(StatemachineTest, transitionPriority) {
  16. priorityValues_init(&handle);
  17. priorityValues_enter(&handle);
  18. EXPECT_TRUE(priorityValues_isStateActive(&handle, PriorityValues_main_region_A));
  19. priorityValuesIface_raise_event1(&handle);
  20. priorityValues_runCycle(&handle);
  21. EXPECT_TRUE(priorityValues_isStateActive(&handle, PriorityValues_main_region_C));
  22. }
  23. TEST(StatemachineTest, regionPriority) {
  24. priorityValues_init(&handle);
  25. priorityValues_enter(&handle);
  26. EXPECT_TRUE(priorityValues_isStateActive(&handle, PriorityValues_someRegion_A));
  27. priorityValuesIface_raise_event2(&handle);
  28. priorityValues_runCycle(&handle);
  29. EXPECT_TRUE(priorityValues_isStateActive(&handle, PriorityValues_someRegion_B));
  30. EXPECT_TRUE(!priorityValues_isStateActive(&handle, PriorityValues_main_region_E));
  31. }