This directory contains test programs for EM implementations. The test programs are all part of the file "tests". Each individual test program looks like: TEST 004: test ... ... ; data declarations etc. MAIN nlocal ... ; part of the body of MAIN PROC ... ; subroutines used by this test The PROC part is optional, so the smallest test program looks like: TEST 000: null test MAIN 0 The keywords used by "select", like TEST, MAIN, PROC, HOL, OK and ERRLAB, all consist of upper case letters and start in column one. A convention for test numbers is to use 3 digit numbers, possibly left padded with zero's. A program, called "select", is provided to combine a range of tests into a single test program. "Select" expects a range as argument, like 0-127, or -127, or 0-. Tests that have a TEST number in that range are included. "Select" also expects the file from which the tests should be selected as an argument. If no argument is given, or only a range argument, select expects the tests to slect from on standard input. To prevent name clashes, some rules must be obeyed: - data label names, procedure names and instruction label numbers must be unique over all tests. A good habit is to use the three digit test number as suffix. - only keyword of "select" may start with uppercase letters in column one, to allow for expansion in the future. - because only a single 'hol' pseudo is allowed, "select" must generate the 'hol' pseudo. An individual test may request some 'hol' space by a special HOL line, starting in column one and followed by a single number, the number of bytes needed. This number must consists of digits only, no constant symbols, because "select" must compute the maximum, so before the preprocessor has replaced the constant symbols by their values. - a similar problem is caused by the number of bytes of local storage for 'main'. An individual test may specify the number of bytes it needs as parameter to the MAIN line. Again, the number must consist of digits only. Test programs print a sequence of integers greater than 1. This sequence is terminated by the number 1 as soon as an error is detected. If all tests are performed correctedly the number 0 is printed. To allow test programs to print integers without the full machinery of conversion and i/o routines, the EM instruction 'nop' is used. Each time this instruction is executed, the current line number as maintained by the 'lin' instruction must be printed, followed by a newline, at least during debugging. The following abbrevation may be used in test programs: OK -> lin n nop Numbers are automatically assigned in order of static appearance. As soon as an error is detected you must branch to label 1, by instructions like 'bra *1' and 'zne *1'. Label 1 is automatically provided in the main routine. If you jump to label 1 in a subroutine, then that subroutine must end with ERRLAB, like in: PROC pro $test,0 ... bra *1 ... ret 0 ERRLAB end An option to "select" is to generate 'fil' instructions whenever a new test starts. This is useful if 'nop' prints the 'fil' string as well as the 'lin' number. This 'f' option is on by default, off if a '-f' flag is given. The EM file generated by "select" includes "test.h". "test.h" may contain definitions of the following symbols: W2S: the size of double precision integers, if implemented. FS: the size of single precision floats, if implemented. F2S: the size of double precision floats, if implemented. The value of these symbols, if defined, must be the size of the object involved. Two other symbols are used: EM_PSIZE: pointer size EM_WSIZE: word size The machine dependent translation program, like 8086 and vax2, give definitions of these symbols while calling the EM encode program. Because these size names occur quite often, they may be abbreviated: WS -> EM_WSIZE PS -> EM_PSIZE Before running the tests in the file "tests", it is wise to test the necessary basic functions with some simple tests like TEST 000: null MAIN 0 and TEST 001: ok MAIN 0 OK and TEST 998: error MAIN 0 bra *1 and TEST 999: test lni MAIN 0 lin 1 lni loe 0 loc 2 bne *1 OK The first two of these are part of "tests" as well. The last two are not included in "tests" intensionally, because they would fail. The last tests fails because it references the ABS block which is inaccessable after an 'hol' pseudo. Proceed as follows for each of these basic tests: - make a file called 'basic' containing the test - run select: select basic >basic.e - compile by machine basic.e - and load and run where machine should be replaced by the name of program used to compile EM programs for the current machine.