tcnvint1.pp 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. {****************************************************************}
  2. { CODE GENERATOR TEST PROGRAM }
  3. {****************************************************************}
  4. { NODE TESTED : secondtypeconvert() -> second_bool_to_int }
  5. {****************************************************************}
  6. { PRE-REQUISITES: secondload() }
  7. { secondassign() }
  8. { secondcalln() }
  9. { secondinline() }
  10. {****************************************************************}
  11. { DEFINES: }
  12. {****************************************************************}
  13. { REMARKS: }
  14. {****************************************************************}
  15. program tcnvint1;
  16. {$ifdef VER70}
  17. {$define tp}
  18. {$endif}
  19. var
  20. tobyte : byte;
  21. toword : word;
  22. tolong : longint;
  23. {$ifndef tp}
  24. toint64 : int64;
  25. {$endif}
  26. bb1 : bytebool;
  27. wb1 : wordbool;
  28. lb1 : longbool;
  29. bb2 : bytebool;
  30. wb2 : wordbool;
  31. lb2 : longbool;
  32. begin
  33. { left : LOC_REGISTER }
  34. { from : LOC_REFERENCE/LOC_REGISTER }
  35. WriteLn('Testing LOC_REFERENCE...');
  36. bb1 := TRUE;
  37. tobyte := byte(bb1);
  38. WriteLn('boolean->byte : value should be 1...',tobyte);
  39. bb1 := FALSE;
  40. tobyte := byte(bb1);
  41. WriteLn('boolean->byte : value should be 0...',tobyte);
  42. bb1 := TRUE;
  43. toword := word(bb1);
  44. WriteLn('boolean->word : value should be 1...',toword);
  45. bb1 := FALSE;
  46. toword := word(bb1);
  47. WriteLn('boolean->word : value should be 0...',toword);
  48. bb1 := TRUE;
  49. tolong := longint(bb1);
  50. WriteLn('boolean->longint : value should be 1...',tolong);
  51. bb1 := FALSE;
  52. tolong := longint(bb1);
  53. WriteLn('boolean->longint : value should be 0...',tolong);
  54. wb1 := TRUE;
  55. tobyte := byte(wb1);
  56. WriteLn('wordbool->byte : value should be 1...',tobyte);
  57. wb1 := FALSE;
  58. tobyte := byte(wb1);
  59. WriteLn('wordbool->byte : value should be 0...',tobyte);
  60. wb1 := TRUE;
  61. toword := word(wb1);
  62. WriteLn('wordbool->word : value should be 1...',toword);
  63. wb1 := FALSE;
  64. toword := word(wb1);
  65. WriteLn('wordbool->word : value should be 0...',toword);
  66. wb1 := TRUE;
  67. tolong := longint(wb1);
  68. WriteLn('wordbool->longint : value should be 1...',tolong);
  69. wb1 := FALSE;
  70. tolong := longint(wb1);
  71. WriteLn('wordbool->longint : value should be 0...',tolong);
  72. {$ifndef tp}
  73. bb1 := TRUE;
  74. toint64 :=int64(bb1);
  75. WriteLn('boolean->int64 : value should be 1...',toint64);
  76. bb1 := FALSE;
  77. toint64 :=int64(bb1);
  78. WriteLn('boolean->int64 : value should be 0...',toint64);
  79. wb1 := TRUE;
  80. toint64 :=int64(wb1);
  81. WriteLn('wordbool->int64 : value should be 1...',toint64);
  82. wb1 := FALSE;
  83. toint64 :=int64(wb1);
  84. WriteLn('wordbool->int64 : value should be 0...',toint64);
  85. {$endif}
  86. lb1 := TRUE;
  87. tobyte := byte(lb1);
  88. WriteLn('longbool->byte : value should be 1...',tobyte);
  89. lb1 := FALSE;
  90. tobyte := byte(lb1);
  91. WriteLn('longbool->byte : value should be 0...',tobyte);
  92. lb1 := TRUE;
  93. toword := word(lb1);
  94. WriteLn('longbool->word : value should be 1...',toword);
  95. lb1 := FALSE;
  96. toword := word(lb1);
  97. WriteLn('longbool->word : value should be 0...',toword);
  98. lb1 := TRUE;
  99. tolong := longint(lb1);
  100. WriteLn('longbool->longint : value should be 1...',tolong);
  101. lb1 := FALSE;
  102. tolong := longint(lb1);
  103. WriteLn('longbool->longint : value should be 0...',tolong);
  104. { left : LOC_REGISTER }
  105. { from : LOC_REFERENCE }
  106. wb1 := TRUE;
  107. bb2 := wb1;
  108. WriteLn('wordbool->boolean : value should be TRUE...',bb2);
  109. wb1 := FALSE;
  110. bb2 := wb1;
  111. WriteLn('wordbool->boolean : value should be FALSE...',bb2);
  112. lb1 := TRUE;
  113. bb2 := lb1;
  114. WriteLn('longbool->boolean : value should be TRUE...',bb2);
  115. lb1 := FALSE;
  116. bb2 := lb1;
  117. WriteLn('longbool->boolean : value should be FALSE...',bb2);
  118. bb1 := TRUE;
  119. lb2 := bb1;
  120. WriteLn('boolean->longbool : value should be TRUE...',lb2);
  121. bb1 := FALSE;
  122. lb2 := bb1;
  123. WriteLn('boolean->longbool : value should be FALSE...',lb2);
  124. { left : LOC_REGISTER }
  125. { from : LOC_JUMP }
  126. WriteLn('Testing LOC_JUMP...');
  127. toword := 0;
  128. tobyte := 1;
  129. tobyte:=byte(toword > tobyte);
  130. WriteLn('value should be 0...',tobyte);
  131. toword := 2;
  132. tobyte := 1;
  133. tobyte:=byte(toword > tobyte);
  134. WriteLn('value should be 1...',tobyte);
  135. toword := 0;
  136. tobyte := 1;
  137. toword:=word(toword > tobyte);
  138. WriteLn('value should be 0...',toword);
  139. toword := 2;
  140. tobyte := 1;
  141. toword:=word(toword > tobyte);
  142. WriteLn('value should be 1...',toword);
  143. toword := 0;
  144. tobyte := 1;
  145. tolong:=longint(toword > tobyte);
  146. WriteLn('value should be 0...',tolong);
  147. toword := 2;
  148. tobyte := 1;
  149. tolong:=longint(toword > tobyte);
  150. WriteLn('value should be 1...',tolong);
  151. {$ifndef tp}
  152. toword := 0;
  153. tobyte := 1;
  154. toint64:=int64(toword > tobyte);
  155. WriteLn('value should be 0...',toint64);
  156. toword := 2;
  157. tobyte := 1;
  158. toint64:=int64(toword > tobyte);
  159. WriteLn('value should be 1...',toint64);
  160. {$endif}
  161. { left : LOC_REGISTER }
  162. { from : LOC_FLAGS }
  163. WriteLn('Testing LOC_FLAGS...');
  164. wb1 := TRUE;
  165. bb1 := FALSE;
  166. bb1 := (wb1 > bb1);
  167. WriteLn('Value should be TRUE...',bb1);
  168. wb1 := FALSE;
  169. bb1 := FALSE;
  170. bb1 := (wb1 > bb1);
  171. WriteLn('Value should be FALSE...',bb1);
  172. lb1 := TRUE;
  173. bb1 := FALSE;
  174. bb1 := (bb1 > lb1);
  175. WriteLn('Value should be FALSE...',bb1);
  176. lb1 := FALSE;
  177. bb1 := TRUE;
  178. bb1 := (bb1 > lb1);
  179. WriteLn('Value should be TRUE...',bb1);
  180. lb1 := TRUE;
  181. bb1 := FALSE;
  182. wb1 := (bb1 > lb1);
  183. WriteLn('Value should be FALSE...',wb1);
  184. lb1 := FALSE;
  185. bb1 := TRUE;
  186. wb1 := (bb1 > lb1);
  187. WriteLn('Value should be TRUE...',wb1);
  188. lb1 := TRUE;
  189. bb1 := FALSE;
  190. lb1 := (bb1 > lb1);
  191. WriteLn('Value should be FALSE...',lb1);
  192. lb1 := FALSE;
  193. bb1 := TRUE;
  194. lb1 := (bb1 > lb1);
  195. WriteLn('Value should be TRUE...',lb1);
  196. bb1 := TRUE;
  197. bb2 := FALSE;
  198. lb1 := (bb1 > bb2);
  199. WriteLn('Value should be TRUE...',lb1);
  200. bb1 := FALSE;
  201. bb2 := TRUE;
  202. lb1 := (bb1 > bb2);
  203. WriteLn('Value should be FALSE...',lb1);
  204. end.
  205. {
  206. $Log$
  207. Revision 1.4 2002-09-07 15:40:55 peter
  208. * old logs removed and tabs fixed
  209. Revision 1.3 2002/05/13 13:45:38 peter
  210. * updated to compile tests with kylix
  211. }