ArrayTests.cpp 605 B

1234567891011121314151617181920212223242526
  1. #include "tests/ArrayTests.h"
  2. #include "data/Array.h"
  3. #include "test/Test.h"
  4. static void testToString1(Core::Test& test) {
  5. Core::Array<int, 3> a;
  6. a[0] = 1;
  7. a[1] = 243;
  8. a[2] = -423;
  9. test.checkEqual(Core::String("[1, 243, -423]"), Core::String(a),
  10. "to string 1");
  11. }
  12. static void testToString2(Core::Test& test) {
  13. Core::Array<int, 1> a;
  14. a[0] = 1;
  15. test.checkEqual(Core::String("[1]"), Core::String(a), "to string 2");
  16. }
  17. void Core::ArrayTests::test() {
  18. Core::Test test("Array");
  19. testToString1(test);
  20. testToString2(test);
  21. test.finalize();
  22. }