CS20a - Lab3 Test Cases

Methodology and output

There were six test cases for lab3. The general methodology was as follows:

  1. Copy nfa.ml out of the Osaka submission tree to a ``safe location'' and verify that it compiles without errors. We copy it to a ``safe location'' so that we can modify the file without having to touch the original submission.
  2. Run each of the test cases. Running a test case involved:
    1. Patching nfa.ml with the fix for the ')' bug in the regex->string code.
    2. Replacing the coded set of patterns with the pattern for the test case by using a patch file.
    3. Compiling the modified nfa.ml.
    4. Running the program produced over the input file for the test case and using ``diff'' to compare the output of the program with the expected output.
  3. Attempt to debug any errors the code exhibited.

Scripts were used to automate steps 1 and 2 above, and those are the steps responsible for the output from the ``scripted test cases''. The output for a given test case began with

*******Starting XXX test...

The two lines following that are the output from ``patch''.

Now here's the somewhat confusing part. If the code passed the test case, you will not see anything more; the output from the next case will immediately follow. If the test case failed, you may see output along the lines of

< Syntax error: char 0 = '\n'
---
> Input symbol: "\n"
> Input symbol: "a\n"
> Input symbol: "aa\n"
> Input symbol: "aaa\n"

Lines preceded by a '<' were produced by the program. Lines preceded by a '>' were what was expected from the program.

The test cases

For each test case, the following files have been posted:

The pattern is also explicitly listed below.

Choice (union) test

Concatenation test

Character set (symbol set) test

Kleene-star test

Note that the input file begins with a blank line.

General test

Note that the pattern above will not work as intended without the patch for ')'.

Given test