Browse Source

new files

pierre 25 years ago
parent
commit
e320e8610e
5 changed files with 85 additions and 0 deletions
  1. 14 0
      tests/webtbs/tbug900.pp
  2. 12 0
      tests/webtbs/tbug902.pp
  3. 7 0
      tests/webtbs/tbug909.pp
  4. 8 0
      tests/webtbs/tbug911.pp
  5. 44 0
      tests/webtbs/tbug912.pp

+ 14 - 0
tests/webtbs/tbug900.pp

@@ -0,0 +1,14 @@
+program Test;
+
+uses strings;
+
+var Str1 : PChar;
+
+begin
+  GetMem(Str1,256);
+  StrPCopy (Str1, ParamStr(0));
+  writeln ('Arg 0 is "',Str1,'"');
+  StrPCopy (Str1, ParamStr(1));
+  writeln ('Arg 1 is "',Str1,'"');
+  FreeMem(Str1,256);
+end.

+ 12 - 0
tests/webtbs/tbug902.pp

@@ -0,0 +1,12 @@
+uses
+ dos;
+begin
+  writeln;
+  writeln(fsearch('c:\command.com', ''));
+  { here you get the full path in BP7, but nothing in FPC }
+  writeln(fsearch('c:\command.com', 'c:\a'));
+  { I really would not consider this as a bug !!  }
+  { this use of fsearch is not document in BP PM  }
+  if fsearch('c:\command.com', '')<>fsearch('c:\command.com', 'c:\a') then
+    Writeln('fsearch result is not BP compatible');
+end.

+ 7 - 0
tests/webtbs/tbug909.pp

@@ -0,0 +1,7 @@
+uses sysutils;
+ var r:array[0..3] of real;
+begin
+ r[0]:=1; r[1]:=2; r[2]:=3; r[3]:=4;
+ // the following is supposed to print "1, 2, 3, 4", instead it prints "4, 4, 4, 4"
+ writeln(format('%g, %g, %g, %g',[r[0],r[1],r[2],r[3]]));
+end.

+ 8 - 0
tests/webtbs/tbug911.pp

@@ -0,0 +1,8 @@
+Function Log(const b,r:real):real;
+begin
+  log:=ln(r)/ln(b);
+end;
+
+begin
+  log(1,5);
+end.

+ 44 - 0
tests/webtbs/tbug912.pp

@@ -0,0 +1,44 @@
+const
+  BufSize = 2048;
+
+var
+  f : file;
+  res : longint;
+  buf : array [0..BufSize-1] of byte;
+  result : word;
+begin
+assign(f,paramstr(0));
+{$I-}
+reset(f,1);
+res:=IOResult;
+{$I+}
+if res=0 then
+  Writeln('It is possible to open the executable in Read/Write mode')
+else
+  begin
+    filemode:=0;
+    {$I-}
+    reset(f,1);
+    res:=IOResult;
+    {$I+}
+    if res=0 then
+      Writeln('It is only possible to open the executable in Read mode')
+    else
+      Writeln('It is not possible to open the executable in Read mode');
+  end;
+if res=0 then
+  begin
+{$I-}
+    blockread(f,buf,sizeof(buf),result);
+    res:=IOResult;
+{$I+}
+    if res<>0 then
+      Writeln('Problem reading executable');
+    if res=0 then
+      close(f)
+    else
+      RunError(res);
+  end
+else
+  RunError(res);
+end.