[ATL][ATL_APITEST] Implemente CSimpleArray + CSimpleMap. Based on a patch from Kataya...
authorMark Jansen <mark.jansen@reactos.org>
Thu, 15 Sep 2016 19:41:03 +0000 (19:41 +0000)
committerMark Jansen <mark.jansen@reactos.org>
Thu, 15 Sep 2016 19:41:03 +0000 (19:41 +0000)
Most of the code is from Katayama Hirofumi MZ, the placement new / delete is written by me, based on a hint from Giannis.

svn path=/trunk/; revision=72688

reactos/sdk/lib/atl/atlsimpcoll.h [new file with mode: 0644]
rostests/apitests/atl/CMakeLists.txt
rostests/apitests/atl/CSimpleArray.cpp [new file with mode: 0644]
rostests/apitests/atl/CSimpleMap.cpp [new file with mode: 0644]
rostests/apitests/atl/devenv/ATLTest.sln [new file with mode: 0644]
rostests/apitests/atl/devenv/CImage.sln [deleted file]
rostests/apitests/atl/devenv/CImage.vcxproj
rostests/apitests/atl/devenv/CSimpleArray.vcxproj [new file with mode: 0644]
rostests/apitests/atl/devenv/CSimpleMap.vcxproj [new file with mode: 0644]
rostests/apitests/atl/testlist.c

