ConstantsTestsTest.cc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  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 "Constants.h"
  14. TEST(StatemachineTest, constantDefinition) {
  15. Constants* statechart = new Constants();
  16. statechart->init();
  17. statechart->enter();
  18. EXPECT_TRUE(statechart->isStateActive(Constants::main_region_A));
  19. EXPECT_TRUE(statechart->getDefaultSCI()->get_x()== 10l);
  20. EXPECT_TRUE(statechart->getDefaultSCI()->get_y()== 20l);
  21. EXPECT_TRUE(strcmp(statechart->getSCI_Named()->get_y(), "Hello World") == 0);
  22. statechart->raise_e();
  23. statechart->runCycle();
  24. EXPECT_TRUE(statechart->getDefaultSCI()->get_result()== 20l);
  25. statechart->raise_e();
  26. statechart->runCycle();
  27. EXPECT_TRUE(statechart->isStateActive(Constants::main_region_C));
  28. EXPECT_TRUE(statechart->getDefaultSCI()->get_result()== 100l);
  29. statechart->raise_e2( statechart->getDefaultSCI()->get_x());
  30. statechart->runCycle();
  31. EXPECT_TRUE(statechart->getDefaultSCI()->get_result()== 1000l);
  32. EXPECT_TRUE(statechart->isStateActive(Constants::main_region_A));
  33. delete statechart;
  34. }