OSDN Git Service

replace QTest::swap() with its body
authorIvailo Monev <xakepa10@gmail.com>
Fri, 14 Aug 2020 20:57:10 +0000 (23:57 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Fri, 14 Aug 2020 20:57:10 +0000 (23:57 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/test/qtestcase.cpp

index ccf8964..658996c 100644 (file)
@@ -950,19 +950,13 @@ void seedRandom()
 }
 
 template<typename T>
-void swap(T * array, int pos, int otherPos)
-{
-    T tmp = array[pos];
-    array[pos] = array[otherPos];
-    array[otherPos] = tmp;
-}
-
-template<typename T>
 static void randomizeList(T * array, int size)
 {
     for (int i = 0; i != size; i++) {
         int pos = qrand() % size;
-        swap(array, pos, i);
+        T tmp = array[pos];
+        array[pos] = array[i];
+        array[i] = tmp;
     }
 }