1234567891011121314151617181920212223242526272829303132333435 |
- #include "tests/ArrayTests.h"
- #include "data/Array.h"
- #include "test/Test.h"
- using String = Core::ArrayString<128>;
- template<typename T>
- static String build(Core::Test& test, const T& t) {
- String s;
- test.checkFalse(s.append(t), "append works");
- return s;
- }
- static void testToString1(Core::Test& test) {
- Core::Array<int, 3> a;
- a[0] = 1;
- a[1] = 243;
- a[2] = -423;
- test.checkEqual(build(test, "[1, 243, -423]"), build(test, a),
- "to string 1");
- }
- static void testToString2(Core::Test& test) {
- Core::Array<int, 1> a;
- a[0] = 1;
- test.checkEqual(build(test, "[1]"), build(test, a), "to string 2");
- }
- void Core::ArrayTests::test() {
- Core::Test test("Array");
- testToString1(test);
- testToString2(test);
- test.finalize();
- }
|