diff --git a/src/lol/base/array.h b/src/lol/base/array.h index 0fae7542..655b0be8 100644 --- a/src/lol/base/array.h +++ b/src/lol/base/array.h @@ -52,7 +52,7 @@ public: m_count(0), m_reserved(0) { - Reserve(list.size); + Reserve(list.size()); for (auto elem : list) Push(elem); } @@ -546,8 +546,11 @@ template class Array : public ArrayBase, - Array > + Array> { + using ArrayBase, + Array>::ArrayBase; + public: inline void Push(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4, T5 const &m5, T6 const &m6, T7 const &m7, T8 const &m8) @@ -585,8 +588,11 @@ template class Array : public ArrayBase, - Array > + Array> { + using ArrayBase, + Array>::ArrayBase; + public: inline void Push(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4, T5 const &m5, T6 const &m6, T7 const &m7) @@ -622,8 +628,11 @@ template class Array : public ArrayBase, - Array > + Array> { + using ArrayBase, + Array>::ArrayBase; + public: inline void Push(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4, T5 const &m5, T6 const &m6) @@ -656,8 +665,11 @@ public: template class Array : public ArrayBase, - Array > + Array> { + using ArrayBase, + Array>::ArrayBase; + public: inline void Push(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4, T5 const &m5) @@ -688,8 +700,11 @@ public: template class Array : public ArrayBase, - Array > + Array> { + using ArrayBase, + Array>::ArrayBase; + public: inline void Push(T1 const &m1, T2 const &m2, T3 const &m3, T4 const &m4) { @@ -716,8 +731,11 @@ public: template class Array : public ArrayBase, - Array > + Array> { + using ArrayBase, + Array>::ArrayBase; + public: inline void Push(T1 const &m1, T2 const &m2, T3 const &m3) { @@ -742,8 +760,11 @@ public: template class Array : public ArrayBase, - Array > + Array> { + using ArrayBase, + Array>::ArrayBase; + public: inline void Push(T1 const &m1, T2 const &m2) { @@ -766,8 +787,10 @@ public: template class Array : public ArrayBase > + Array> { + using ArrayBase>::ArrayBase; }; } /* namespace lol */ diff --git a/test/unit/array.cpp b/test/unit/array.cpp index 816af9de..dd75ca14 100644 --- a/test/unit/array.cpp +++ b/test/unit/array.cpp @@ -36,9 +36,6 @@ LOLUNIT_FIXTURE(ArrayTest) void TearDown() {} -/* HACK: we disable these tests because they fail with the - * Xcode iPhone compiler. */ -#if !defined __clang__ || !defined __arm__ LOLUNIT_TEST(ArrayPush) { Array a; @@ -55,11 +52,28 @@ LOLUNIT_FIXTURE(ArrayTest) LOLUNIT_TEST(ArrayInitializer) { - Array a = { 2, 4, 6 }; + Array a({ 2, 4, 6 }); LOLUNIT_ASSERT_EQUAL(a[0], 2); LOLUNIT_ASSERT_EQUAL(a[1], 4); LOLUNIT_ASSERT_EQUAL(a[2], 6); + + Array b = { 2, 4, 6 }; + + LOLUNIT_ASSERT_EQUAL(b[0], 2); + LOLUNIT_ASSERT_EQUAL(b[1], 4); + LOLUNIT_ASSERT_EQUAL(b[2], 6); + + Array c = { { 2, 3.0f }, + { 4, 5.0f }, + { 6, 7.0f } }; + + LOLUNIT_ASSERT_EQUAL(c[0].m1, 2); + LOLUNIT_ASSERT_EQUAL(c[0].m2, 3.0f); + LOLUNIT_ASSERT_EQUAL(c[1].m1, 4); + LOLUNIT_ASSERT_EQUAL(c[1].m2, 5.0f); + LOLUNIT_ASSERT_EQUAL(c[2].m1, 6); + LOLUNIT_ASSERT_EQUAL(c[2].m2, 7.0f); } LOLUNIT_TEST(ArrayPushWithShift) @@ -126,7 +140,6 @@ LOLUNIT_FIXTURE(ArrayTest) LOLUNIT_ASSERT_EQUAL(b[0], 0); LOLUNIT_ASSERT_EQUAL(b[1], 3); } -#endif LOLUNIT_TEST(EightElements) {