ValuedEvents.cc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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 "ValuedEvents.h"
  14. ValuedEvents handle;
  15. TEST(StatemachineTest, valuedEventsTest) {
  16. valuedEvents_init(&handle);
  17. valuedEvents_enter(&handle);
  18. valuedEvents_runCycle(&handle);
  19. EXPECT_TRUE(strcmp(valuedEventsIface_get_myString(&handle) , ""sct"") == 0);
  20. valuedEventsIface_raise_integerEvent(&handle, 23l);
  21. valuedEventsIface_raise_booleanEvent(&handle, false);
  22. valuedEventsIface_raise_realEvent(&handle, 20l);
  23. valuedEventsIface_raise_stringEvent(&handle, "tool");
  24. valuedEvents_runCycle(&handle);
  25. EXPECT_TRUE(valuedEvents_isActive(&handle, ValuedEvents_integer_region_D));
  26. EXPECT_TRUE(valuedEvents_isActive(&handle, ValuedEvents_string_region_D));
  27. EXPECT_TRUE(valuedEvents_isActive(&handle, ValuedEvents_boolean_region_D));
  28. EXPECT_TRUE(valuedEvents_isActive(&handle, ValuedEvents_real_region_D));
  29. EXPECT_TRUE(valuedEventsIface_get_myInt(&handle) == 23l);
  30. EXPECT_TRUE(valuedEventsIface_get_myBool(&handle) == false);
  31. EXPECT_TRUE(valuedEventsIface_get_myReal(&handle) == 20l);
  32. EXPECT_TRUE(strcmp(valuedEventsIface_get_myString(&handle) , ""tool"") == 0);
  33. }