OUTPUT
/* This should generate the appropriate import statements. */
import java.util.*;
import Motorola.ControlPanel.*;
import Motorola.M_Classes.*;
/* This should generate a M_<token> */
M_Button SampleButton = new M_Button;
/* This should generate the insertion of the HotKey for the */
/* control panel. */
public boolean handleEvent( Event e )
{
if((%s.id==Event.KEY_PRESS)&&(%s.key==Event.F1))
{
ControlPanel controlPanelFrame = new ControlPanel();
controlPanelFrame.show();
}
/* The HotKey code should be added just above this line. */
if( (e.id == Event.ACTION_EVENT) && (e.target instanceof Choice) )
{
// do stuff
}
}
Loop and Condition Coverage Plan:
There are only three main branches in the parser
and they've been covered within the Invocation Coverage Plan.
It then follows that the branch coverage plan has been explored
within the previous coverage plan. The Loop and Conditional Coverage
Plan can also be combined into a common test 'umbrella'. It should
be noted that the only loop of any significance is the main while
loop that runs that parser from the module 'parse' through 'getToken'
and then to the proper function. Here the conditions we are looking
for are those that implement one of the following conditions of
our parser:
1.) Recognize the proper token and convert it to the appropriate M_<token>.
2.) Adding the M_Class import section to the import section of the file.
3.) Adding the Control Panel HotKey to the event handler.
4.) Recognize a parsing condition in the proper
context.
However the input needed for this section is not as simple as before. Here we need to have input that supports every supported token in our library. For the input file we can use a single file that contains all possible tokens and a eventHandler. In this way we can simply pass supported tokens in as input and then check the output file to observe that they were converted properly.
Page 11 |
Document Index |
Page 13 |