Sunday, October 20, 2013

Program – Operation Testing

With the program line operations (insert, replace and remove) implemented, some automated mechanism was needed to test them using the command line test mode.  The encoder test mode was modified to accept a special syntax at the beginning of each test line to indicate a program operation.

The syntax starts with an optional '+' for insert line and '-' for delete line.  This is followed by a line index number indicating the line that should be inserted or deleted.  If there is just a line index number, the line is replaced.  The number is followed by optional spaces (though the number ends when there are no more digits).  The number must be within the valid range for the lines currently in the program.  The number is optional after a '+' in which case, the line is appended to the end of the program, the same as if the line does not contain this syntax.  After a '-' and its number, there must be no statement.

When using this syntax, the normal "Input:" and "Output:" lines are suppressed.  This is the difference between using a lone '+' (output suppressed) and no syntax (output not suppressed) for appending a line.  After processing this syntax, the characters are removed from the line, and the appropriate call to the update slot routine is made for the specified operation to translate, encode and perform the program operation on the line.  However, if a line does have an error, the outputs are not suppressed to report the error.

Encoder test #1 still operates the way it did before since none of the lines contain this additional operation syntax.  This test was copied into new encoder test #2 where a lone '+' was added to every line.  Several additional lines were added to test #2 to test various program operations.  (Note: this test currently produces a memory error that needs to be resolved.)

[commit e6ac67e6b7]