StatemachineKeywords.cc 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* Generated by YAKINDU Statechart Tools code generator. */
  2. #include "gtest/gtest.h"
  3. #include "StatechartKeywords.h"
  4. #include "StatechartKeywordsRequired.h"
  5. #include "sc_timer_service.h"
  6. //! The timers are managed by a timer service. */
  7. static sc_unit_timer_service_t timer_service;
  8. static StatechartKeywords statechart;
  9. class StatemachineKeywords : public ::testing::Test{
  10. protected:
  11. virtual void SetUp() {
  12. statechartKeywords_init(&statechart);
  13. sc_timer_service_init(
  14. &timer_service,
  15. (sc_raise_time_event_fp) &statechartKeywords_raiseTimeEvent,
  16. (sc_run_cycle_fp) &statechartKeywords_runCycle,
  17. false,
  18. 200,
  19. &statechart
  20. );
  21. }
  22. };
  23. TEST_F(StatemachineKeywords, statemachineKeywords) {
  24. statechartKeywords_enter(&statechart);
  25. EXPECT_TRUE(statechartKeywords_isStateActive(&statechart, StatechartKeywords_main_region_Timer));
  26. }
  27. void statechartKeywords_setTimer(StatechartKeywords* statechart, const sc_eventid evid, const sc_integer time_ms, const sc_boolean periodic){
  28. sc_timer_t timer;
  29. sc_timer_init(&timer, time_ms, periodic, evid);
  30. insert_timer(&timer_service, timer);
  31. }
  32. void statechartKeywords_unsetTimer(StatechartKeywords* handle, const sc_eventid evid){
  33. delete_task(&timer_service, find_time_event(&timer_service, evid));
  34. }
  35. void statechartKeywordsIfaceIf_myOperation(const StatechartKeywords* statechart){
  36. }
  37. void statechartKeywordsInternal_myOperation(const StatechartKeywords* statechart){
  38. }