diff options
Diffstat (limited to 'libs/kstd/tests')
| -rw-r--r-- | libs/kstd/tests/os_mock.cpp | 15 | ||||
| -rw-r--r-- | libs/kstd/tests/vector.cpp | 11 |
2 files changed, 26 insertions, 0 deletions
diff --git a/libs/kstd/tests/os_mock.cpp b/libs/kstd/tests/os_mock.cpp new file mode 100644 index 0000000..39b7f0d --- /dev/null +++ b/libs/kstd/tests/os_mock.cpp @@ -0,0 +1,15 @@ +#include <exception> +#include <format> +#include <source_location> +#include <stdexcept> +#include <string_view> + +namespace kstd::os +{ + auto panic(std::string_view message, std::source_location location) + { + auto full_message = + std::format("OS Panic Handler called '{}' at {}:{}", message, location.file_name(), location.line()); + throw std::runtime_error{full_message}; + } +} // namespace kstd::os
\ No newline at end of file diff --git a/libs/kstd/tests/vector.cpp b/libs/kstd/tests/vector.cpp new file mode 100644 index 0000000..3a45008 --- /dev/null +++ b/libs/kstd/tests/vector.cpp @@ -0,0 +1,11 @@ +#include <kstd/vector> + +#include <catch2/catch_test_macros.hpp> + +TEST_CASE("Creating an empty vector") +{ + kstd::vector<int> v; + REQUIRE(v.empty()); + REQUIRE(v.size() == 0); + REQUIRE(v.capacity() == 0); +} |