diff --git a/reactos/sdk/lib/atl/atlsimpcoll.h b/reactos/sdk/lib/atl/atlsimpcoll.h
new file mode 100644 (file)
index 0000000..9564e53
--- /dev/null
@@ -0,0 +1,453 @@
+// PROJECT:        ReactOS ATL Simple Collection
+// LICENSE:        Public Domain
+// PURPOSE:        Provides compatibility to Microsoft ATL
+// PROGRAMMERS:    Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
+
+#ifndef __ATLSIMPCOLL_H__
+#define __ATLSIMPCOLL_H__
+
+#pragma once
+
+#include "atlcore.h"    // for ATL Core
+
+namespace ATL
+{
+template <typename T>
+class CSimpleArrayEqualHelper
+{
+public:
+    static bool IsEqual(const T& t1, const T& t2)
+    {
+        return t1 == t2;
+    }
+};
+
+// This class exists for the element types of no comparison.
+template <typename T>
+class CSimpleArrayEqualHelperFalse
+{
+public:
+    static bool IsEqual(const T&, const T&)
+    {
+        ATLASSERT(FALSE);
+        return false;
+    }
+};
+
+template <typename T, typename TEqual = CSimpleArrayEqualHelper<T> >
+class CSimpleArray
+{
+public:
+    typedef T _ArrayElementType;
+
+    CSimpleArray() : m_pData(NULL), m_nCount(0), m_nCapacity(0)
+    {
+    }
+
+    CSimpleArray(const CSimpleArray<T, TEqual>& src) :
+        m_pData(NULL), m_nCount(0), m_nCapacity(0)
+    {
+        *this = src;
+    }
+
+    ~CSimpleArray()
+    {
+        RemoveAll();
+    }
+
+    BOOL Add(const T& t)
+    {
+        // is the capacity enough?
+        if (m_nCapacity < m_nCount + 1)
+        {
+            // allocate extra capacity for optimization
+            const int nNewCapacity = (m_nCount + 1) + c_nGrow;
+            T *pNewData = (T *)realloc(m_pData, nNewCapacity * sizeof(T));
+            if (pNewData == NULL)
+                return FALSE;   // failure
+
+            m_pData = pNewData;
+            m_nCapacity = nNewCapacity;
+        }
+
+        // call constructor
+        ConstructItemInPlace(m_nCount, t);
+
+        // increment
+        ++m_nCount;
+
+        return TRUE;
+    }
+
+    int Find(const T& t) const
+    {
+        for (int nIndex = 0; nIndex < m_nCount; ++nIndex)
+        {
+            if (TEqual::IsEqual(m_pData[nIndex], t))
+            {
+                return nIndex;  // success
+            }
+        }
+        return -1;  // failure
+    }
+
+    T* GetData()
+    {
+        return m_pData;
+    }
+
+    const T* GetData() const
+    {
+        return m_pData;
+    }
+
+    int GetSize() const
+    {
+        return m_nCount;
+    }
+
+    BOOL Remove(const T& t)
+    {
+        return RemoveAt(Find(t));
+    }
+
+    void RemoveAll()
+    {
+        if (m_pData)
+        {
+            // call destructor
+            const int nCount = m_nCount;
+            for (int nIndex = 0; nIndex < nCount; ++nIndex)
+            {
+                DestructItem(nIndex);
+            }
+
+            free(m_pData);
+            m_pData = NULL;
+        }
+        m_nCount = 0;
+        m_nCapacity = 0;
+    }
+
+    BOOL RemoveAt(int nIndex)
+    {
+        // boundary check
+        if (nIndex < 0 || m_nCount <= nIndex)
+            return FALSE;   // failure
+
+        // call destructor
+        DestructItem(nIndex);
+
+        // move range [nIndex + 1, m_nCount) to nIndex
+        const int nRightCount = m_nCount - (nIndex + 1);
+        const int nRightSize = nRightCount * sizeof(T);
+        memmove(&m_pData[nIndex], &m_pData[nIndex + 1], nRightSize);
+
+        // decrement
+        --m_nCount;
+
+        return TRUE;
+    }
+
+    BOOL SetAtIndex(int nIndex, const T& t)
+    {
+        // boundary check
+        if (nIndex < 0 || m_nCount <= nIndex)
+            return FALSE;   // failure
+
+        // store it
+        m_pData[nIndex] = t;
+        return TRUE;
+    }
+
+    T& operator[](int nIndex)
+    {
+        ATLASSERT(0 <= nIndex && nIndex < m_nCount);
+        return m_pData[nIndex];
+    }
+
+    const T& operator[](int nIndex) const
+    {
+        ATLASSERT(0 <= nIndex && nIndex < m_nCount);
+        return m_pData[nIndex];
+    }
+
+    CSimpleArray<T, TEqual>& operator=(const CSimpleArray<T, TEqual>& src)
+    {
+        // don't copy if two objects are same
+        if (this == &src)
+            return *this;
+
+        if (src.GetSize() != GetSize())
+        {
+            RemoveAll();
+
+            m_nCapacity = src.GetSize();
+
+            T *pNewData = (T *)realloc(m_pData, m_nCapacity * sizeof(T));
+            ATLASSERT(pNewData);
+            if (pNewData == NULL)
+                return *this;   // failure
+
+            // store new data and capacity
+            m_pData = pNewData;
+            m_nCount = m_nCapacity;
+        }
+        else
+        {
+            for (int nIndex = 0; nIndex < m_nCount; ++nIndex)
+            {
+                DestructItem(nIndex);
+            }
+        }
+
+        ATLASSERT(GetSize() == src.GetSize());
+        for (int nIndex = 0; nIndex < src.GetSize(); ++nIndex)
+        {
+            ConstructItemInPlace(nIndex, src[nIndex]);
+        }
+
+        return *this;
+    }
+
+protected:
+    T *     m_pData;                // malloc'ed
+    int     m_nCount;               // # of items of type T
+    int     m_nCapacity;            // for optimization
+    static const int c_nGrow = 8;   // for optimization
+
+    // NOTE: Range m_pData[0] .. m_pData[m_nCapacity - 1] are accessible.
+    // NOTE: Range [0, m_nCount) are constructed.
+    // NOTE: Range [m_nCount, m_nCapacity) are not constructed.
+    // NOTE: 0 <= m_nCount && m_nCount <= m_nCapacity.
+
+    // call constructor at nIndex
+    void ConstructItemInPlace(int nIndex, const T& src)
+    {
+        new(&m_pData[nIndex]) ConstructImpl(src);
+    }
+
+    // call destructor at nIndex
+    void DestructItem(int nIndex)
+    {
+        m_pData[nIndex].~T();
+    }
+
+private:
+
+    struct ConstructImpl
+    {
+        ConstructImpl(const T& obj)
+            :m_ConstructHelper(obj)
+        {
+        }
+
+        static void *operator new(size_t, void *ptr)
+        {
+            return ptr;
+        }
+
+        static void operator delete(void *p, void* )
+        {
+        }
+
+        T m_ConstructHelper;
+    };
+
+};
+
+template <typename TKey, typename TVal>
+class CSimpleMapEqualHelper
+{
+public:
+    static bool IsEqualKey(const TKey& k1, const TKey& k2)
+    {
+        return k1 == k2;
+    }
+
+    static bool IsEqualValue(const TVal& v1, const TVal& v2)
+    {
+        return v1 == v2;
+    }
+};
+
+// This class exists for the keys and the values of no comparison.
+template <typename TKey, typename TVal>
+class CSimpleMapEqualHelperFalse
+{
+public:
+    static bool IsEqualKey(const TKey& k1, const TKey& k2)
+    {
+        ATLASSERT(FALSE);
+        return false;
+    }
+
+    static bool IsEqualValue(const TVal& v1, const TVal& v2)
+    {
+        ATLASSERT(FALSE);
+        return false;
+    }
+};
+
+template <typename TKey, typename TVal,
+          typename TEqual = CSimpleMapEqualHelper<TKey, TVal> >
+class CSimpleMap
+{
+public:
+    typedef TKey _ArrayKeyType;
+    typedef TVal _ArrayElementType;
+
+    CSimpleMap()
+    {
+    }
+
+    ~CSimpleMap()
+    {
+    }
+
+    BOOL Add(const TKey& key, const TVal& val)
+    {
+        Pair pair(key, val);
+        return m_Pairs.Add(pair);
+    }
+
+    int FindKey(const TKey& key) const
+    {
+        const int nCount = GetSize();
+        for (int nIndex = 0; nIndex < nCount; ++nIndex)
+        {
+            if (TEqual::IsEqualKey(m_Pairs[nIndex].key, key))
+            {
+                return nIndex;  // success
+            }
+        }
+        return -1;  // failure
+    }
+
+    int FindVal(const TVal& val) const
+    {
+        const int nCount = GetSize();
+        for (int nIndex = 0; nIndex < nCount; ++nIndex)
+        {
+            if (TEqual::IsEqualValue(m_Pairs[nIndex].val, val))
+            {
+                return nIndex;  // success
+            }
+        }
+        return -1;  // failure
+    }
+
+    TKey& GetKeyAt(int nIndex)
+    {
+        ATLASSERT(0 <= nIndex && nIndex < GetSize());
+        return m_Pairs[nIndex].key;
+    }
+
+    const TKey& GetKeyAt(int nIndex) const
+    {
+        ATLASSERT(0 <= nIndex && nIndex < GetSize());
+        return m_Pairs[nIndex].key;
+    }
+
+    int GetSize() const
+    {
+        return m_Pairs.GetSize();
+    }
+
+    TVal& GetValueAt(int nIndex)
+    {
+        ATLASSERT(0 <= nIndex && nIndex < GetSize());
+        return m_Pairs[nIndex].val;
+    }
+
+    const TVal& GetValueAt(int nIndex) const
+    {
+        ATLASSERT(0 <= nIndex && nIndex < GetSize());
+        return m_Pairs[nIndex].val;
+    }
+
+    TVal Lookup(const TKey& key) const
+    {
+        int nIndex = FindKey(key);
+        if (nIndex < 0)
+            return TVal();
+        return m_Pairs[nIndex].val;
+    }
+
+    BOOL Remove(const TKey& key)
+    {
+        int nIndex = FindKey(key);
+        return RemoveAt(nIndex);
+    }
+
+    void RemoveAll()
+    {
+        m_Pairs.RemoveAll();
+    }
+
+    BOOL RemoveAt(int nIndex)
+    {
+        return m_Pairs.RemoveAt(nIndex);
+    }
+
+    TKey ReverseLookup(const TVal& val) const
+    {
+        int nIndex = FindVal(val);
+        if (nIndex < 0)
+            return TKey();
+        return m_Pairs[nIndex].key;
+    }
+
+    BOOL SetAt(const TKey& key, const TVal& val)
+    {
+        int nIndex = FindKey(key);
+        if (nIndex < 0)
+            return Add(key, val);
+
+        m_Pairs[nIndex].val = val;
+        return TRUE;
+    }
+
+    BOOL SetAtIndex(int nIndex, const TKey& key, const TVal& val)
+    {
+        // boundary check
+        if (nIndex < 0 || GetSize() <= nIndex)
+            return FALSE;
+
+        m_Pairs[nIndex].key = key;
+        m_Pairs[nIndex].val = val;
+        return TRUE;
+    }
+
+protected:
+    struct Pair
+    {
+        TKey key;
+        TVal val;
+
+        Pair()
+        {
+        }
+
+        Pair(const TKey& k, const TVal& v) : key(k), val(v)
+        {
+        }
+
+        Pair(const Pair& pair) : key(pair.key), val(pair.val)
+        {
+        }
+
+        Pair& operator=(const Pair& pair)
+        {
+            key = pair.key;
+            val = pair.val;
+            return *this;
+        }
+    };
+
+    CSimpleArray<Pair, CSimpleArrayEqualHelperFalse<Pair> > m_Pairs;
+};
+
+}
+
+#endif
index ada8acd..802911c 100644 (file)
@@ -10,6 +10,8 @@ add_executable(atl_apitest
     CComHeapPtr.cpp
     CImage.cpp
     CRegKey.cpp
     CComHeapPtr.cpp
     CImage.cpp
     CRegKey.cpp
+    CSimpleArray.cpp
+    CSimpleMap.cpp
     CString.cpp
     testlist.c
     atl_apitest.rc)
     CString.cpp
     testlist.c
     atl_apitest.rc)
