Browse Source

* adapted tests to fixed implementation

Jonas Maebe 22 years ago
parent
commit
f569830273
2 changed files with 28 additions and 10 deletions
  1. 15 6
      tests/test/units/system/tsetstr.pp
  2. 13 4
      tests/test/units/system/tsetstr2.pp

+ 15 - 6
tests/test/units/system/tsetstr.pp

@@ -30,6 +30,7 @@ const
 
 
 var
+   arr: array[0..255] of byte;
    str1 : shortstring;
    str2 : ansistring;
 {$ifdef haswidestring}
@@ -44,6 +45,7 @@ procedure fail;
 
 procedure test_shortstring;
 var
+ i: longint;
  _failed : boolean;
 begin
   _failed := false;
@@ -68,10 +70,14 @@ begin
   if str1 <> '' then
     _failed := true;
   str1:='';
-  setstring(str1,PCHAR_NORMAL,512);
-  if str1 <> '' then
-    _failed := true;
-  str1:='';
+  fillchar(arr,sizeof(arr),'a');
+  setstring(str1,@arr[0],512);
+  if length(str1) <> 255 then
+    _failed := true;
+  for i := 1 to length(str1) do
+    if str1[i] <> 'a' then
+      _failed := true;
+  str1:='';  
   setstring(str1,PCHAR_NORMAL,strlen(PCHAR_NORMAL));
   if str1 <> HELLO_STRING then
     _failed := true;
@@ -162,7 +168,10 @@ end.
 
 {
   $Log$
-  Revision 1.2  2002-12-16 20:40:36  peter
+  Revision 1.3  2003-03-04 18:19:48  jonas
+    * adapted tests to fixed implementation
+
+  Revision 1.2  2002/12/16 20:40:36  peter
     * win32 fix
 
   Revision 1.1  2002/10/20 11:44:15  carl
@@ -170,4 +179,4 @@ end.
     * args checking is not interactive
     + zero and negative length checking for move/fillchar
 
-}
+}

+ 13 - 4
tests/test/units/system/tsetstr2.pp

@@ -34,6 +34,7 @@ const
   
 
 var
+   arr: array[0..255] of byte;
    str1 : shortstring;
    str2 : ansistring;
 {$ifdef haswidestring}   
@@ -48,6 +49,7 @@ procedure fail;
 
 procedure test_shortstring;
 var
+ i: longint;
  _failed : boolean;
 begin
   _failed := false;
@@ -72,9 +74,13 @@ begin
   if str1 <> '' then
     _failed := true;
   str1:='';
-  setstring(str1,PCHAR_NORMAL,512);
-  if str1 <> '' then
+  fillchar(arr,sizeof(arr),'a');
+  setstring(str1,@arr[0],512);
+  if length(str1) <> 255 then
     _failed := true;
+  for i := 1 to length(str1) do
+    if str1[i] <> 'a' then
+      _failed := true;
   str1:='';  
   setstring(str1,PCHAR_NORMAL,strlen(PCHAR_NORMAL));
   if str1 <> HELLO_STRING then
@@ -166,7 +172,10 @@ end.
 
 {
   $Log$
-  Revision 1.1  2002-10-21 09:02:25  pierre
+  Revision 1.2  2003-03-04 18:19:48  jonas
+    * adapted tests to fixed implementation
+
+  Revision 1.1  2002/10/21 09:02:25  pierre
    * tsetstr.pp duplicated with $H+
 
   Revision 1.1  2002/10/20 11:44:15  carl
@@ -174,4 +183,4 @@ end.
     * args checking is not interactive
     + zero and negative length checking for move/fillchar
 
-}
+}