Saturday, October 13, 2012

New Test Code

The new test code design outlined on October 10 has been implemented and tested.  The old test_parser() and test_translator() functions with their test inputs, were replaced with a single test_ibcp() function that reads an input file and calls the appropriate function based on the type.  The ibcp program command lines options have changed as shown:
ibcp -t <testfile>
ibcp -tp|-te|-tt
The first command form specifies the test file, which contains the tests inputs.  The test code determines the type of file by the beginning of its name (parser, expression, or translator).  The file name may contain anything after the type, including any extension.  Blank lines and comment lines (first character '#') are ignored.  The second command form activates the interactive mode when the program asks for each input for one of the three types.  The new expression type needs further explanation. 

Early in the translator development, the translator only processed expressions.  The first four tests only have expressions.  This implementation was left in the code and was changed to be activated only if an expression only flag is passed to the translator.  The old test code set this flag for the first four tests.  To keep things simple, since the file name is being used to detect the type, this was extended by the new expression type.

The expected result files were renamed accordingly.  Also, the translator tests were given two digit test numbers, with a leading 0 for the first nine tests, so that these would be processed in order by the regression test scripts.  The new test input files were given a ".dat" extension.  The code was also modified to not output the ".exe" with the program name in the header of the output so that Windows and Linux output matches.  Now the regression test scripts need to be updated.

No comments:

Post a Comment

All comments and feedback welcomed, whether positive or negative.
(Anonymous comments are allowed, but comments with URL links or unrelated comments will be removed.)