diff --git a/rostests/apitests/atl/CSimpleArray.cpp b/rostests/apitests/atl/CSimpleArray.cpp
new file mode 100644 (file)
index 0000000..a287a5c
--- /dev/null
@@ -0,0 +1,186 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         LGPLv2.1+ - See COPYING.LIB in the top level directory
+ * PURPOSE:         Test for CSimpleArray
+ * PROGRAMMER:      Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
+ */
+
+#ifdef __REACTOS__
+    #include <apitest.h>
+#else
+    #include <stdlib.h>
+    #include <stdio.h>
+    #include <stdarg.h>
+    int g_tests_executed = 0;
+    int g_tests_failed = 0;
+    void ok_func(const char *file, int line, bool value, const char *fmt, ...)
+    {
+        va_list va;
+        va_start(va, fmt);
+        if (!value)
+        {
+            printf("%s (%d): ", file, line);
+            vprintf(fmt, va);
+            g_tests_failed++;
+        }
+        g_tests_executed++;
+        va_end(va);
+    }
+    #undef ok
+    #define ok(value, ...)  ok_func(__FILE__, __LINE__, value, __VA_ARGS__)
+    #define START_TEST(x)   int main(void)
+#endif
+
+#include <atlbase.h>
+#include <atlsimpcoll.h>
+
+struct CCreature
+{
+    static int s_nCount;
+    static int s_nCopyCount;
+    CCreature()
+    {
+        CCreature::s_nCount++;
+    }
+    CCreature(const CCreature& c)
+    {
+        CCreature::s_nCount++;
+    }
+    ~CCreature()
+    {
+        CCreature::s_nCount--;
+    }
+    CCreature& operator=(const CCreature& other)
+    {
+        CCreature::s_nCopyCount++;
+        return *this;
+    }
+};
+
+int CCreature::s_nCount = 0;
+int CCreature::s_nCopyCount = 0;
+
+
+START_TEST(CSimpleArray)
+{
+    CSimpleArray<int> array1;
+
+    ok(array1.GetSize() == 0, "Expected array1's size is zero, was %d\n", array1.GetSize());
+
+    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]);
+
+    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]);
+
+    array1.RemoveAll();
+    ok(array1.GetSize() == 0, "Expected array1's size is 0, was %d\n", array1.GetSize());
+
+    array1.Add(1);
+    array1.Add(1);
+    array1.Add(1);
+    array1.Add(2);
+    array1.Add(2);
+    array1.Add(3);
+    ok(array1.GetSize() == 6, "Expected array1's size is 6, was %d\n", array1.GetSize());
+
+    array1.Remove(2);
+    ok(array1.GetSize() == 5, "Expected array1's size is 5, was %d\n", array1.GetSize());
+
+    array1.Remove(1);
+    ok(array1.GetSize() == 4, "Expected array1's size is 4, was %d\n", array1.GetSize());
+
+    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(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);
+
+    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);
+        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);
+        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(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);
+
+    {
+        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);
+
+        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);
+
+        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);
+
+        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);
+
+        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);
+
+        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);
+
+        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(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);
+
+    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);
+
+    array1.RemoveAll();
+    ok(array1.GetSize() == 0, "Expected array1.GetSize() is zero, was: %d\n", array1.GetSize());
+    for (int i = 0; i < 100; ++i)
+    {
+        array1.Add(i);
+    }
+    ok(array1.GetSize() == 100, "Expected array1.GetSize() is 100, was: %d\n", array1.GetSize());
+
+    array1.RemoveAll();
+    ok(array1.GetSize() == 0, "Expected array1.GetSize() is zero, was: %d\n", array1.GetSize());
+    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());
+    if (array1.GetSize() == 1)
+    {
+        ok(array1[0] == 321, "Expected array1[0] is 321, was %d\n", array1[0]);
+    }
+    ok(!!array1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n");
+    ok(array1.GetSize() == 0, "Expected array1.GetSize() is 0, was: %d\n", array1.GetSize());
+
+#ifndef __REACTOS__
+    printf("CSimpleArray: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed);
+    return g_tests_failed;
+#endif
+}
diff --git a/rostests/apitests/atl/CSimpleMap.cpp b/rostests/apitests/atl/CSimpleMap.cpp
new file mode 100644 (file)
index 0000000..eac6a2d
--- /dev/null
@@ -0,0 +1,206 @@
+/*
+ * PROJECT:         ReactOS api tests
+ * LICENSE:         LGPLv2.1+ - See COPYING.LIB in the top level directory
+ * PURPOSE:         Test for CSimpleMap
+ * PROGRAMMER:      Katayama Hirofumi MZ (katayama.hirofumi.mz@gmail.com)
+ */
+
+#ifdef __REACTOS__
+    #include <apitest.h>
+#else
+    #include <stdlib.h>
+    #include <stdio.h>
+    #include <stdarg.h>
+    int g_tests_executed = 0;
+    int g_tests_failed = 0;
+    void ok_func(const char *file, int line, bool value, const char *fmt, ...)
+    {
+        va_list va;
+        va_start(va, fmt);
+        if (!value)
+        {
+            printf("%s (%d): ", file, line);
+            vprintf(fmt, va);
+            g_tests_failed++;
+        }
+        g_tests_executed++;
+        va_end(va);
+    }
+    #undef ok
+    #define ok(value, ...)  ok_func(__FILE__, __LINE__, value, __VA_ARGS__)
+    #define START_TEST(x)   int main(void)
+#endif
+
+#include <atlbase.h>
+#include <atlsimpcoll.h>
+
+struct CMonster
+{
+    static int s_nCount;
+    static int s_nCopyCount;
+
+    CMonster()
+    {
+        CMonster::s_nCount++;
+    }
+    CMonster(const CMonster& c)
+    {
+        CMonster::s_nCount++;
+    }
+    ~CMonster()
+    {
+        CMonster::s_nCount--;
+    }
+    CMonster& operator=(const CMonster& other)
+    {
+        CMonster::s_nCopyCount++;
+        return *this;
+    }
+};
+
+int CMonster::s_nCount = 0;
+int CMonster::s_nCopyCount = 0;
+
+START_TEST(CSimpleMap)
+{
+    CSimpleMap<int, int> map1;
+
+    ok(map1.GetSize() == 0, "Expected map1's size is zero, was %d\n", map1.GetSize());
+
+    map1.Add(1, 2);
+    ok(map1.GetSize() == 1, "Expected map1's size is 1, was %d\n", map1.GetSize());
+    map1.Add(2, 3);
+    ok(map1.GetSize() == 2, "Expected map1's size is 2, was %d\n", map1.GetSize());
+
+    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(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(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(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));
+
+    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(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));
+
+    map1.Remove(1);
+    ok(map1.GetSize() == 1, "Expected map1's size is 1, was %d\n", map1.GetSize());
+    map1.Remove(2);
+    ok(map1.GetSize() == 0, "Expected map1's size is 0, was %d\n", map1.GetSize());
+
+    map1.Add(1, 4);
+    ok(map1.GetSize() == 1, "Expected map1's size is 1, was %d\n", map1.GetSize());
+    map1.Add(2, 8);
+    ok(map1.GetSize() == 2, "Expected map1's size is 2, was %d\n", map1.GetSize());
+    map1.Add(3, 12);
+    ok(map1.GetSize() == 3, "Expected map1's size is 3, was %d\n", map1.GetSize());
+
+    map1.RemoveAll();
+    ok(map1.GetSize() == 0, "Expected map1's size is 0, was %d\n", map1.GetSize());
+
+    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);
+
+    CSimpleMap<CMonster, CMonster> map2;
+    ok(map2.GetSize() == 0, "Expected map2's size is zero, was %d\n", map2.GetSize());
+
+    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);
+
+    {
+        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);
+
+        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);
+
+        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(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);
+
+    {
+        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);
+
+        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);
+
+        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(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);
+
+    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);
+
+    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);
+
+    CSimpleMap<int, CMonster> map3;
+    ok(map3.GetSize() == 0, "Expected map3's size is 0, was %d\n", map3.GetSize());
+
+    CMonster m3;
+    ok(CMonster::s_nCount == 1, "Expected CMonster::s_nCount is 1, was %d\n", CMonster::s_nCount);
+
+    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);
+
+    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);
+
+    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);
+
+    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);
+
+    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);
+
+    map1.Add(1, 2);
+    ok(map1.GetSize() == 1, "Expected map1's size is 1, was %d\n", map1.GetSize());
+    map1.Add(2, 3);
+    ok(map1.GetSize() == 2, "Expected map1's size is 2, was %d\n", map1.GetSize());
+
+    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(!!map1.RemoveAt(0), "Expected RemoveAt(0) to succeed\n");
+    ok(map1.GetSize() == 0, "Expected map1's size is 0, was %d\n", map1.GetSize());
+
+#ifndef __REACTOS__
+    printf("CSimpleMap: %i tests executed (0 marked as todo, %i failures), 0 skipped.\n", g_tests_executed, g_tests_failed);
+    return g_tests_failed;
+#endif
+}
diff --git a/rostests/apitests/atl/devenv/ATLTest.sln b/rostests/apitests/atl/devenv/ATLTest.sln
new file mode 100644 (file)
index 0000000..76dd542
--- /dev/null
@@ -0,0 +1,48 @@
+\r
+Microsoft Visual Studio Solution File, Format Version 12.00\r
+# Visual Studio 14\r
+VisualStudioVersion = 14.0.24720.0\r
+MinimumVisualStudioVersion = 10.0.40219.1\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CImage", "CImage.vcxproj", "{AE520E17-2DAE-40FF-B082-F32A7A935FB2}"\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSimpleArray", "CSimpleArray.vcxproj", "{9F029341-87C2-4BFD-B1FC-D5F5B8D28D55}"\r
+EndProject\r
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CSimpleMap", "CSimpleMap.vcxproj", "{EC560DE6-6DB3-437D-85CA-582491FE6F95}"\r
+EndProject\r
+Global\r
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
+               Debug|x64 = Debug|x64\r
+               Debug|x86 = Debug|x86\r
+               Release|x64 = Release|x64\r
+               Release|x86 = Release|x86\r
+       EndGlobalSection\r
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
+               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Debug|x64.ActiveCfg = Debug|x64\r
+               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Debug|x64.Build.0 = Debug|x64\r
+               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Debug|x86.ActiveCfg = Debug|Win32\r
+               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Debug|x86.Build.0 = Debug|Win32\r
+               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Release|x64.ActiveCfg = Release|x64\r
+               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Release|x64.Build.0 = Release|x64\r
+               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Release|x86.ActiveCfg = Release|Win32\r
+               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Release|x86.Build.0 = Release|Win32\r
+               {9F029341-87C2-4BFD-B1FC-D5F5B8D28D55}.Debug|x64.ActiveCfg = Debug|x64\r
+               {9F029341-87C2-4BFD-B1FC-D5F5B8D28D55}.Debug|x64.Build.0 = Debug|x64\r
+               {9F029341-87C2-4BFD-B1FC-D5F5B8D28D55}.Debug|x86.ActiveCfg = Debug|Win32\r
+               {9F029341-87C2-4BFD-B1FC-D5F5B8D28D55}.Debug|x86.Build.0 = Debug|Win32\r
+               {9F029341-87C2-4BFD-B1FC-D5F5B8D28D55}.Release|x64.ActiveCfg = Release|x64\r
+               {9F029341-87C2-4BFD-B1FC-D5F5B8D28D55}.Release|x64.Build.0 = Release|x64\r
+               {9F029341-87C2-4BFD-B1FC-D5F5B8D28D55}.Release|x86.ActiveCfg = Release|Win32\r
+               {9F029341-87C2-4BFD-B1FC-D5F5B8D28D55}.Release|x86.Build.0 = Release|Win32\r
+               {EC560DE6-6DB3-437D-85CA-582491FE6F95}.Debug|x64.ActiveCfg = Debug|x64\r
+               {EC560DE6-6DB3-437D-85CA-582491FE6F95}.Debug|x64.Build.0 = Debug|x64\r
+               {EC560DE6-6DB3-437D-85CA-582491FE6F95}.Debug|x86.ActiveCfg = Debug|Win32\r
+               {EC560DE6-6DB3-437D-85CA-582491FE6F95}.Debug|x86.Build.0 = Debug|Win32\r
+               {EC560DE6-6DB3-437D-85CA-582491FE6F95}.Release|x64.ActiveCfg = Release|x64\r
+               {EC560DE6-6DB3-437D-85CA-582491FE6F95}.Release|x64.Build.0 = Release|x64\r
+               {EC560DE6-6DB3-437D-85CA-582491FE6F95}.Release|x86.ActiveCfg = Release|Win32\r
+               {EC560DE6-6DB3-437D-85CA-582491FE6F95}.Release|x86.Build.0 = Release|Win32\r
+       EndGlobalSection\r
+       GlobalSection(SolutionProperties) = preSolution\r
+               HideSolutionNode = FALSE\r
+       EndGlobalSection\r
+EndGlobal\r
diff --git a/rostests/apitests/atl/devenv/CImage.sln b/rostests/apitests/atl/devenv/CImage.sln
deleted file mode 100644 (file)
index 099c2c3..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-\r
-Microsoft Visual Studio Solution File, Format Version 12.00\r
-# Visual Studio 14\r
-VisualStudioVersion = 14.0.24720.0\r
-MinimumVisualStudioVersion = 10.0.40219.1\r
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CImage", "CImage.vcxproj", "{AE520E17-2DAE-40FF-B082-F32A7A935FB2}"\r
-EndProject\r
-Global\r
-       GlobalSection(SolutionConfigurationPlatforms) = preSolution\r
-               Debug|x64 = Debug|x64\r
-               Debug|x86 = Debug|x86\r
-               Release|x64 = Release|x64\r
-               Release|x86 = Release|x86\r
-       EndGlobalSection\r
-       GlobalSection(ProjectConfigurationPlatforms) = postSolution\r
-               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Debug|x64.ActiveCfg = Debug|x64\r
-               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Debug|x64.Build.0 = Debug|x64\r
-               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Debug|x86.ActiveCfg = Debug|Win32\r
-               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Debug|x86.Build.0 = Debug|Win32\r
-               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Release|x64.ActiveCfg = Release|x64\r
-               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Release|x64.Build.0 = Release|x64\r
-               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Release|x86.ActiveCfg = Release|Win32\r
-               {AE520E17-2DAE-40FF-B082-F32A7A935FB2}.Release|x86.Build.0 = Release|Win32\r
-       EndGlobalSection\r
-       GlobalSection(SolutionProperties) = preSolution\r
-               HideSolutionNode = FALSE\r
-       EndGlobalSection\r
-EndGlobal\r
index 571f2e3..e958b07 100644 (file)
@@ -27,7 +27,7 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
     <ConfigurationType>Application</ConfigurationType>\r
     <UseDebugLibraries>true</UseDebugLibraries>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
     <ConfigurationType>Application</ConfigurationType>\r
     <UseDebugLibraries>true</UseDebugLibraries>\r
