StringExpressions.cc 1.4 KB

12345678910111213141516171819202122232425262728293031
  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 handle;
  16. stringExpressions_init(&handle);
  17. EXPECT_TRUE(strcmp(stringExpressionsIface_get_quotedString(&handle) , "\"x\"") == 0);
  18. stringExpressions_enter(&handle);
  19. EXPECT_TRUE(stringExpressions_isActive(&handle, StringExpressions_main_region_StateA));
  20. EXPECT_TRUE(strcmp(stringExpressionsIface_get_myString(&handle) , "hello") == 0);
  21. EXPECT_TRUE(strcmp(stringExpressionsIface_get_myString2(&handle) , "world") == 0);
  22. EXPECT_TRUE(strcmp(stringExpressionsIface_get_quotedString(&handle) , "'y'") == 0);
  23. stringExpressionsIface_raise_e1(&handle);
  24. stringExpressions_runCycle(&handle);
  25. EXPECT_TRUE(stringExpressions_isActive(&handle, StringExpressions_main_region_StateB));
  26. EXPECT_TRUE(stringExpressionsIface_get_equals(&handle) == false);
  27. EXPECT_TRUE(stringExpressionsIface_get_notEqual(&handle) == true);
  28. EXPECT_TRUE(strcmp(stringExpressionsIface_get_quotedString(&handle) , "\"z\"") == 0);
  29. }