BooleanExpressionsTest.cc 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * Copyright (c) 2017 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 "BooleanExpressions.h"
  14. #include "sc_types.h"
  15. static BooleanExpressions* statechart;
  16. class StatemachineTest : public ::testing::Test{
  17. protected:
  18. virtual void SetUp() {
  19. statechart = new BooleanExpressions();
  20. statechart->init();
  21. }
  22. virtual void TearDown() {
  23. delete statechart;
  24. }
  25. };
  26. TEST_F(StatemachineTest, booleanExpressions) {
  27. statechart->enter();
  28. EXPECT_TRUE(statechart->isStateActive(BooleanExpressions::main_region_StateA));
  29. EXPECT_TRUE(statechart->getDefaultSCI()->get_myBool1()== true);
  30. EXPECT_TRUE(statechart->getDefaultSCI()->get_myBool2()== false);
  31. statechart->getDefaultSCI()->raise_e1();
  32. statechart->runCycle();;
  33. EXPECT_TRUE(statechart->isStateActive(BooleanExpressions::main_region_StateB));
  34. EXPECT_TRUE(statechart->getDefaultSCI()->get_and()== false);
  35. EXPECT_TRUE(statechart->getDefaultSCI()->get_or()== true);
  36. EXPECT_TRUE(statechart->getDefaultSCI()->get_not()== false);
  37. EXPECT_TRUE(statechart->getDefaultSCI()->get_equal()== false);
  38. EXPECT_TRUE(statechart->getDefaultSCI()->get_notequal()== true);
  39. }