OperationsWithoutBracesTestCustom.cc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /**
  2. * Copyright (c) 2015 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 "OperationsWithoutBraces.h"
  14. #include "OperationsWithoutBraces_OCB.h"
  15. TEST(StatemachineTest, OperationsWithoutBracesTest) {
  16. OperationsWithoutBraces* statechart = new OperationsWithoutBraces();
  17. statechart->init();
  18. statechart->enter();
  19. statechart->setDefaultSCI_OCB(new DefaultCallBack());
  20. EXPECT_TRUE(statechart->isStateActive(OperationsWithoutBraces::main_region_A));
  21. EXPECT_TRUE(statechart->isStateActive(OperationsWithoutBraces::another_region_A));
  22. statechart->runCycle();
  23. EXPECT_TRUE(statechart->isStateActive(OperationsWithoutBraces::main_region_B));
  24. EXPECT_TRUE(statechart->isStateActive(OperationsWithoutBraces::another_region_B));
  25. statechart->runCycle();
  26. EXPECT_TRUE(statechart->isStateActive(OperationsWithoutBraces::main_region_C));
  27. EXPECT_TRUE(statechart->isStateActive(OperationsWithoutBraces::another_region_C));
  28. statechart->runCycle();
  29. EXPECT_TRUE(statechart->isStateActive(OperationsWithoutBraces::main_region_D));
  30. EXPECT_TRUE(statechart->isStateActive(OperationsWithoutBraces::another_region_D));
  31. delete statechart;
  32. }
  33. sc_boolean DefaultCallBack::myBoolOp(){
  34. return false;
  35. }
  36. sc_integer DefaultCallBack::myIntOp(){
  37. return 0;
  38. }
  39. sc_real DefaultCallBack::myRealOp(){
  40. return 0.0;
  41. }