#include "../Tests.hpp" #include "core/data/Array.hpp" template class Core::Array; static void testToString1() { Core::Array a; a[0] = 1; a[1] = 243; a[2] = -423; CORE_TEST_STRING("[1, 243, -423]", a); } static void testToString2() { Core::Array a; a[0] = 1; CORE_TEST_STRING("[1]", a); } static void testReadConst() { Core::Array a; for(int i = 0; i < a.getLength(); i++) { a[i] = i; } const Core::Array& c = a; for(int i = 0; i < c.getLength(); i++) { CORE_TEST_EQUAL(i, c[i]); } } static void testRangeFor() { Core::Array a; for(int i = 0; i < a.getLength(); i++) { a[i] = i; } for(int& i : a) { i++; } for(int i = 0; i < a.getLength(); i++) { CORE_TEST_EQUAL(i + 1, a[i]); } } void Core::testArray() { testToString1(); testToString2(); testReadConst(); testRangeFor(); }