-    <PlatformToolset>v140</PlatformToolset>\r
+    <PlatformToolset>v120_xp</PlatformToolset>\r
     <CharacterSet>Unicode</CharacterSet>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
     <CharacterSet>Unicode</CharacterSet>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
     <ConfigurationType>Application</ConfigurationType>\r
     <UseDebugLibraries>true</UseDebugLibraries>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
     <ConfigurationType>Application</ConfigurationType>\r
     <UseDebugLibraries>true</UseDebugLibraries>\r
-    <PlatformToolset>v140</PlatformToolset>\r
     <CharacterSet>Unicode</CharacterSet>\r
     <CharacterSet>Unicode</CharacterSet>\r
+    <PlatformToolset>v120_xp</PlatformToolset>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
     <ConfigurationType>Application</ConfigurationType>\r
     <UseDebugLibraries>false</UseDebugLibraries>\r
   </PropertyGroup>\r
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
     <ConfigurationType>Application</ConfigurationType>\r
     <UseDebugLibraries>false</UseDebugLibraries>\r
-    <PlatformToolset>v140</PlatformToolset>\r
+    <PlatformToolset>v120_xp</PlatformToolset>\r
     <CharacterSet>Unicode</CharacterSet>\r
   </PropertyGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
     <CharacterSet>Unicode</CharacterSet>\r
   </PropertyGroup>\r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
