From e03ac49383416c13195a03e9bc4a0e36d33f7752 Mon Sep 17 00:00:00 2001 From: Guillaume Bittoun Date: Thu, 31 Jul 2014 20:07:54 +0000 Subject: [PATCH] arraynd: adding tests on size filling --- test/unit/arraynd.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/unit/arraynd.cpp b/test/unit/arraynd.cpp index 4eab4091..1ff57b95 100644 --- a/test/unit/arraynd.cpp +++ b/test/unit/arraynd.cpp @@ -15,6 +15,8 @@ #include #include "lol/unit.h" +#include + namespace lol { @@ -55,6 +57,11 @@ LOLUNIT_FIXTURE(ArrayNDTest) arraynd<40, double> d; arraynd<3, int> e = { { {1, 2}, {3, 4} }, { {5, 6}, {7, 8} } }; + + LOLUNIT_ASSERT_EQUAL(e.GetSize()[0], 2); + LOLUNIT_ASSERT_EQUAL(e.GetSize()[1], 2); + LOLUNIT_ASSERT_EQUAL(e.GetSize()[2], 2); + LOLUNIT_ASSERT_EQUAL(e[0][0][0], 1); LOLUNIT_ASSERT_EQUAL(e[1][0][0], 2); LOLUNIT_ASSERT_EQUAL(e[0][1][0], 3); @@ -65,6 +72,11 @@ LOLUNIT_FIXTURE(ArrayNDTest) LOLUNIT_ASSERT_EQUAL(e[1][1][1], 8); arraynd<3, int> f = { { {1, 2, 3, 4}, {5, 6, 7} }, { {8, 9}, {10} } }; + + LOLUNIT_ASSERT_EQUAL(f.GetSize()[0], 4); + LOLUNIT_ASSERT_EQUAL(f.GetSize()[1], 2); + LOLUNIT_ASSERT_EQUAL(f.GetSize()[2], 2); + LOLUNIT_ASSERT_EQUAL(f[0][0][0], 1); LOLUNIT_ASSERT_EQUAL(f[1][0][0], 2); LOLUNIT_ASSERT_EQUAL(f[2][0][0], 3);