Explorar o código

Change tstringlistexchange test code to give different error values and check that sort is done properly instead of requiring a given number of exchanges

git-svn-id: trunk@40547 -
pierre %!s(int64=6) %!d(string=hai) anos
pai
achega
0fafe640c5
Modificáronse 1 ficheiros con 10 adicións e 4 borrados
  1. 10 4
      tests/test/units/classes/tstringlistexchange.pp

+ 10 - 4
tests/test/units/classes/tstringlistexchange.pp

@@ -64,15 +64,21 @@ begin
       msl.OnChange := @dummy.Change;
       msl.Sort;
       // TMyStringList.ExchangeItems called 5 times
-      if msl.ExchangeCount <> 5 then
-        Halt(1);
+      // if msl.ExchangeCount <> 5 then
+      // Seems to be done in 4 exchanges
+      // Check that names are ordered correctly instead
+      if (msl[0] <> 'Alpha') or
+         (msl[1] <> 'Beta') or
+         (msl[2] <> 'Delta') or
+         (msl[3] <> 'Gamma') then
+        Halt(2);
       // OnChange called once in Sort
       if dummy.ExchangeCount <> 1 then
-        Halt(1);
+        Halt(3);
     finally
       msl.Free;
     end;
   finally
     dummy.Free;
   end;
-end.
+end.