mirror of
https://github.com/ganelson/inform.git
synced 2024-07-16 22:14:23 +03:00
150 lines
3.3 KiB
INI
Executable file
150 lines
3.3 KiB
INI
Executable file
Constant Story "IndivPropTest";
|
|
Constant Headline "Not a game.^";
|
|
|
|
Release 1;
|
|
|
|
! This is a compiler unit test for "Property individual" declarations.
|
|
|
|
#ifdef TARGET_ZCODE;
|
|
Constant HDR_GAMERELEASE = $02; ! word
|
|
Constant HDR_GAMESERIAL = $12; ! six ASCII characters
|
|
#ifnot;
|
|
Global gg_mainwin;
|
|
Constant HDR_GLULXVERSION $04; ! long word
|
|
Constant ROM_GAMERELEASE $34; ! short word
|
|
Constant ROM_GAMESERIAL $36; ! six ASCII characters
|
|
#endif; ! TARGET_GLULX
|
|
|
|
Global failures;
|
|
|
|
[ Main;
|
|
#ifdef TARGET_GLULX;
|
|
@setiosys 2 0;
|
|
@push 201; @push 3; @push 0; @push 0; @push 0;
|
|
@glk $0023 5 gg_mainwin;
|
|
|
|
@push gg_mainwin;
|
|
@glk $002F 1 0;
|
|
#endif; ! TARGET_GLULX
|
|
|
|
Banner();
|
|
new_line;
|
|
RunTest();
|
|
];
|
|
|
|
[ Banner ix;
|
|
if (Story ~= 0) {
|
|
#ifdef TARGET_ZCODE;
|
|
#ifV5; style bold; #Endif;
|
|
print (string) Story;
|
|
#ifV5; style roman; #Endif;
|
|
#ifnot; ! TARGET_GLULX;
|
|
glk($0086, 3); ! set header style
|
|
print (string) Story;
|
|
glk($0086, 0); ! set normal style
|
|
#Endif; ! TARGET_
|
|
}
|
|
if (Headline ~= 0) print ": ", (string) Headline;
|
|
#ifdef TARGET_ZCODE;
|
|
print "Release ", (HDR_GAMERELEASE-->0) & $03ff, " / Serial number ";
|
|
for (ix=0 : ix<6 : ix++) print (char) HDR_GAMESERIAL->ix;
|
|
#ifnot; ! TARGET_GLULX;
|
|
print "Release ";
|
|
@aloads ROM_GAMERELEASE 0 ix;
|
|
print ix;
|
|
print " / Serial number ";
|
|
for (ix=0 : ix<6 : ix++) print (char) ROM_GAMESERIAL->ix;
|
|
#Endif; ! TARGET_
|
|
print " / Inform v"; inversion;
|
|
print ", compiler options ";
|
|
ix = false;
|
|
#ifdef STRICT_MODE;
|
|
print "S"; ix++;
|
|
#Endif; ! STRICT_MODE
|
|
#ifdef INFIX;
|
|
print "X"; ix++;
|
|
#ifnot;
|
|
#ifdef DEBUG;
|
|
print "D"; ix++;
|
|
#Endif; ! DEBUG
|
|
#Endif; ! INFIX
|
|
if (~~ix) print "(none)";
|
|
new_line;
|
|
|
|
#ifdef TARGET_GLULX;
|
|
@gestalt 1 0 ix;
|
|
print "Interpreter version ", ix / $10000, ".", (ix & $FF00) / $100,
|
|
".", ix & $FF, " / ";
|
|
@gestalt 0 0 ix;
|
|
print "VM ", ix / $10000, ".", (ix & $FF00) / $100, ".", ix & $FF, " / ";
|
|
ix = HDR_GLULXVERSION-->0;
|
|
print "game file format ", ix / $10000, ".", (ix & $FF00) / $100, ".", ix & $FF, "^";
|
|
#Endif; ! TARGET_GLULX
|
|
];
|
|
|
|
[ check_value val1 val2;
|
|
print val1;
|
|
if (val1 ~= val2) {
|
|
failures++;
|
|
print " (ERROR, should be ", val2, ")";
|
|
}
|
|
];
|
|
|
|
! Common property, additive, called "long"
|
|
Property additive long;
|
|
|
|
! Common property "individual" with default 11
|
|
Property individual 11;
|
|
|
|
! Common property "additive" with default 12
|
|
Property additive 12;
|
|
|
|
Class cla
|
|
with long 2 3;
|
|
|
|
Object obj1
|
|
class cla,
|
|
with long 4 5;
|
|
|
|
#ifdef LONG_PROP_WARN;
|
|
! Individual property "iprop". (This line generates a warning.)
|
|
Property long individual iprop;
|
|
#endif;
|
|
|
|
Object obj2
|
|
with iprop 7;
|
|
|
|
[ RunTest;
|
|
|
|
print "obj1 provides long: ";
|
|
check_value(obj1 provides long, true);
|
|
print ".^";
|
|
|
|
print "obj1.#long: ";
|
|
check_value(obj1.#long, 4*WORDSIZE);
|
|
print ".^";
|
|
|
|
print "obj1 provides individual: ";
|
|
check_value(obj1 provides individual, false);
|
|
print ".^";
|
|
|
|
print "obj1.individual: ";
|
|
check_value(obj1.individual, 11);
|
|
print ".^";
|
|
|
|
print "obj1.additive: ";
|
|
check_value(obj1.additive, 12);
|
|
print ".^";
|
|
|
|
print "obj2.iprop: ";
|
|
check_value(obj2.iprop, 7);
|
|
print ".^";
|
|
|
|
new_line;
|
|
if (failures == 0)
|
|
print "All passed.^";
|
|
else
|
|
print failures, " errors!^";
|
|
];
|
|
|