[ _get_child o expected result;
@get_child o -> result ?L2;
print "@@64get_child ", o, " => ", result;
if (expected)
" (incorrect)";
" (correct)";
.L2;
print "@@64get_child ", o, " => ", result;
if (expected)
" (correct)";
" (incorrect)";
];
[ _get_parent o expected result;
@get_parent o -> result;
print "@@64get_parent ", o, " => ", result;
if (result)
result = true;
if (expected == result)
" (correct)";
" (incorrect)";
];
[ _get_sibling o expected result;
@get_sibling o -> result ?L3;
print "@@64get_sibling ", o, " => ", result;
if (expected)
" (incorrect)";
" (correct)";
.L3;
print "@@64get_sibling ", o, " => ", result;
if (expected)
" (correct)";
" (incorrect)";
];
[ _get_prop_addr o p expected result;
@get_prop_addr o p -> result;
print "@@64get_prop_addr ", o, " ", p, " => ", result;
if (result)
result = true;
if (result == expected)
" (correct)";
" (incorrect)";
];
[ _get_prop o p expected result;
@get_prop o p -> result;
print "@@64get_prop ", o, " ", p, " => ", result;
if (result)
result = true;
if (result == expected)
" (correct)";
" (incorrect)";
];
[ _clear_attr o a;
@clear_attr o a;
print_ret "@@64clear_attr ", o, " ", a;
];
[ _set_attr o a;
@set_attr o a;
print_ret "@@64set_attr ", o, " ", a;
];
[ _test_attr o a expected;
@test_attr o a ?L4;
print "@@64test_attr ", o, " ", a, " => FALSE ";
if (expected)
"(incorrect)";
"(correct)";
.L4;
print "@@64test_attr ", o, " ", a, " => TRUE ";
if (expected)
"(correct)";
if (~~o)
"(incorrect; shouldn't set attributes in object 0)";
"(incorrect)";
];
[ _get_next_prop o p expected result;
@get_next_prop o p -> result;
print "@@64get_next_prop ", o, " ", p, " => ", result;
if (result)
result = true;
if (result == expected)
" (correct)";
" (incorrect)";
];
Array buffer string 120;
Array parse string 64;
[ Main x;
print "Strict Z Test^";
print "^According to the Z-Machine Standards Document, ~objects are
numbered consecucutively from 1 upward, with object number 0
being used to mean ~nothing~ (though there is formally no such
object).~ Hence, it seems reasonable that operations on object
number 0 should either fail or, if that is not an option, do
nothing. These tests are written with that assumption.^";
print "^Please note that whenever a test is flagged as ~correct~,
that only means that an instruction returned zero or non-zero
(or branched / didn't branch) when it was supposed to. Not
that it necessarily returned the correct value. If no result
is written the result was not tested, and the test was only
included to test the stability of the interpreter.^";
print "^Would you like to make a transcript of the test results?
(Y/N) ";
for (::)
{
read buffer parse;
if (parse-->1 == 'yes' or 'y//')
{
print "^";
@output_stream 2;
break;
}
if (parse-->1 == 'no' or 'n//')
{
print "^";
break;
}
print "^(Note: An attempt has been made to set attribute number ",
attr1, " in object number 0. If the @@64test_attr test below
indicates that this attribute has been set, the interpreter
did not ignore the instruction as it should have done.)^";