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/function.test.cpp | |
parent | 87f55120f96d0f4f80b497dc9006d89df2dda125 (diff) |
feat: implement game of lifev0.1.0
Diffstat (limited to 'test/function.test.cpp')
-rw-r--r-- | test/function.test.cpp | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/test/function.test.cpp b/test/function.test.cpp deleted file mode 100644 index 9aca0eb..0000000 --- a/test/function.test.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#include "util/function.hpp" - -#include <cstdint> -#include <doctest/doctest.h> - -TEST_CASE("normalize_lamda") -{ - SUBCASE("Can return a function that returns a int") - { - const int number = 58; - - CHECK(normalize_lambda( - [number]() - { - return number; - })() == number); - } - - SUBCASE("Can preserve object state") - { - class Book - { - public: - Book() noexcept = default; - - void read_page() noexcept - { - _pages_read++; - } - - [[nodiscard]] uint32_t pages_read() const noexcept - { - return _pages_read; - } - - private: - uint32_t _pages_read{0U}; - }; - - auto book = Book(); - - book.read_page(); - book.read_page(); - book.read_page(); - - CHECK(normalize_lambda( - [book]() - { - return book.pages_read(); - })() == 3); - } -} |