diff options
author | HampusM <hampus@hampusmat.com> | 2022-06-02 19:51:54 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-06-13 17:57:00 +0200 |
commit | eecf4b1e666211a13afa56f93477c55e8fd01621 (patch) | |
tree | 410510d6e058995174d5a5b0f535fb457a0c3542 /test/string_matrix.test.cpp | |
parent | 87f55120f96d0f4f80b497dc9006d89df2dda125 (diff) |
feat: implement game of lifev0.1.0
Diffstat (limited to 'test/string_matrix.test.cpp')
-rw-r--r-- | test/string_matrix.test.cpp | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/test/string_matrix.test.cpp b/test/string_matrix.test.cpp deleted file mode 100644 index 522a274..0000000 --- a/test/string_matrix.test.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#include "engine/graphics/string_matrix.hpp" -#include "engine/data/bounds.hpp" - -#include <doctest/doctest.h> -#include <type_traits> - -constexpr uint32_t MATRIX_WIDTH = 76; -constexpr uint32_t MATRIX_HEIGHT = 31; - -TEST_CASE("String matrix") -{ - auto string_matrix = - StringMatrix(Bounds({.width = MATRIX_WIDTH, .height = MATRIX_HEIGHT})); - - SUBCASE("Can set & get elements") - { - // NOLINTNEXTLINE(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers) - const auto position = Vector2({.x = 56, .y = 20}); - - string_matrix.set(position, "#"); - - CHECK(string_matrix.get(position) == "#"); - } - - SUBCASE("Can iterate") - { - CHECK(std::is_same_v<decltype(string_matrix.begin()), - MatrixIterator<std::string_view>>); - - CHECK(std::is_same_v<decltype(string_matrix.end()), - MatrixIterator<std::string_view>>); - - uint32_t row_iter_cnt = 0; - - for (auto row : string_matrix) - { - row_iter_cnt++; - - CHECK(std::is_same_v<decltype(row), MatrixRow<std::string_view>>); - - uint32_t col_iter_cnt = 0; - - for (auto &col : row) - { - col_iter_cnt++; - } - - CHECK(col_iter_cnt == MATRIX_WIDTH); - } - - CHECK(row_iter_cnt == MATRIX_HEIGHT); - } -} |