Writing Tests

In three occasions tests are “easy” to write:

  • The specifications of the language are a fine source for many tests. For instance the specification of integer literals show several cases to exercise.

  • If your compiler crashes or fails, before even trying to fix it, include the test case in your test suite.

  • If you are developing a component for the compiler, you can certainly feel the weak points. Immediately write a test for these.

See Testing student-made compilers, for many hints on what tests you need to write.