Browse Source

* fixed printf tests for windows

git-svn-id: trunk@5175 -
florian 19 years ago
parent
commit
82ec960679
4 changed files with 33 additions and 12 deletions
  1. 1 1
      tests/test/cg/tprintf.pp
  2. 11 5
      tests/test/cg/tprintf2.pp
  3. 14 4
      tests/test/cg/tprintf3.pp
  4. 7 2
      tests/test/cg/uprintf3.pp

+ 1 - 1
tests/test/cg/tprintf.pp

@@ -10,7 +10,7 @@ uses
 {$define TEST_EXTENDED}
 {$endif FPC_HAS_TYPE_EXTENDED}
 
-{$if defined(win32) or defined(wince)}
+{$ifdef WINDOWS}
 const
 {$ifdef wince}
   CrtLib = 'coredll.dll';

+ 11 - 5
tests/test/cg/tprintf2.pp

@@ -6,11 +6,17 @@
 uses
   strings;
 
-{$if defined(win32) or defined(wince)}
+{$ifdef FPC_HAS_TYPE_EXTENDED}
+{$define TEST_EXTENDED}
+{$endif FPC_HAS_TYPE_EXTENDED}
+
+{$ifdef WINDOWS}
 const
 {$ifdef wince}
   CrtLib = 'coredll.dll';
 {$else}
+  { the msvcrt.dll doesn't support extended because MS-C doesn't }
+  {$undef TEST_EXTENDED}
   CrtLib = 'msvcrt.dll';
 {$endif}
 
@@ -100,7 +106,7 @@ begin
       has_errors:=true;
     end;
 
-{$ifdef FPC_HAS_TYPE_EXTENDED}
+{$ifdef TEST_EXTENDED}
   printf('Text containing long double: %Lf'+lineending,e);
   sprintf(p,'Text containing long double: %Lf'+lineending,e);
   if strpos(p,'long double: 74.7')=nil then
@@ -108,7 +114,7 @@ begin
       writeln('The output of sprintf for long double is wrong:',p);
       has_errors:=true;
     end;
-{$endif FPC_HAS_TYPE_EXTENDED}
+{$endif TEST_EXTENDED}
 
   Writeln('Testing with combined pchar argument');
   printf('Text containing "%s" and "%s" text'+lineending,s,s2);
@@ -157,7 +163,7 @@ begin
       has_errors:=true;
     end;
 
-{$ifdef FPC_HAS_TYPE_EXTENDED}
+{$ifdef TEST_EXTENDED}
   printf('Text containing long double: %Lf"%s"'+lineending,e,s2);
   sprintf(p,'Text containing long double: %Lf"%s"'+lineending,e,s2);
   if (strpos(p,'long double: 74.7')=nil) or
@@ -166,7 +172,7 @@ begin
       writeln('The output of sprintf for long double is wrong:',p);
       has_errors:=true;
     end;
-{$endif FPC_HAS_TYPE_EXTENDED}
+{$endif TEST_EXTENDED}
 
   if has_errors then
     halt(1);

+ 14 - 4
tests/test/cg/tprintf3.pp

@@ -7,6 +7,16 @@
 uses
   strings, uprintf3;
 
+{$ifdef FPC_HAS_TYPE_EXTENDED}
+{$define TEST_EXTENDED}
+{$endif FPC_HAS_TYPE_EXTENDED}
+
+{$ifdef WINDOWS}
+  { the msvcrt.dll doesn't support extended because MS-C doesn't }
+  {$undef TEST_EXTENDED}
+{$endif WINDOWS}
+
+
 const
 {$ifdef macos}
   lineending = #13;
@@ -81,7 +91,7 @@ begin
       has_errors:=true;
     end;
 
-{$ifdef FPC_HAS_TYPE_EXTENDED}
+{$ifdef TEST_EXTENDED}
   printf('Text containing long double: %Lf'+lineending,e);
   sprintf(p,'Text containing long double: %Lf'+lineending,e);
   if strpos(p,'long double: 74.7')=nil then
@@ -89,7 +99,7 @@ begin
       writeln('The output of sprintf for long double is wrong:',p);
       has_errors:=true;
     end;
-{$endif FPC_HAS_TYPE_EXTENDED}
+{$endif TEST_EXTENDED}
 
   Writeln('Testing with combined pchar argument');
   printf('Text containing "%s" and "%s" text'+lineending,s,s2);
@@ -138,7 +148,7 @@ begin
       has_errors:=true;
     end;
 
-{$ifdef FPC_HAS_TYPE_EXTENDED}
+{$ifdef TEST_EXTENDED}
   printf('Text containing long double: %Lf"%s"'+lineending,e,s2);
   sprintf(p,'Text containing long double: %Lf"%s"'+lineending,e,s2);
   if (strpos(p,'long double: 74.7')=nil) or
@@ -147,7 +157,7 @@ begin
       writeln('The output of sprintf for long double is wrong:',p);
       has_errors:=true;
     end;
-{$endif FPC_HAS_TYPE_EXTENDED}
+{$endif TEST_EXTENDED}
 
   if has_errors then
     halt(1);

+ 7 - 2
tests/test/cg/uprintf3.pp

@@ -4,9 +4,14 @@ unit uprintf3;
 
 interface
 
+{$if defined(darwin) or defined(macos)}
 {$calling mwpascal}
+{$else}
+{$calling cdecl}
+{$endif}
+
 
-{$if defined(win32) or defined(wince)}
+{$ifdef WINDOWS}
 const
 {$ifdef wince}
   CrtLib = 'coredll.dll';
@@ -15,7 +20,7 @@ const
 {$endif}
 
 procedure printf(const formatstr : pchar; ...); external CrtLib name 'printf';
-procedure sprintf(p : pchar;const formatstr : pchar; ...); external CrtLib name 'printf';
+procedure sprintf(p : pchar;const formatstr : pchar; ...); external CrtLib name 'sprintf';
 const
   int64prefix='I64';
 {$else}