IntegerExpressionsTest.cc 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 "IntegerExpressions.hpp"
  14. TEST(StatemachineTest, integerExpressions) {
  15. IntegerExpressions* statechart = new IntegerExpressions();
  16. statechart->init();
  17. statechart->enter();
  18. EXPECT_TRUE(statechart->isActive(IntegerExpressions_main_region_StateA));
  19. EXPECT_TRUE(statechart->getSCInterface().get_myInt1()== 10);
  20. EXPECT_TRUE(statechart->getSCInterface().get_myInt2()== 5);
  21. statechart->raise_e1();
  22. statechart->runCycle();
  23. EXPECT_TRUE(statechart->getSCInterface().get_less()== false);
  24. EXPECT_TRUE(statechart->getSCInterface().get_greater()== true);
  25. EXPECT_TRUE(statechart->getSCInterface().get_equalOrLess()== false);
  26. EXPECT_TRUE(statechart->getSCInterface().get_equalOrGreater()== true);
  27. EXPECT_TRUE(statechart->getSCInterface().get_equal()== false);
  28. EXPECT_TRUE(statechart->getSCInterface().get_notEqual()== true);
  29. EXPECT_TRUE(statechart->getSCInterface().get_plus()== 15);
  30. EXPECT_TRUE(statechart->getSCInterface().get_minus()== 5);
  31. EXPECT_TRUE(statechart->getSCInterface().get_multiply()== 50);
  32. EXPECT_TRUE(statechart->getSCInterface().get_division()== 2);
  33. EXPECT_TRUE(statechart->getSCInterface().get_modulo()== 0);
  34. EXPECT_TRUE(statechart->getSCInterface().get_negat()== - 10 );
  35. EXPECT_TRUE(statechart->getSCInterface().get_multiAssign()== 20);
  36. EXPECT_TRUE(statechart->getSCInterface().get_divAssign()== 2);
  37. EXPECT_TRUE(statechart->getSCInterface().get_plusAssign()== 12);
  38. EXPECT_TRUE(statechart->getSCInterface().get_minusAssign()== - 8 );
  39. EXPECT_TRUE(statechart->getSCInterface().get_moduloAssign()== 0);
  40. delete statechart;
  41. }