Tests

PyFunge source distribution contains some test suites in tests/. You check out them against current PyFunge version with pyfunge-test shell script:

$ ./pyfunge-test
Done, XX out of XX test(s) passed.

This section discusses how the tests are organized and written.

Test format

Each test requires at least two files:

  • Test program: testname.bf, testname.u98, testname.b98 or testname.t98, according to the language.
  • Expected result: testname.expected. It contains an ignored newline at the end, for convenience. (Many text editors always append one newline at the end of file.)

There are several optional files:

  • Input data: testname.input. It is fed into the pyfunge script.
  • Additional options: testname.options. For example, you can include --disable-fprint option in it to disable all fingerprints.

Test categories

tests/ directory contains some directories to organize tests:

  • befunge93/: Tests for Befunge-93 language.
  • befunge98/: Tests for Befunge-98 language.
  • unefunge98/: Tests for Unefunge-98 language.
  • trefunge98/: Tests for Trefunge-98 language.
  • concurrent/: Tests for concurrent Funge-98.
  • fingerprints/fprintname/: Tests for each fingerprints.

These directories are not important to the test script: they are just for convenience.

Test against Mycology suite

PyFunge contains a convenience script called mycology-filter in tools/ directory of the source distribution. This script, written in awk(1), highlights the result from Mycology test suite – it also analyzes some UNDEF lines and marks it as GOOD or BAD line if possible. It also distinguishes UNDEF lines due to the specification and UNDEF lines due to the limitation of test suite (i.e. UNSURE), so you have to check out only UNSURE lines.

Typical usage is as like this:

$ pyfunge mycology.b98 | mycology-filter
0 1 2 3 4 5 6 7
GOOD: , works
GOOD: : duplicates
GOOD: empty stack pops zero
[...]

The Mycology Befunge-98 test suite is practically done.
Trying to quit with q. If the return status is 15, consider it GOOD...

*** GOOD 365, BAD 0, UNDEF 49, UNSURE 64

Note that this script does not preserve the exit code, and you should check it by hand. This script is also not capable for mycoterm or mycouser tests.

Table Of Contents

Previous topic

Extending PyFunge

Next topic

Changes in PyFunge

This Page

Quick search