Mycology
The Befunge-98 test suite.
Install / Use
/learn @Deewiant/MycologyREADME
This is the Mycology Befunge-98 test suite, by Matti "Deewiant" Niemenmaa.
To contact me, E-mail me. The address for Mycology-related things is matti.niemenmaa+mycology at the domain iki.fi.
Mycology is licensed under the so-called 3-clause BSD license. See license.txt for the text of the license.
Contents of this readme: Recent changes Quick summary More detailed info Fingerprints Notes on particular messages "# across left edge" "101-{}" "4k #" and "2k ;;;5" "2k6" Old changes
Recent changes
2011-02-07 - Make the 1k[ error message not rely on stringmode having
working spaces.
2010-04-01 - Fixed error message in bounds shrinking test.
2010-03-25 - New fingerprints: REXP and FING.
- The y position error is no longer fatal.
- Fixed stack misalignment in y test with bad storage offset.
- Test o in linear text file mode. Thanks to Arvid Norlander
for pointing out that it is possible after all.
2010-03-23 - New fingerprint: 3DSP.
2010-03-21 - Made the u complaint about the storage offset BAD, not
UNDEF: in most cases it's an error and the tester should
know when it isn't anyway.
2010-03-20 - Test proper bounds shrinking by y.
2010-03-19 - Test correct form feed handling.
- Made the first negative space test use (-3,-2) instead of
(-1,-1).
2010-03-18 - Don't test o if y claims it isn't supported.
- INDV: check proper storage offset application.
- Test ' with a value greater than 127.
For pre-2010 changes, see the full changelog at the bottom of the file.
Quick summary of how to test your Befunge interpreter:
- If, at any point, you get messages beginning with "BAD:", correct the
issues before moving on to the next step.
- If your interpreter needs any command line switches for
standard-conforming mode, use them.
- Run sanity.bf and make sure it outputs "0 1 2 3 4 5 6 7 8 9 ".
- Run mycology.b98, make sure it outputs "0 1 2 3 4 5 6 7 " and that there
are no lines beginning with "BAD:" anywhere in the output.
- If your interpreter is Befunge-93 only or is Befunge-98 and doesn't
support the i instruction, run mycorand.bf and examine the results.
- Run mycouser.b98: for complete testing, run it a few times and try giving
it both valid and invalid input.
- If your interpreter should support one or both of the NCRS and TERM
fingerprints, run mycoterm.b98.
- If your interpreter should support the TRDS fingerprint, run mycotrds.b98.
More detailed info:
Files with the .bf extension are valid Befunge-93 source code, while *.b98 are intended for Befunge-98 interpreters. mycology.b98 and mycouser.b98 are exceptions: they work in both standards - if the standards are implemented correctly.
Note for Befunge-93: mycology.b98 is much bigger than the 80x25 allowed in Befunge-93. If your interpreter bails out on a file bigger than the maximum allowed, you can simply take the 80x25 square starting at the top left corner of mycology.b98 into a separate file and use that for testing.
In order to test the absolute basics of the interpreter, feed it the file sanity.bf. This tests that the IP (instruction pointer) begins at the correct point in Funge-Space and moves in the correct direction. In addition, it makes sure the following instructions work:
Decimal ASCII Instruction
32 Space 35 # Trampoline 46 . Output Decimal 48 0 Push Zero 49 1 Push One 50 2 Push Two 51 3 Push Three 52 4 Push Four 53 5 Push Five 54 6 Push Six 55 7 Push Seven 56 8 Push Eight 57 9 Push Niner 64 @ Stop
The above are the absolute minimum which the interpreter must support. In addition, it should reflect upon encountering an instruction it does not recognize.
sanity.bf will, if the interpreter supports all of the above, output the string "0 1 2 3 4 5 6 7 8 9 ". If it doesn't, anything might happen: sanity.bf does not fail safe.
Hereafter the actual testing in mycology.b98 can be conducted. The initial behaviour of the program is to output a code, using the Output Decimal instruction, after having successfully tested a certain instruction. These codes are as follows:
Code Decimal ASCII Instruction Notes
0 62 > Go East 1 118 v Go South 2 60 < Go West 3 94 ^ Go North 4 36 $ Pop Explicitly testing whether popping an empty stack works as it should is done separately, later.
5 34 " Toggle Stringmode If no reflection on the instruction occurs, but the string's contents are interpreted as instructions, a second "4 " is output before exiting.
6 95 _ East-West If If the comparison is done incorrectly (i.e. the wrong direction is taken) an additional "5 " is output.
7 43 + Add
For example, if the interpreter emits only "0 1 ", the Go East and Go South instructions were correctly interpreted, but a reflection occurred upon meeting Go West. A conforming interpreter should output every code in the listing once.
These tests are very simple, due to the basic nature of the instructions involved. All that is tested is whether a reflection occurs or not. If mycology.b98 claims that an instruction which appears to work perfectly is failing, make sure that the above do what they should.
Having tested the above, mycology.b98 tests the Output Character instruction and hence reverts to plain English output. If there is no output after code 7, the Output Character instruction does not function as it should.
The output format changes to lines beginning with "BAD:" or "GOOD:", followed by a description of what the interpreter does wrong or correctly, respectively. Some, but not all, "BAD" lines are followed by a Stop instruction - these tend to be features which are deemed useful enough that they are used later in the program. (Or, possibly, features which may be used later, but aren't: it's hard to modify Befunge source code after it's first written, so there may be some cases where a Stop isn't necessary but is there anyway.) In some cases, a Stop was added to simplify the code: the Befunge-93 area is particularly snarly, since space is at a premium.
Some lines begin with "UNDEF:". This means that the specification is either ambiguous or completely ignorant of an issue, and so different possibilities are acceptable. It is possible that some such undefined cases may result in "BAD:" if the interpreter does something completely unexpected, but there is no "GOOD:" equivalent, only "UNDEF:".
Some comment lines not beginning with "BAD:", "GOOD:", or "UNDEF:" are also emitted occasionally, in order to clarify what is going on.
Other notes on mycology.b98:
Befunge-93 detection relies on the interpreter using only the first 80
characters of lines, since Befunge-93 has a Funge-Space of 80x25 cells.
The checks are generally very simple. For instance, if the Subtract or
Multiply instructions empty the stack, they will be considered to work
properly: only a few checks are done, and they all check for zero.
Instructions are assumed to work if they pass one test (for the more
complicated instructions, more tests are needed, but every behaviour of the
instruction is still tested only once). If, for instance, an instruction
works the first 41 times and randomly fails every third time after that,
Mycology will probably not detect it, but will silently fail or, in the
worst case, pass.
Instructions are assumed to be at least somewhat sane: e.g. | should either
reflect or pop a cell and cause the IP to start moving north or south. Not
east or west, or to teleport to a random location in Funge- Space, or push
72 ampersands onto the stack. It is the tester's responsibility, not
Mycology's, to make sure that the interpreter doesn't go crazy and perform
malicious acts. You use Mycology at your own risk.
See the end of this file for notes on particular messages.
The following instructions are not tested by mycology.b98 (those preceded by an asterisk are tested if the interpreter is detected as supporting Befunge-98):
Decimal ASCII Instruction
37 % *Remainder 38 & Input Decimal 47 / *Divide 61 = Execute 63 ? *Go Away 126 ~ Input Character
The division and input instructions are tested in mycouser.b98 because they all require user intervention (the division instructions only when dividing by zero, but I felt it would be better to not split the testing of an instruction into two files). Their correct behaviour is also very difficult to verify without a knowledgeable user.
Go Away is tested separately in mycorand.bf because it takes too much space to fit in the Befunge-93 area of mycology.b98. If the Befunge-98 instruction Input File works, mycorand.bf is loaded using it and Go Away is thus tested in mycology.b98.
Execute is completely untested, because to get a reliable result would require testing various commands and noting their behaviours on different platforms. An educated guess regarding the user's platform is in order, and overall it would be too complicated. It is simplest to test this
