1
{****************************************************************}
2
{ CODE GENERATOR TEST PROGRAM }
3
{****************************************************************}
4
{ NODE TESTED : secondnot() }
5
{****************************************************************}
6
{ PRE-REQUISITES: secondload() }
8
{****************************************************************}
9
{ DEFINES: VERBOSE = Write test information to screen }
10
{ FPC = Target is FreePascal compiler }
11
{****************************************************************}
16
{****************************************************************}
19
{----------------------------------------------------}
21
{ CURRENT NODE (result) }
24
{ LEFT NODE (value to complement) }
25
{ possible cases : int64,byte,word,longint }
28
{ - LOC_REFERENCE / LOC_MEM }
32
{----------------------------------------------------}
36
type smallint = integer;
39
function getintres : smallint;
44
function getbyteboolval : boolean;
46
getbyteboolval := TRUE;
49
procedure test(value, required: longint);
51
if value <> required then
53
writeln('Got ',value,' instead of ',required);
65
byteboolval : bytebool;
66
wordboolval : wordbool;
67
longboolval : longbool;
68
byteboolres : bytebool;
69
wordboolres : wordbool;
70
longboolres : longbool;
75
WriteLn('------------------------------ LONGINT --------------------------------');
76
{ CURRENT NODE: REGISTER }
77
{ LEFT NODE : REFERENCE }
78
WriteLn('(current) : LOC_REGISTER; (left) : LOC_REFERENCE');
80
longres := not longres;
81
Write('Value should be $80808080...');
83
{ the following test give range check errors }
85
test(longres,$80808080);
87
{ CURRENT NODE : REGISTER }
88
{ LEFT NODE : REGISTER }
89
WriteLn('(current) : LOC_REGISTER; (left) : LOC_REGISTER');
90
longres := not getintres;
91
Write('Value should be $8080...');
92
test(longres, $FFFF8080);
94
WriteLn('----------------------------- BOOLEAN -----------------------------------');
96
{ CURRENT NODE : LOC_REGISTER }
97
{ LEFT NODE : LOC_REFERENCE }
98
WriteLn('(current) : LOC_REGISTER; (left) : LOC_REFERENCE');
100
byteboolres := not byteboolval;
101
Write('Value should be FALSE...');
102
test(ord(byteboolres),0);
105
wordboolres := not wordboolval;
106
Write('Value should be FALSE...');
107
test(longint(wordboolres),0);
110
longboolres := not longboolval;
111
Write('Value should be FALSE...');
112
test(longint(longboolres),0);
114
{ CURRENT NODE : LOC_REGISTER }
115
{ LEFT NODE : LOC_REGISTER }
116
WriteLn('(current) : LOC_REGISTER; (left) : LOC_REGISTER');
117
longboolres := not getbyteboolval;
118
Write('Value should be FALSE...');
119
test(longint(longboolres),0);
121
{ CURRENT NODE : LOC_FLAGS }
122
{ LEFT NODE : LOC_FLAGS }
123
WriteLn('(current) : LOC_FLAGS; (left) : LOC_FLAGS');
126
byteboolres:= not ((intres = 1));
127
Write('Value should be FALSE...');
128
test(ord(byteboolres),0);
130
{ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! }
131
{ CURRENT_NODE : LOC_JUMP }
132
{ ???????????????????????}
134
{ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! }
135
{ CURRENT_NODE : LOC_FLAGS }
136
{ LEFT NODE : <> LOC_FLAGS }
137
{ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! }
139
WriteLn('------------------------------ INT64 ----------------------------------');
140
{ CURRENT NODE: REGISTER }
141
{ LEFT NODE : REFERENCE }
142
WriteLn('(current) : LOC_REGISTER; (left) : LOC_REFERENCE');
143
int64res := $7F7F7F7F;
144
int64res := not int64res;
145
Write('Value should be $80808080...');
146
test(int64res and $FFFFFFFF,$80808080);
148
{ CURRENT NODE : REGISTER }
149
{ LEFT NODE : REGISTER }
150
WriteLn('(current) : LOC_REGISTER; (left) : LOC_REGISTER');
151
int64res := not (word(getintres));
152
Write('Value should be $8080...');
153
test(int64res and $FFFFFFFF,$00008080);