|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnz.ac.waikato.modeljunit.examples.FSM
public class FSM
Simple example of a finite state machine (FSM) for testing.
Constructor Summary | |
---|---|
FSM()
|
Method Summary | |
---|---|
void |
action0()
|
boolean |
action0Guard()
|
void |
action1()
|
boolean |
action1Guard()
|
void |
action2()
|
boolean |
action2Guard()
|
void |
actionNone()
|
boolean |
actionNoneGuard()
|
java.lang.String |
getState()
Return the current state of the FSM model. |
static void |
main(java.lang.String[] args)
This main method illustrates how we can use ModelJUnit to generate a small test suite. |
void |
reset(boolean testing)
Reset the model to its initial state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FSM()
Method Detail |
---|
public java.lang.String getState()
FsmModel
Advanced Feature: This method can be used to define
equivalence classes over the states, if you want to reduce
the number of states to keep the FSM small.
For example, if you have a integer state variable I that can
have a huge number of possible values, you could define your
getState() method to return new Integer(I % 10)
.
This would reduce the FSM to just 10 states, where FSM state 0
represents all the states where I=0 or I=10 or I=20 etc., and
FSM state 1 represents all the states where I=1 or I=11 or I=21 etc.
getState
in interface FsmModel
public void reset(boolean testing)
FsmModel
reset
in interface FsmModel
testing
- true means the SUT should be reset too.public boolean action0Guard()
public void action0()
public boolean action1Guard()
public void action1()
public boolean action2Guard()
public void action2()
public boolean actionNoneGuard()
public void actionNone()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |