mirror of
https://github.com/reactos/reactos.git
synced 2025-05-06 18:31:26 +00:00
[ATL_APITEST] Simplify code by using ok_int etc. (#1824)
Simplify the code by using ok_int, ok_long etc.
This commit is contained in:
parent
211fdcdba7
commit
14c267a3a3
5 changed files with 191 additions and 191 deletions
|
@ -61,71 +61,71 @@ START_TEST(CAtlArray)
|
|||
{
|
||||
CAtlArray<CCreature> array1;
|
||||
|
||||
ok(CCreature::s_nCtorCount == 0, "Expected CCreature::s_nCtorCount is zero, was: %d\n", CCreature::s_nCtorCount);
|
||||
ok(CCreature::s_nCtorCount_Default == 0, "Expected CCreature::s_nCtorCount_Default is zero, was: %d\n", CCreature::s_nCtorCount_Default);
|
||||
ok(CCreature::s_nCCtorCount == 0, "Expected CCreature::s_nCCtorCount is zero, was: %d\n", CCreature::s_nCCtorCount);
|
||||
ok(CCreature::s_nDtorCount == 0, "Expected CCreature::s_nDtorCount is zero, was: %d\n", CCreature::s_nDtorCount);
|
||||
ok(CCreature::s_nOpIsCount == 0, "Expected CCreature::s_nOpIsCount is zero, was: %d\n", CCreature::s_nOpIsCount);
|
||||
ok_int(CCreature::s_nCtorCount, 0);
|
||||
ok_int(CCreature::s_nCtorCount_Default, 0);
|
||||
ok_int(CCreature::s_nCCtorCount, 0);
|
||||
ok_int(CCreature::s_nDtorCount, 0);
|
||||
ok_int(CCreature::s_nOpIsCount, 0);
|
||||
|
||||
array1.SetCount(2);
|
||||
|
||||
ok(CCreature::s_nCtorCount == 2, "Expected CCreature::s_nCtorCount is 2, was: %d\n", CCreature::s_nCtorCount);
|
||||
ok(CCreature::s_nCtorCount_Default == 2, "Expected CCreature::s_nCtorCount_Default is 2, was: %d\n", CCreature::s_nCtorCount_Default);
|
||||
ok(CCreature::s_nCCtorCount == 0, "Expected CCreature::s_nCCtorCount is zero, was: %d\n", CCreature::s_nCCtorCount);
|
||||
ok(CCreature::s_nDtorCount == 0, "Expected CCreature::s_nDtorCount is zero, was: %d\n", CCreature::s_nDtorCount);
|
||||
ok(CCreature::s_nOpIsCount == 0, "Expected CCreature::s_nOpIsCount is zero, was: %d\n", CCreature::s_nOpIsCount);
|
||||
ok_int(CCreature::s_nCtorCount, 2);
|
||||
ok_int(CCreature::s_nCtorCount_Default, 2);
|
||||
ok_int(CCreature::s_nCCtorCount, 0);
|
||||
ok_int(CCreature::s_nDtorCount, 0);
|
||||
ok_int(CCreature::s_nOpIsCount, 0);
|
||||
|
||||
array1.SetCount(1);
|
||||
|
||||
ok(CCreature::s_nCtorCount == 2, "Expected CCreature::s_nCtorCount is 2, was: %d\n", CCreature::s_nCtorCount);
|
||||
ok(CCreature::s_nCtorCount_Default == 2, "Expected CCreature::s_nCtorCount_Default is 2, was: %d\n", CCreature::s_nCtorCount_Default);
|
||||
ok(CCreature::s_nCCtorCount == 0, "Expected CCreature::s_nCCtorCount is zero, was: %d\n", CCreature::s_nCCtorCount);
|
||||
ok(CCreature::s_nDtorCount == 1, "Expected CCreature::s_nDtorCount is 1, was: %d\n", CCreature::s_nDtorCount);
|
||||
ok(CCreature::s_nOpIsCount == 0, "Expected CCreature::s_nOpIsCount is zero, was: %d\n", CCreature::s_nOpIsCount);
|
||||
ok_int(CCreature::s_nCtorCount, 2);
|
||||
ok_int(CCreature::s_nCtorCount_Default, 2);
|
||||
ok_int(CCreature::s_nCCtorCount, 0);
|
||||
ok_int(CCreature::s_nDtorCount, 1);
|
||||
ok_int(CCreature::s_nOpIsCount, 0);
|
||||
|
||||
CCreature test(111);
|
||||
|
||||
ok(CCreature::s_nCtorCount == 3, "Expected CCreature::s_nCtorCount is 3, was: %d\n", CCreature::s_nCtorCount);
|
||||
ok(CCreature::s_nCtorCount_Default == 2, "Expected CCreature::s_nCtorCount_Default is 2, was: %d\n", CCreature::s_nCtorCount_Default);
|
||||
ok(CCreature::s_nCCtorCount == 0, "Expected CCreature::s_nCCtorCount is zero, was: %d\n", CCreature::s_nCCtorCount);
|
||||
ok(CCreature::s_nDtorCount == 1, "Expected CCreature::s_nDtorCount is 1, was: %d\n", CCreature::s_nDtorCount);
|
||||
ok(CCreature::s_nOpIsCount == 0, "Expected CCreature::s_nOpIsCount is zero, was: %d\n", CCreature::s_nOpIsCount);
|
||||
ok_int(CCreature::s_nCtorCount, 3);
|
||||
ok_int(CCreature::s_nCtorCount_Default, 2);
|
||||
ok_int(CCreature::s_nCCtorCount, 0);
|
||||
ok_int(CCreature::s_nDtorCount, 1);
|
||||
ok_int(CCreature::s_nOpIsCount, 0);
|
||||
|
||||
ok(array1.GetCount() == 1u, "Expected GetCount() to be 1, was %u\n", array1.GetCount());
|
||||
ok(array1[0].m_id == 0x123456, "Got %d\n", array1[0].m_id);
|
||||
ok(array1.GetAt(0).m_id == 0x123456, "Got %d\n", array1.GetAt(0).m_id);
|
||||
ok_size_t(array1.GetCount(), 1u);
|
||||
ok_int(array1[0].m_id, 0x123456);
|
||||
ok_int(array1.GetAt(0).m_id, 0x123456);
|
||||
|
||||
array1.Add(test);
|
||||
|
||||
ok(CCreature::s_nCtorCount == 3, "Expected CCreature::s_nCtorCount is 3, was: %d\n", CCreature::s_nCtorCount);
|
||||
ok(CCreature::s_nCtorCount_Default == 2, "Expected CCreature::s_nCtorCount_Default is 2, was: %d\n", CCreature::s_nCtorCount_Default);
|
||||
ok(CCreature::s_nCCtorCount == 1, "Expected CCreature::s_nCCtorCount is 1, was: %d\n", CCreature::s_nCCtorCount);
|
||||
ok(CCreature::s_nDtorCount == 1, "Expected CCreature::s_nDtorCount is 1, was: %d\n", CCreature::s_nDtorCount);
|
||||
ok(CCreature::s_nOpIsCount == 0, "Expected CCreature::s_nOpIsCount is zero, was: %d\n", CCreature::s_nOpIsCount);
|
||||
ok_int(CCreature::s_nCtorCount, 3);
|
||||
ok_int(CCreature::s_nCtorCount_Default, 2);
|
||||
ok_int(CCreature::s_nCCtorCount, 1);
|
||||
ok_int(CCreature::s_nDtorCount, 1);
|
||||
ok_int(CCreature::s_nOpIsCount, 0);
|
||||
|
||||
ok(array1.GetCount() == 2u, "Expected GetCount() to be 2, was %u\n", array1.GetCount());
|
||||
ok(array1[0].m_id == 0x123456, "Got %d\n", array1[0].m_id);
|
||||
ok(array1.GetAt(0).m_id == 0x123456, "Got %d\n", array1.GetAt(0).m_id);
|
||||
ok(array1[1].m_id == 111, "Got %d\n", array1[1].m_id);
|
||||
ok(array1.GetAt(1).m_id == 111, "Got %d\n", array1.GetAt(1).m_id);
|
||||
ok_size_t(array1.GetCount(), 2u);
|
||||
ok_int(array1[0].m_id, 0x123456);
|
||||
ok_int(array1.GetAt(0).m_id, 0x123456);
|
||||
ok_int(array1[1].m_id, 111);
|
||||
ok_int(array1.GetAt(1).m_id, 111);
|
||||
|
||||
test.m_id = 222;
|
||||
array1[0] = test;
|
||||
|
||||
ok(CCreature::s_nCtorCount == 3, "Expected CCreature::s_nCtorCount is 3, was: %d\n", CCreature::s_nCtorCount);
|
||||
ok(CCreature::s_nCtorCount_Default == 2, "Expected CCreature::s_nCtorCount_Default is 2, was: %d\n", CCreature::s_nCtorCount_Default);
|
||||
ok(CCreature::s_nCCtorCount == 1, "Expected CCreature::s_nCCtorCount is 1, was: %d\n", CCreature::s_nCCtorCount);
|
||||
ok(CCreature::s_nDtorCount == 1, "Expected CCreature::s_nDtorCount is 1, was: %d\n", CCreature::s_nDtorCount);
|
||||
ok(CCreature::s_nOpIsCount == 1, "Expected CCreature::s_nOpIsCount is 1, was: %d\n", CCreature::s_nOpIsCount);
|
||||
ok_int(CCreature::s_nCtorCount, 3);
|
||||
ok_int(CCreature::s_nCtorCount_Default, 2);
|
||||
ok_int(CCreature::s_nCCtorCount, 1);
|
||||
ok_int(CCreature::s_nDtorCount, 1);
|
||||
ok_int(CCreature::s_nOpIsCount, 1);
|
||||
|
||||
// Default traits does not call anything when relocating objects!
|
||||
array1.SetCount(100);
|
||||
|
||||
ok(CCreature::s_nCtorCount == 101, "Expected CCreature::s_nCtorCount is 101, was: %d\n", CCreature::s_nCtorCount);
|
||||
ok(CCreature::s_nCtorCount_Default == 100, "Expected CCreature::s_nCtorCount_Default is 100, was: %d\n", CCreature::s_nCtorCount_Default);
|
||||
ok(CCreature::s_nCCtorCount == 1, "Expected CCreature::s_nCCtorCount is 1, was: %d\n", CCreature::s_nCCtorCount);
|
||||
ok(CCreature::s_nDtorCount == 1, "Expected CCreature::s_nDtorCount is 1, was: %d\n", CCreature::s_nDtorCount);
|
||||
ok(CCreature::s_nOpIsCount == 1, "Expected CCreature::s_nOpIsCount is 1, was: %d\n", CCreature::s_nOpIsCount);
|
||||
ok_int(CCreature::s_nCtorCount, 101);
|
||||
ok_int(CCreature::s_nCtorCount_Default, 100);
|
||||
ok_int(CCreature::s_nCCtorCount, 1);
|
||||
ok_int(CCreature::s_nDtorCount, 1);
|
||||
ok_int(CCreature::s_nOpIsCount, 1);
|
||||
|
||||
// Does not compile:
|
||||
//CAtlArray<CCreature> array2(array1);
|
||||
|
@ -136,9 +136,9 @@ START_TEST(CAtlArray)
|
|||
}
|
||||
|
||||
// Objects are cleaned up when the list goes away
|
||||
ok(CCreature::s_nCtorCount == 101, "Expected CCreature::s_nCtorCount is 101, was: %d\n", CCreature::s_nCtorCount);
|
||||
ok(CCreature::s_nCtorCount_Default == 100, "Expected CCreature::s_nCtorCount_Default is 100, was: %d\n", CCreature::s_nCtorCount_Default);
|
||||
ok(CCreature::s_nCCtorCount == 1, "Expected CCreature::s_nCCtorCount is 1, was: %d\n", CCreature::s_nCCtorCount);
|
||||
ok(CCreature::s_nDtorCount == 102, "Expected CCreature::s_nDtorCount is 102, was: %d\n", CCreature::s_nDtorCount);
|
||||
ok(CCreature::s_nOpIsCount == 1, "Expected CCreature::s_nOpIsCount is 1, was: %d\n", CCreature::s_nOpIsCount);
|
||||
ok_int(CCreature::s_nCtorCount, 101);
|
||||
ok_int(CCreature::s_nCtorCount_Default, 100);
|
||||
ok_int(CCreature::s_nCCtorCount, 1);
|
||||
ok_int(CCreature::s_nDtorCount, 102);
|
||||
ok_int(CCreature::s_nOpIsCount, 1);
|
||||
}
|
||||
|
|
|
@ -20,13 +20,13 @@ START_TEST(CAtlList)
|
|||
{
|
||||
CAtlList<int> list1;
|
||||
|
||||
ok(list1.GetCount() == 0, "Expected list1's size is zero, was %d\n", list1.GetCount());
|
||||
ok_size_t(list1.GetCount(), 0);
|
||||
list1.AddTail(56);
|
||||
ok(list1.GetCount() == 1, "Expected list1's size is 1, was %d\n", list1.GetCount());
|
||||
ok_size_t(list1.GetCount(), 1);
|
||||
POSITION head = list1.AddHead(12);
|
||||
ok(list1.GetCount() == 2, "Expected list1's size is 2, was %d\n", list1.GetCount());
|
||||
ok_size_t(list1.GetCount(), 2);
|
||||
POSITION tail = list1.AddTail(90);
|
||||
ok(list1.GetCount() == 3, "Expected list1's size is 3, was %d\n", list1.GetCount());
|
||||
ok_size_t(list1.GetCount(), 3);
|
||||
|
||||
list1.InsertBefore(head, -123);
|
||||
list1.InsertAfter(head, 34); // no longer head, but the POSITION should still be valid..
|
||||
|
|
|
@ -88,50 +88,50 @@ START_TEST(CComQIPtr)
|
|||
{
|
||||
CQITestObject testObject;
|
||||
IUnknown* unk = static_cast<IPersist*>(&testObject);
|
||||
ok(testObject.m_dwRef == 1, "Expected m_dwRef 1, got %lu\n", testObject.m_dwRef);
|
||||
ok(g_QI == 0, "Expected g_QI 0, got %lu\n", g_QI);
|
||||
ok_long(testObject.m_dwRef, 1);
|
||||
ok_long(g_QI, 0);
|
||||
|
||||
{
|
||||
DECLARE_QIPTR(IPersist) ppPersist(unk);
|
||||
ok(testObject.m_dwRef == 2, "Expected m_dwRef 2, got %lu\n", testObject.m_dwRef);
|
||||
ok(g_QI == 1, "Expected g_QI 1, got %lu\n", g_QI);
|
||||
ok_long(testObject.m_dwRef, 2);
|
||||
ok_long(g_QI, 1);
|
||||
|
||||
DECLARE_QIPTR(IStdMarshalInfo) ppMarshal(ppPersist);
|
||||
ok(testObject.m_dwRef == 3, "Expected m_dwRef 3, got %lu\n", testObject.m_dwRef);
|
||||
ok(g_QI == 2, "Expected g_QI 2, got %lu\n", g_QI);
|
||||
ok_long(testObject.m_dwRef, 3);
|
||||
ok_long(g_QI, 2);
|
||||
}
|
||||
ok(testObject.m_dwRef == 1, "Expected m_dwRef 1, got %lu\n", testObject.m_dwRef);
|
||||
ok_long(testObject.m_dwRef, 1);
|
||||
{
|
||||
DECLARE_QIPTR(IStdMarshalInfo) ppMarshal;
|
||||
ok(testObject.m_dwRef == 1, "Expected m_dwRef 1, got %lu\n", testObject.m_dwRef);
|
||||
ok(g_QI == 2, "Expected g_QI 2, got %lu\n", g_QI);
|
||||
ok_long(testObject.m_dwRef, 1);
|
||||
ok_long(g_QI, 2);
|
||||
|
||||
ppMarshal = unk;
|
||||
ok(testObject.m_dwRef == 2, "Expected m_dwRef 2, got %lu\n", testObject.m_dwRef);
|
||||
ok(g_QI == 3, "Expected g_QI 3, got %lu\n", g_QI);
|
||||
ok_long(testObject.m_dwRef, 2);
|
||||
ok_long(g_QI, 3);
|
||||
|
||||
ppMarshal = static_cast<IUnknown*>(NULL);
|
||||
ok(testObject.m_dwRef == 1, "Expected m_dwRef 1, got %lu\n", testObject.m_dwRef);
|
||||
ok(g_QI == 3, "Expected g_QI 3, got %lu\n", g_QI);
|
||||
ok_long(testObject.m_dwRef, 1);
|
||||
ok_long(g_QI, 3);
|
||||
|
||||
CComPtr<IUnknown> spUnk(unk);
|
||||
ok(testObject.m_dwRef == 2, "Expected m_dwRef 2, got %lu\n", testObject.m_dwRef);
|
||||
ok(g_QI == 3, "Expected g_QI 3, got %lu\n", g_QI);
|
||||
ok_long(testObject.m_dwRef, 2);
|
||||
ok_long(g_QI, 3);
|
||||
|
||||
ppMarshal = spUnk;
|
||||
ok(testObject.m_dwRef == 3, "Expected m_dwRef 3, got %lu\n", testObject.m_dwRef);
|
||||
ok(g_QI == 4, "Expected g_QI 4, got %lu\n", g_QI);
|
||||
ok_long(testObject.m_dwRef, 3);
|
||||
ok_long(g_QI, 4);
|
||||
|
||||
spUnk.Release();
|
||||
ok(testObject.m_dwRef == 2, "Expected m_dwRef 2, got %lu\n", testObject.m_dwRef);
|
||||
ok(g_QI == 4, "Expected g_QI 4, got %lu\n", g_QI);
|
||||
ok_long(testObject.m_dwRef, 2);
|
||||
ok_long(g_QI, 4);
|
||||
|
||||
spUnk = ppMarshal;
|
||||
ok(testObject.m_dwRef == 3, "Expected m_dwRef 3, got %lu\n", testObject.m_dwRef);
|
||||
ok_long(testObject.m_dwRef, 3);
|
||||
#ifdef __REACTOS__
|
||||
// CORE-12710
|
||||
todo_if(1)
|
||||
#endif
|
||||
ok(g_QI == 5, "Expected g_QI 5, got %lu\n", g_QI);
|
||||
ok_long(g_QI, 5);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,24 +45,24 @@ START_TEST(CSimpleArray)
|
|||
{
|
||||
CSimpleArray<int> array1;
|
||||
|
||||
ok(array1.GetSize() == 0, "Expected array1's size is zero, was %d\n", array1.GetSize());
|
||||
ok_int(array1.GetSize(), 0);
|
||||
|
||||
array1.Add(123);
|
||||
|
||||
ok(array1.GetSize() == 1, "Expected array1's size is 1, was %d\n", array1.GetSize());
|
||||
ok(array1.GetData()[0] == 123, "Expected array1.GetData()[0] is 123, was %d\n", array1.GetData()[0]);
|
||||
ok(array1[0] == 123, "Expected array1[0] is 123, was %d\n", array1[0]);
|
||||
ok_int(array1.GetSize(), 1);
|
||||
ok_int(array1.GetData()[0], 123);
|
||||
ok_int(array1[0], 123);
|
||||
|
||||
array1.Add(456);
|
||||
|
||||
ok(array1.GetSize() == 2, "Expected array1's size is 2, was %d\n", array1.GetSize());
|
||||
ok(array1.GetData()[0] == 123, "Expected array1.GetData()[0] is 123, was %d\n", array1.GetData()[0]);
|
||||
ok(array1[0] == 123, "Expected array1[0] is 123, was %d\n", array1[0]);
|
||||
ok(array1.GetData()[1] == 456, "Expected array1.GetData()[1] is 456, was %d\n", array1.GetData()[1]);
|
||||
ok(array1[1] == 456, "Expected array1[1] is 456, was %d\n", array1[1]);
|
||||
ok_int(array1.GetSize(), 2);
|
||||
ok_int(array1.GetData()[0], 123);
|
||||
ok_int(array1[0], 123);
|
||||
ok_int(array1.GetData()[1], 456);
|
||||
ok_int(array1[1], 456);
|
||||
|
||||
array1.RemoveAll();
|
||||
ok(array1.GetSize() == 0, "Expected array1's size is 0, was %d\n", array1.GetSize());
|
||||
ok_int(array1.GetSize(), 0);
|
||||
|
||||
array1.Add(1);
|
||||
array1.Add(1);
|
||||
|
@ -70,92 +70,92 @@ START_TEST(CSimpleArray)
|
|||
array1.Add(2);
|
||||
array1.Add(2);
|
||||
array1.Add(3);
|
||||
ok(array1.GetSize() == 6, "Expected array1's size is 6, was %d\n", array1.GetSize());
|
||||
ok_int(array1.GetSize(), 6);
|
||||
|
||||
array1.Remove(2);
|
||||
ok(array1.GetSize() == 5, "Expected array1's size is 5, was %d\n", array1.GetSize());
|
||||
ok_int(array1.GetSize(), 5);
|
||||
|
||||
array1.Remove(1);
|
||||
ok(array1.GetSize() == 4, "Expected array1's size is 4, was %d\n", array1.GetSize());
|
||||
ok_int(array1.GetSize(), 4);
|
||||
|
||||
ok(array1[0] == 1, "Expected array1[0] is 1, was %d\n", array1[0]);
|
||||
ok(array1[1] == 1, "Expected array1[1] is 1, was %d\n", array1[1]);
|
||||
ok(array1[2] == 2, "Expected array1[2] is 2, was %d\n", array1[2]);
|
||||
ok(array1[3] == 3, "Expected array1[3] is 3, was %d\n", array1[3]);
|
||||
ok_int(array1[0], 1);
|
||||
ok_int(array1[1], 1);
|
||||
ok_int(array1[2], 2);
|
||||
ok_int(array1[3], 3);
|
||||
|
||||
ok(CCreature::s_nCount == 0, "Expected CCreature::s_nCount is zero, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 0);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
|
||||
CSimpleArray<CCreature> array2;
|
||||
{
|
||||
CCreature creature1, creature2;
|
||||
|
||||
ok(CCreature::s_nCount == 2, "Expected CCreature::s_nCount is 2, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 2);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
array2.Add(creature1);
|
||||
ok(CCreature::s_nCount == 3, "Expected CCreature::s_nCount is 3, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 3);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
array2.Add(creature2);
|
||||
ok(CCreature::s_nCount == 4, "Expected CCreature::s_nCount is 4, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 4);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
}
|
||||
ok(CCreature::s_nCount == 2, "Expected CCreature::s_nCount is 2, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 2);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
|
||||
{
|
||||
CSimpleArray<CCreature> array3(array2), array4, array5;
|
||||
ok(CCreature::s_nCount == 4, "Expected CCreature::s_nCount is 4, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 4);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
|
||||
array4 = array2;
|
||||
ok(CCreature::s_nCount == 6, "Expected CCreature::s_nCount is 6, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 6);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
|
||||
CCreature creature1;
|
||||
ok(CCreature::s_nCount == 7, "Expected CCreature::s_nCount is 7, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 7);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
|
||||
array4.Add(creature1);
|
||||
ok(CCreature::s_nCount == 8, "Expected CCreature::s_nCount is 8, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 8);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
|
||||
array3 = array4;
|
||||
ok(CCreature::s_nCount == 9, "Expected CCreature::s_nCount is 9, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 9);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
|
||||
array5 = array2;
|
||||
ok(CCreature::s_nCount == 11, "Expected CCreature::s_nCount is 11, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 11);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
|
||||
array5 = array2;
|
||||
ok(CCreature::s_nCount == 11, "Expected CCreature::s_nCount is 11, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 11);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
}
|
||||
ok(CCreature::s_nCount == 2, "Expected CCreature::s_nCount is 2, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 2);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
|
||||
array2.RemoveAll();
|
||||
ok(CCreature::s_nCount == 0, "Expected CCreature::s_nCount is zero, was: %d\n", CCreature::s_nCount);
|
||||
ok(CCreature::s_nCopyCount == 0, "Expected CCreature::s_nCopyCount is zero, was: %d\n", CCreature::s_nCopyCount);
|
||||
ok_int(CCreature::s_nCount, 0);
|
||||
ok_int(CCreature::s_nCopyCount, 0);
|
||||
|
||||
array1.RemoveAll();
|
||||
ok(array1.GetSize() == 0, "Expected array1.GetSize() is zero, was: %d\n", array1.GetSize());
|
||||
ok_int(array1.GetSize(), 0);
|
||||
for (int i = 0; i < 100; ++i)
|
||||
{
|
||||
array1.Add(i);
|
||||
}
|
||||
ok(array1.GetSize() == 100, "Expected array1.GetSize() is 100, was: %d\n", array1.GetSize());
|
||||
ok_int(array1.GetSize(), 100);
|
||||
|
||||
array1.RemoveAll();
|
||||
ok(array1.GetSize() == 0, "Expected array1.GetSize() is zero, was: %d\n", array1.GetSize());
|
||||
ok_int(array1.GetSize(), 0);
|
||||
array1.Add(123);
|
||||
array1.Add(321);
|
||||
ok(!!array1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n");
|
||||
ok(array1.GetSize() == 1, "Expected array1.GetSize() is 1, was: %d\n", array1.GetSize());
|
||||
ok_int(array1.GetSize(), 1);
|
||||
if (array1.GetSize() == 1)
|
||||
{
|
||||
ok(array1[0] == 321, "Expected array1[0] is 321, was %d\n", array1[0]);
|
||||
ok_int(array1[0], 321);
|
||||
}
|
||||
ok(!!array1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n");
|
||||
ok(array1.GetSize() == 0, "Expected array1.GetSize() is 0, was: %d\n", array1.GetSize());
|
||||
ok_int(array1.GetSize(), 0);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue