StringExpressionsTest.cc 1.4 KB

1234567891011121314151617181920212223242526272829303132
  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 "StringExpressions.h"
  14. TEST(StatemachineTest, StringExpressionsTest) {
  15. StringExpressions* statechart = new StringExpressions();
  16. statechart->init();
  17. EXPECT_TRUE(strcmp(statechart->getSCInterface()->get_quotedString(), "\"x\"") == 0);
  18. statechart->enter();
  19. EXPECT_TRUE(statechart->isActive(StringExpressions::StringExpressions_main_region_StateA));
  20. EXPECT_TRUE(strcmp(statechart->getSCInterface()->get_myString(), "hello") == 0);
  21. EXPECT_TRUE(strcmp(statechart->getSCInterface()->get_myString2(), "world") == 0);
  22. EXPECT_TRUE(strcmp(statechart->getSCInterface()->get_quotedString(), "'y'") == 0);
  23. statechart->raise_e1();
  24. statechart->runCycle();
  25. EXPECT_TRUE(statechart->isActive(StringExpressions::StringExpressions_main_region_StateB));
  26. EXPECT_TRUE(statechart->getSCInterface()->get_equals()== false);
  27. EXPECT_TRUE(statechart->getSCInterface()->get_notEqual()== true);
  28. EXPECT_TRUE(strcmp(statechart->getSCInterface()->get_quotedString(), "\"z\"") == 0);
  29. delete statechart;
  30. }