/* * main.c * * Created on: 16.11.2011 * Author: showcase */ #include #include #include #include #include "Timer.h" #include "DummyTimer.h" #include "Test_LocalActionsStatemachine.h" /*@DTestSuite: LocalActions Statechart Test (Test_LocalActions.sct) */ #define MAXEVENTSPERTYPE 4 const char* stateName[6] = {"State1", "State2", "State3", "State4", "State5", "State6"}; void setupStatemachine(Test_LocalActionsStatemachine* machine, Timer* dummyTimer, EventPool* eventPool) { /* set up dummy Timer */ dummyTimer_init(dummyTimer); /* Set up Event Pool */ test_LocalActions_eventPool_init_heap(eventPool, MAXEVENTSPERTYPE); /* initialize state machine */ test_LocalActionsStatemachine_init(machine, dummyTimer, eventPool); /* call all necessary enter functions */ test_LocalActionsStatemachine_enter(machine); } void teardownStatemachine(Test_LocalActionsStatemachine* machine, Timer* dummyTimer, EventPool* eventPool) { /* call all exit actions for this state machine */ test_LocalActionsStatemachine_exit(machine); /* free all internal memory for this state machine */ test_LocalActionsStatemachine_destruct(machine); /* free the timer */ timer_exit(dummyTimer); /* free all events in the event pool */ eventPool_exit(eventPool); } /*@Test: test_default_var1 test behavior of var1 in default interface */ int test_initialization() { return 0; } /*@Test: test_state9_state10_transition test behavior of var1 in default and other interface */ int dummy1() { Test_LocalActionsStatemachine machine; Timer dummyTimer; EventPool eventPool; /*@Desc: setup initial statemachine */ setupStatemachine(&machine, &dummyTimer, &eventPool); /*@Desc: teardown statemachine */ teardownStatemachine(&machine, &dummyTimer, &eventPool); return 0; } /*@Test: test_default_var1 test behavior of var1 in default and other interface */ int dummy2() { Test_LocalActionsStatemachine machine; Timer dummyTimer; EventPool eventPool; /*@Desc: setup initial statemachine */ setupStatemachine(&machine, &dummyTimer, &eventPool); /*@Desc: run an explicit cycle - without any waiting event (for initialization) */ test_LocalActionsStatemachine_runCycle(&machine); /*@Desc: */ /*@Desc: teardown statemachine */ teardownStatemachine(&machine, &dummyTimer, &eventPool); return 0; } int main(int argc, char** argv) { if (argc != 2) return -1; switch (atoi(argv[1])) { case 1: return dummy1(); case 2: return dummy2(); } return -1; }