diff --git a/rostests/apitests/atl/devenv/CSimpleArray.vcxproj b/rostests/apitests/atl/devenv/CSimpleArray.vcxproj
new file mode 100644 (file)
index 0000000..189f4e2
--- /dev/null
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup Label="ProjectConfigurations">\r
+    <ProjectConfiguration Include="Debug|Win32">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|Win32">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Debug|x64">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|x64">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+  </ItemGroup>\r
+  <PropertyGroup Label="Globals">\r
+    <ProjectGuid>{9F029341-87C2-4BFD-B1FC-D5F5B8D28D55}</ProjectGuid>\r
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
+    <Keyword>AtlProj</Keyword>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <PlatformToolset>v120_xp</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <PlatformToolset>v120_xp</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <PlatformToolset>v120_xp</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <PlatformToolset>v120_xp</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+  <ImportGroup Label="ExtensionSettings">\r
+  </ImportGroup>\r
+  <ImportGroup Label="Shared">\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <PropertyGroup Label="UserMacros" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <IgnoreImportLibrary>true</IgnoreImportLibrary>\r
+    <LinkIncremental>true</LinkIncremental>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <IgnoreImportLibrary>true</IgnoreImportLibrary>\r
+    <LinkIncremental>true</LinkIncremental>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <IgnoreImportLibrary>true</IgnoreImportLibrary>\r
+    <LinkIncremental>false</LinkIncremental>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <IgnoreImportLibrary>true</IgnoreImportLibrary>\r
+    <LinkIncremental>false</LinkIncremental>\r
+  </PropertyGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <ClCompile>\r
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <ResourceCompile>\r
+      <Culture>0x0409</Culture>\r
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+    </ResourceCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <RegisterOutput>true</RegisterOutput>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <ClCompile>\r
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <ResourceCompile>\r
+      <Culture>0x0409</Culture>\r
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+    </ResourceCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <RegisterOutput>true</RegisterOutput>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <ClCompile>\r
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <ResourceCompile>\r
+      <Culture>0x0409</Culture>\r
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+    </ResourceCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+      <RegisterOutput>true</RegisterOutput>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <ClCompile>\r
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <ResourceCompile>\r
+      <Culture>0x0409</Culture>\r
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+    </ResourceCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+      <RegisterOutput>true</RegisterOutput>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemGroup>\r
+    <ClCompile Include="../CSimpleArray.cpp">\r
+      <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MultiThreaded</RuntimeLibrary>\r
+      <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MultiThreaded</RuntimeLibrary>\r
+      <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MultiThreadedDebug</RuntimeLibrary>\r
+      <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MultiThreadedDebug</RuntimeLibrary>\r
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>\r
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>\r
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>\r
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>\r
+    </ClCompile>\r
+  </ItemGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+  <ImportGroup Label="ExtensionTargets">\r
+  </ImportGroup>\r
+</Project>
\ No newline at end of file
diff --git a/rostests/apitests/atl/devenv/CSimpleMap.vcxproj b/rostests/apitests/atl/devenv/CSimpleMap.vcxproj
new file mode 100644 (file)
index 0000000..2ff7f04
--- /dev/null
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="utf-8"?>\r
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <ItemGroup Label="ProjectConfigurations">\r
+    <ProjectConfiguration Include="Debug|Win32">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|Win32">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>Win32</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Debug|x64">\r
+      <Configuration>Debug</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+    <ProjectConfiguration Include="Release|x64">\r
+      <Configuration>Release</Configuration>\r
+      <Platform>x64</Platform>\r
+    </ProjectConfiguration>\r
+  </ItemGroup>\r
+  <PropertyGroup Label="Globals">\r
+    <ProjectGuid>{EC560DE6-6DB3-437D-85CA-582491FE6F95}</ProjectGuid>\r
+    <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>\r
+    <Keyword>AtlProj</Keyword>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <PlatformToolset>v120_xp</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <PlatformToolset>v120_xp</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>true</UseDebugLibraries>\r
+    <PlatformToolset>v120_xp</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
+    <ConfigurationType>Application</ConfigurationType>\r
+    <UseDebugLibraries>false</UseDebugLibraries>\r
+    <PlatformToolset>v120_xp</PlatformToolset>\r
+    <CharacterSet>Unicode</CharacterSet>\r
+  </PropertyGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
+  <ImportGroup Label="ExtensionSettings">\r
+  </ImportGroup>\r
+  <ImportGroup Label="Shared">\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />\r
+  </ImportGroup>\r
+  <PropertyGroup Label="UserMacros" />\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <IgnoreImportLibrary>true</IgnoreImportLibrary>\r
+    <LinkIncremental>true</LinkIncremental>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <IgnoreImportLibrary>true</IgnoreImportLibrary>\r
+    <LinkIncremental>true</LinkIncremental>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <IgnoreImportLibrary>true</IgnoreImportLibrary>\r
+    <LinkIncremental>false</LinkIncremental>\r
+  </PropertyGroup>\r
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <IgnoreImportLibrary>true</IgnoreImportLibrary>\r
+    <LinkIncremental>false</LinkIncremental>\r
+  </PropertyGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">\r
+    <ClCompile>\r
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <ResourceCompile>\r
+      <Culture>0x0409</Culture>\r
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+    </ResourceCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <RegisterOutput>true</RegisterOutput>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">\r
+    <ClCompile>\r
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>Disabled</Optimization>\r
+      <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <ResourceCompile>\r
+      <Culture>0x0409</Culture>\r
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+    </ResourceCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <RegisterOutput>true</RegisterOutput>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">\r
+    <ClCompile>\r
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <ResourceCompile>\r
+      <Culture>0x0409</Culture>\r
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+    </ResourceCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+      <RegisterOutput>true</RegisterOutput>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">\r
+    <ClCompile>\r
+      <PrecompiledHeader>NotUsing</PrecompiledHeader>\r
+      <WarningLevel>Level3</WarningLevel>\r
+      <Optimization>MaxSpeed</Optimization>\r
+      <PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <SDLCheck>true</SDLCheck>\r
+    </ClCompile>\r
+    <ResourceCompile>\r
+      <Culture>0x0409</Culture>\r
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+    </ResourceCompile>\r
+    <Link>\r
+      <SubSystem>Console</SubSystem>\r
+      <GenerateDebugInformation>true</GenerateDebugInformation>\r
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>\r
+      <OptimizeReferences>true</OptimizeReferences>\r
+      <RegisterOutput>true</RegisterOutput>\r
+    </Link>\r
+  </ItemDefinitionGroup>\r
+  <ItemGroup>\r
+    <ClCompile Include="../CSimpleMap.cpp">\r
+      <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MultiThreaded</RuntimeLibrary>\r
+      <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MultiThreaded</RuntimeLibrary>\r
+      <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">MultiThreadedDebug</RuntimeLibrary>\r
+      <RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">MultiThreadedDebug</RuntimeLibrary>\r
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>\r
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>\r
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">NotUsing</PrecompiledHeader>\r
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</PrecompiledHeader>\r
+    </ClCompile>\r
+  </ItemGroup>\r
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
+  <ImportGroup Label="ExtensionTargets">\r
+  </ImportGroup>\r
+</Project>
\ No newline at end of file
index 535f8bc..bfeb9d0 100644 (file)
@@ -6,6 +6,8 @@ extern void func_CComBSTR(void);
 extern void func_CComHeapPtr(void);
 extern void func_CImage(void);
 extern void func_CRegKey(void);
 extern void func_CComHeapPtr(void);
 extern void func_CImage(void);
 extern void func_CRegKey(void);
+extern void func_CSimpleArray(void);
+extern void func_CSimpleMap(void);
 extern void func_CString(void);
 
 const struct test winetest_testlist[] =
 extern void func_CString(void);
 
 const struct test winetest_testlist[] =
@@ -15,6 +17,8 @@ const struct test winetest_testlist[] =
     { "CComHeapPtr", func_CComHeapPtr },
     { "CImage", func_CImage },
     { "CRegKey", func_CRegKey },
     { "CComHeapPtr", func_CComHeapPtr },
     { "CImage", func_CImage },
     { "CRegKey", func_CRegKey },
+    { "CSimpleArray", func_CSimpleArray },
+    { "CSimpleMap", func_CSimpleMap },
     { "CString", func_CString },
     { 0, 0 }
 };
     { "CString", func_CString },
     { 0, 0 }
 };