test.pas 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. program TestProgram;
  2. uses Test2;
  3. const A = 1234;
  4. B = $1234;
  5. C = #1#2#3#4;
  6. ConstBool1 = true;
  7. ConstBool2 = boolean(5);
  8. ConstChar = 'A';
  9. ConstSet = ['A'..'Z'];
  10. ConstSet2 = [15..254];
  11. ConstFloat = 3.1415;
  12. type
  13. PObj = ^TObj;
  14. TObj = object
  15. constructor Init;
  16. function Func: boolean;
  17. procedure Proc; virtual;
  18. destructor Done; virtual;
  19. private
  20. Z: integer;
  21. end;
  22. TObj2 = object(TObj)
  23. procedure Proc; virtual;
  24. end;
  25. TObj3 = object(TObj)
  26. end;
  27. TObj32 = object(TObj3)
  28. end;
  29. TObj4 = object(TObj)
  30. end;
  31. TClass = class
  32. constructor Create;
  33. end;
  34. TClass2 = class(TClass)
  35. end;
  36. EnumTyp = (enum1,enum2,enum3);
  37. ArrayTyp = array[1..10] of EnumTyp;
  38. ProcTyp = function(A: word; var B: longint; const C: EnumTyp): real;
  39. SetTyp = set of EnumTyp;
  40. const
  41. ConstOrd = enum1;
  42. var Hello : word;
  43. X: PRecord;
  44. Bool: boolean;
  45. T : TRecord;
  46. Str20 : string[20];
  47. Str255: string;
  48. ArrayW: array[2..45] of word;
  49. ArrayVar: ArrayTyp;
  50. EnumVar: (enumElem1,enumElem2,enumElem3);
  51. EnumVar2: EnumTyp;
  52. FileVar: file;
  53. FileVarR: file of TRecord;
  54. FileVarW: file of word;
  55. ProcVar: procedure;
  56. ProcVarD: function(X: real): boolean;
  57. ProcVarI: ProcTyp;
  58. SetVarD: set of char;
  59. SetVarI: SetTyp;
  60. Float1: real;
  61. Float2: double;
  62. Float3: comp;
  63. Float4: extended;
  64. Pointer1: pointer;
  65. Pointer2: PObj;
  66. ClassVar1: TClass;
  67. ClassVar2: TClass2;
  68. Obj1: TObj;
  69. Obj2: TObj2;
  70. constructor TObj.Init;
  71. begin
  72. Z:=1;
  73. end;
  74. function TObj.Func: boolean;
  75. begin
  76. Func:=true;
  77. end;
  78. procedure TObj.Proc;
  79. begin
  80. if Func=false then Halt;
  81. end;
  82. destructor TObj.Done;
  83. begin
  84. end;
  85. procedure TObj2.Proc;
  86. begin
  87. Z:=4;
  88. end;
  89. constructor TClass.Create;
  90. begin
  91. end;
  92. function Func1(x,z : word; var y : boolean; const r: TRecord): shortint;
  93. procedure test_local(c,f : longint);
  94. var
  95. int_loc : longint;
  96. begin
  97. Writeln('dummy for browser');
  98. end;
  99. begin
  100. if Hello=0 then X:=0 else X:=1;
  101. test_local(0,2);
  102. Func1:=X;
  103. end;
  104. var i : longint;
  105. BEGIN
  106. X:=nil;
  107. writeln('Hello world!');
  108. Writeln('ParamCount = ',ParamCount);
  109. For i:=0 to paramcount do
  110. writeln('Paramstr(',i,') = ',Paramstr(i));
  111. writeln(IsOdd(3));
  112. writeln(Func1(5,5,Bool,T));
  113. Halt;
  114. END.