Browse Source

merge r17435 from cpstrnew branch by michael:
* Tests for typed constants

git-svn-id: trunk@19110 -

paul 14 years ago
parent
commit
2fe59a676a
4 changed files with 65 additions and 0 deletions
  1. 3 0
      .gitattributes
  2. 29 0
      tests/test/tcptypedconst.pp
  3. 22 0
      tests/test/tcptypedconst2.pp
  4. 11 0
      tests/test/tcptypedconst3.pp

+ 3 - 0
.gitattributes

@@ -9946,6 +9946,9 @@ tests/test/tcpstr5.pp svneol=native#text/plain
 tests/test/tcpstr6.pp svneol=native#text/plain
 tests/test/tcpstr6.pp svneol=native#text/plain
 tests/test/tcpstr7.pp svneol=native#text/plain
 tests/test/tcpstr7.pp svneol=native#text/plain
 tests/test/tcpstr8.pp svneol=native#text/pascal
 tests/test/tcpstr8.pp svneol=native#text/pascal
+tests/test/tcptypedconst.pp svneol=native#text/plain
+tests/test/tcptypedconst2.pp svneol=native#text/plain
+tests/test/tcptypedconst3.pp svneol=native#text/plain
 tests/test/tcstring1.pp svneol=native#text/pascal
 tests/test/tcstring1.pp svneol=native#text/pascal
 tests/test/tcstring2.pp svneol=native#text/pascal
 tests/test/tcstring2.pp svneol=native#text/pascal
 tests/test/tdel1.pp svneol=native#text/plain
 tests/test/tdel1.pp svneol=native#text/plain

+ 29 - 0
tests/test/tcptypedconst.pp

@@ -0,0 +1,29 @@
+{$CODEPAGE cp850}
+program tcptypedconst;
+
+type
+  Str_cp = string<1251>;
+  Str_cp850 = string<850>;
+  
+procedure printcontent(p : Pointer; l: integer);
+var
+  i : Integer;
+  pb : PByte;
+begin
+  writeln;
+  pb := p;
+  for i := 1 to l do begin
+    writeln('s[',i,']= ',pb^);
+    inc(pb);
+  end;
+end;  
+  
+const
+  c : Str_cp = #163#165#167#174#181#224; 
+  c850 : Str_cp850 = #163#165#167#174#181#224; 
+begin
+  printcontent(@(c[1]),Length(c));
+  printcontent(@(c850[1]),Length(c850));
+  WriteLn(c);
+  WriteLn(c850);
+end.

+ 22 - 0
tests/test/tcptypedconst2.pp

@@ -0,0 +1,22 @@
+{$CODEPAGE cp437}
+program tcptypedconst2;
+   
+procedure printcontent(p : Pointer; l: integer);
+var
+  i : Integer;
+  pb : PByte;
+begin
+  writeln;
+  pb := p;
+  for i := 1 to l do begin
+    writeln('s[',i,']= ',pb^);
+    inc(pb);
+  end;
+end; 
+
+const
+   CFrame      = #1#1#2#2#3;  
+   P: String[Length(CFrame)] = CFrame;   
+begin   
+  printcontent(@(P[1]),Length(p));
+end.

+ 11 - 0
tests/test/tcptypedconst3.pp

@@ -0,0 +1,11 @@
+{$codepage cp866}
+program tcptypedconst3;
+const 
+  c : Char = '£';//= #163
+begin
+  writeln(Ord(c)); 
+  if (Ord(c) <> 163) then begin
+    writeln('error');
+    Halt(1);
+  end;  
+end.