浏览代码

* problem of write(pchar)

pierre 27 年之前
父节点
当前提交
85bc486eb2
共有 2 个文件被更改,包括 47 次插入0 次删除
  1. 1 0
      tests/README
  2. 46 0
      tests/ts010022.pp

+ 1 - 0
tests/README

@@ -31,6 +31,7 @@ ts010019.pp	  tests problems of name mangling
 ts010020.pp	  tests for const strings problems if const is a single char.
 ts010020.pp	  tests for const strings problems if const is a single char.
 ts010021.pp	  test for long mangled names (they are strings, ie no longer then
 ts010021.pp	  test for long mangled names (they are strings, ie no longer then
 		  255 chars (but they have to be allways shorten the same way !!)
 		  255 chars (but they have to be allways shorten the same way !!)
+ts010022.pp       tests a problem of writing pchar in files
 ts10100.pp        tests for delphi object model
 ts10100.pp        tests for delphi object model
 -
 -
 ts101xx.pp
 ts101xx.pp

+ 46 - 0
tests/ts010022.pp

@@ -0,0 +1,46 @@
+program ts010022;
+
+const
+  EXCEPTIONCOUNT = 18;
+  exception_names : array[0..EXCEPTIONCOUNT-1] of pchar = (
+   'Division by Zero',
+   'Debug',
+   'NMI',
+   'Breakpoint',
+   'Overflow',
+   'Bounds Check',
+   'Invalid Opcode',
+   'Coprocessor not available',
+   'Double Fault',
+   'Coprocessor overrun',
+   'Invalid TSS',
+   'Segment Not Present',
+   'Stack Fault',
+   'General Protection Fault',
+   'Page fault',
+   ' ',
+   'Coprocessor Error',
+   'Alignment Check');
+
+    single_pchar : pchar = 'Alone test';
+
+const filename  = 'ts010022.hlp';
+	
+var en : pchar;
+    f : text;
+    st : string;
+begin
+   assign(f,filename);
+   rewrite(f);
+   en:=single_pchar;
+   Writeln(f,en);
+   en:=exception_names[6];
+   writeln(f,en);
+   close(f);
+   reset(f);
+   readln(f,st);
+   if st<>'Alone test' then halt(1);
+   readln(f,st);
+   if st<>'Invalid opcode' then halt(1);
+   close(f);
+end.