[ATL_APITEST] Simplify code by using ok_int etc. (#1824)
[reactos.git] / modules / rostests / apitests / atl / CSimpleMap.cpp
index f21e983..09b2205 100644 (file)
@@ -45,137 +45,137 @@ START_TEST(CSimpleMap)
 {
     CSimpleMap<int, int> map1;
 
-    ok(map1.GetSize() == 0, "Expected map1's size is zero, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 0);
 
     map1.Add(1, 2);
-    ok(map1.GetSize() == 1, "Expected map1's size is 1, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 1);
     map1.Add(2, 3);
-    ok(map1.GetSize() == 2, "Expected map1's size is 2, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 2);
 
-    ok(map1.Lookup(1) == 2, "Expected map1.Lookup(1) is 2, was %d\n", map1.Lookup(1));
-    ok(map1.Lookup(2) == 3, "Expected map1.Lookup(2) is 3, was %d\n", map1.Lookup(2));
-    ok(map1.Lookup(-1) == 0, "Expected map1.Lookup(-1) is 0, was %d\n", map1.Lookup(-1));
+    ok_int(map1.Lookup(1), 2);
+    ok_int(map1.Lookup(2), 3);
+    ok_int(map1.Lookup(-1), 0);
 
-    ok(map1.ReverseLookup(2) == 1, "Expected map1.ReverseLookup(2) is 1, was %d\n", map1.ReverseLookup(2));
-    ok(map1.ReverseLookup(3) == 2, "Expected map1.ReverseLookup(3) is 2, was %d\n", map1.ReverseLookup(3));
+    ok_int(map1.ReverseLookup(2), 1);
+    ok_int(map1.ReverseLookup(3), 2);
 
-    ok(map1.GetKeyAt(0) == 1, "Expected map1.GetKeyAt(0) is 1, was %d\n", map1.GetKeyAt(0));
-    ok(map1.GetKeyAt(1) == 2, "Expected map1.GetKeyAt(1) is 2, was %d\n", map1.GetKeyAt(1));
+    ok_int(map1.GetKeyAt(0), 1);
+    ok_int(map1.GetKeyAt(1), 2);
 
-    ok(map1.GetValueAt(0) == 2, "Expected map1.GetValueAt(0) is 2, was %d\n", map1.GetValueAt(0));
-    ok(map1.GetValueAt(1) == 3, "Expected map1.GetValueAt(1) is 3, was %d\n", map1.GetValueAt(1));
+    ok_int(map1.GetValueAt(0), 2);
+    ok_int(map1.GetValueAt(1), 3);
 
     map1.SetAt(2, 4);
 
-    ok(map1.Lookup(1) == 2, "Expected map1.Lookup(1) is 2, was %d\n", map1.Lookup(1));
-    ok(map1.Lookup(2) == 4, "Expected map1.Lookup(2) is 4, was %d\n", map1.Lookup(2));
+    ok_int(map1.Lookup(1), 2);
+    ok_int(map1.Lookup(2), 4);
 
-    ok(map1.ReverseLookup(2) == 1, "Expected map1.ReverseLookup(2) is 1, was %d\n", map1.ReverseLookup(2));
-    ok(map1.ReverseLookup(4) == 2, "Expected map1.ReverseLookup(4) is 2, was %d\n", map1.ReverseLookup(4));
+    ok_int(map1.ReverseLookup(2), 1);
+    ok_int(map1.ReverseLookup(4), 2);
 
     map1.Remove(1);
-    ok(map1.GetSize() == 1, "Expected map1's size is 1, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 1);
     map1.Remove(2);
-    ok(map1.GetSize() == 0, "Expected map1's size is 0, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 0);
 
     map1.Add(1, 4);
-    ok(map1.GetSize() == 1, "Expected map1's size is 1, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 1);
     map1.Add(2, 8);
-    ok(map1.GetSize() == 2, "Expected map1's size is 2, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 2);
     map1.Add(3, 12);
-    ok(map1.GetSize() == 3, "Expected map1's size is 3, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 3);
 
     map1.RemoveAll();
-    ok(map1.GetSize() == 0, "Expected map1's size is 0, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 0);
 
-    ok(CMonster::s_nCount == 0, "Expected CMonster::s_nCount is 0, was %d\n", CMonster::s_nCount);
-    ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+    ok_int(CMonster::s_nCount, 0);
+    ok_int(CMonster::s_nCopyCount, 0);
 
     CSimpleMap<CMonster, CMonster> map2;
-    ok(map2.GetSize() == 0, "Expected map2's size is zero, was %d\n", map2.GetSize());
+    ok_int(map2.GetSize(), 0);
 
-    ok(CMonster::s_nCount == 0, "Expected CMonster::s_nCount is 0, was %d\n", CMonster::s_nCount);
-    ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+    ok_int(CMonster::s_nCount, 0);
+    ok_int(CMonster::s_nCopyCount, 0);
 
     {
         CMonster m1;
-        ok(CMonster::s_nCount == 1, "Expected CMonster::s_nCount is 1, was %d\n", CMonster::s_nCount);
-        ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+        ok_int(CMonster::s_nCount, 1);
+        ok_int(CMonster::s_nCopyCount, 0);
 
         CMonster m2;
-        ok(CMonster::s_nCount == 2, "Expected CMonster::s_nCount is 2, was %d\n", CMonster::s_nCount);
-        ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+        ok_int(CMonster::s_nCount, 2);
+        ok_int(CMonster::s_nCopyCount, 0);
 
         map2.Add(m1, m2);
-        ok(CMonster::s_nCount == 4, "Expected CMonster::s_nCount is 4, was %d\n", CMonster::s_nCount);
-        ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+        ok_int(CMonster::s_nCount, 4);
+        ok_int(CMonster::s_nCopyCount, 0);
     }
 
-    ok(map2.GetSize() == 1, "Expected map2's size is 1, was %d\n", map2.GetSize());
-    ok(CMonster::s_nCount == 2, "Expected CMonster::s_nCount is 2, was %d\n", CMonster::s_nCount);
-    ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+    ok_int(map2.GetSize(), 1);
+    ok_int(CMonster::s_nCount, 2);
+    ok_int(CMonster::s_nCopyCount, 0);
 
     {
         CMonster m1;
-        ok(CMonster::s_nCount == 3, "Expected CMonster::s_nCount is 3, was %d\n", CMonster::s_nCount);
-        ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+        ok_int(CMonster::s_nCount, 3);
+        ok_int(CMonster::s_nCopyCount, 0);
 
         CMonster m2;
-        ok(CMonster::s_nCount == 4, "Expected CMonster::s_nCount is 4, was %d\n", CMonster::s_nCount);
-        ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+        ok_int(CMonster::s_nCount, 4);
+        ok_int(CMonster::s_nCopyCount, 0);
 
         map2.Add(m1, m2);
-        ok(CMonster::s_nCount == 6, "Expected CMonster::s_nCount is 6, was %d\n", CMonster::s_nCount);
-        ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+        ok_int(CMonster::s_nCount, 6);
+        ok_int(CMonster::s_nCopyCount, 0);
     }
 
-    ok(map2.GetSize() == 2, "Expected map2's size is 2, was %d\n", map2.GetSize());
-    ok(CMonster::s_nCount == 4, "Expected CMonster::s_nCount is 4, was %d\n", CMonster::s_nCount);
-    ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+    ok_int(map2.GetSize(), 2);
+    ok_int(CMonster::s_nCount, 4);
+    ok_int(CMonster::s_nCopyCount, 0);
 
     map2.RemoveAt(0);
-    ok(CMonster::s_nCount == 2, "Expected CMonster::s_nCount is 2, was %d\n", CMonster::s_nCount);
-    ok(map2.GetSize() == 1, "Expected map2's size is 1, was %d\n", map2.GetSize());
-    ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+    ok_int(CMonster::s_nCount, 2);
+    ok_int(map2.GetSize(), 1);
+    ok_int(CMonster::s_nCopyCount, 0);
 
     map2.RemoveAt(0);
-    ok(CMonster::s_nCount == 0, "Expected CMonster::s_nCount is 0, was %d\n", CMonster::s_nCount);
-    ok(map2.GetSize() == 0, "Expected map2's size is 0, was %d\n", map2.GetSize());
-    ok(CMonster::s_nCopyCount == 0, "Expected CMonster::s_nCopyCount is 0, was %d\n", CMonster::s_nCopyCount);
+    ok_int(CMonster::s_nCount, 0);
+    ok_int(map2.GetSize(), 0);
+    ok_int(CMonster::s_nCopyCount, 0);
 
     CSimpleMap<int, CMonster> map3;
-    ok(map3.GetSize() == 0, "Expected map3's size is 0, was %d\n", map3.GetSize());
+    ok_int(map3.GetSize(), 0);
 
     CMonster m3;
-    ok(CMonster::s_nCount == 1, "Expected CMonster::s_nCount is 1, was %d\n", CMonster::s_nCount);
+    ok_int(CMonster::s_nCount, 1);
 
     map3.Add(1, m3);
-    ok(map3.GetSize() == 1, "Expected map3's size is 1, was %d\n", map3.GetSize());
-    ok(CMonster::s_nCount == 2, "Expected CMonster::s_nCount is 2, was %d\n", CMonster::s_nCount);
+    ok_int(map3.GetSize(), 1);
+    ok_int(CMonster::s_nCount, 2);
 
     map3.Add(2, m3);
-    ok(map3.GetSize() == 2, "Expected map3's size is 2, was %d\n", map3.GetSize());
-    ok(CMonster::s_nCount == 3, "Expected CMonster::s_nCount is 3, was %d\n", CMonster::s_nCount);
+    ok_int(map3.GetSize(), 2);
+    ok_int(CMonster::s_nCount, 3);
 
     map3.Add(3, m3);
-    ok(map3.GetSize() == 3, "Expected map3's size is 3, was %d\n", map3.GetSize());
-    ok(CMonster::s_nCount == 4, "Expected CMonster::s_nCount is 4, was %d\n", CMonster::s_nCount);
+    ok_int(map3.GetSize(), 3);
+    ok_int(CMonster::s_nCount, 4);
 
     map3.Remove(2);
-    ok(map3.GetSize() == 2, "Expected map3's size is 2, was %d\n", map3.GetSize());
-    ok(CMonster::s_nCount == 3, "Expected CMonster::s_nCount is 3, was %d\n", CMonster::s_nCount);
+    ok_int(map3.GetSize(), 2);
+    ok_int(CMonster::s_nCount, 3);
 
     map3.RemoveAll();
-    ok(map3.GetSize() == 0, "Expected map3's size is 0, was %d\n", map3.GetSize());
-    ok(CMonster::s_nCount == 1, "Expected CMonster::s_nCount is 1, was %d\n", CMonster::s_nCount);
+    ok_int(map3.GetSize(), 0);
+    ok_int(CMonster::s_nCount, 1);
 
     map1.Add(1, 2);
-    ok(map1.GetSize() == 1, "Expected map1's size is 1, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 1);
     map1.Add(2, 3);
-    ok(map1.GetSize() == 2, "Expected map1's size is 2, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 2);
 
     ok(!!map1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n");
-    ok(map1.GetSize() == 1, "Expected map1's size is 1, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 1);
     ok(!!map1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n");
-    ok(map1.GetSize() == 0, "Expected map1's size is 0, was %d\n", map1.GetSize());
+    ok_int(map1.GetSize(), 0);
 }