BitExpressionsTest.cc 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * Copyright (c) 2014 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 "BitExpressions.h"
  14. TEST(StatemachineTest, BitExpressions) {
  15. BitExpressions* statechart = new BitExpressions();
  16. statechart->init();
  17. statechart->enter();
  18. EXPECT_TRUE(statechart->isActive(BitExpressions::StateA));
  19. EXPECT_TRUE(statechart->getSCInterface()->get_myBit1()== 5);
  20. EXPECT_TRUE(statechart->getSCInterface()->get_myBit2()== 7);
  21. statechart->raise_e1();
  22. statechart->runCycle();
  23. EXPECT_TRUE(statechart->isActive(BitExpressions::StateB));
  24. EXPECT_TRUE(statechart->getSCInterface()->get_leftBitshift()== 10);
  25. EXPECT_TRUE(statechart->getSCInterface()->get_rightBitshift()== 2);
  26. EXPECT_TRUE(statechart->getSCInterface()->get_complementBitshift()== - 6 );
  27. EXPECT_TRUE(statechart->getSCInterface()->get_bitwiseAnd()== 5);
  28. EXPECT_TRUE(statechart->getSCInterface()->get_bitwiseOr()== 7);
  29. EXPECT_TRUE(statechart->getSCInterface()->get_bitwiseXor()== 2);
  30. delete statechart;
  31. }