Ver código fonte

+ added test for the StrUpper() and StrLower() functions in the strings unit

git-svn-id: trunk@37617 -
nickysn 7 anos atrás
pai
commit
51489f9186
1 arquivos alterados com 26 adições e 0 exclusões
  1. 26 0
      tests/test/units/strings/tstrings1.pp

+ 26 - 0
tests/test/units/strings/tstrings1.pp

@@ -133,6 +133,29 @@ begin
 end;
 
 
+procedure teststrupperstrlower;
+  const
+    P : PChar = 'This is a PCHAR string.@AZ[`az{';
+  var
+    buf: array [0..511] of Char;
+    Q: PChar;
+  begin
+    StrCopy(buf, P);
+    Q := StrUpper(buf);
+    if Q <> @buf then
+      failed;
+    if strpas(buf) <> 'THIS IS A PCHAR STRING.@AZ[`AZ{' then
+      failed;
+
+    StrCopy(buf, P);
+    Q := StrLower(buf);
+    if Q <> @buf then
+      failed;
+    if strpas(buf) <> 'this is a pchar string.@az[`az{' then
+      failed;
+  end;
+
+
 begin
    write('Testing strlen ... ');
    teststrlen;
@@ -158,4 +181,7 @@ begin
    write('Testing strscan/strrscan ... ');
    teststrscanstrrscan;
    writeln('Success.');
+   write('Testing strupper/strlower ... ');
+   teststrupperstrlower;
+   writeln('Success.');
 end.