SimpleEventTest.cc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. /**
  2. * Copyright (c) 2017 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 "gtest/gtest.h"
  12. #include "SimpleEvent.h"
  13. SimpleEvent handle;
  14. class StatemachineTest : public ::testing::Test{
  15. protected:
  16. virtual void SetUp() {
  17. simpleEvent_init(&handle);
  18. }
  19. };
  20. TEST_F(StatemachineTest, simpleEventTest) {
  21. simpleEvent_enter(&handle);
  22. EXPECT_TRUE(simpleEvent_isStateActive(&handle, SimpleEvent_main_region_A)) << "Expected A to be active" ;
  23. EXPECT_TRUE(5l== 5l);
  24. simpleEventIface_raise_event1(&handle);
  25. simpleEvent_runCycle(&handle);
  26. EXPECT_TRUE(simpleEvent_isStateActive(&handle, SimpleEvent_main_region_B)) << "Expected B to be active" ;
  27. simpleEvent_runCycle(&handle);
  28. EXPECT_TRUE(!simpleEvent_isStateActive(&handle, SimpleEvent_main_region_B));
  29. }