aboutsummaryrefslogtreecommitdiff
path: root/libs/kstd/tests/src
diff options
context:
space:
mode:
Diffstat (limited to 'libs/kstd/tests/src')
-rw-r--r--libs/kstd/tests/src/format.cpp2
-rw-r--r--libs/kstd/tests/src/observer_ptr.cpp3
-rw-r--r--libs/kstd/tests/src/string.cpp8
-rw-r--r--libs/kstd/tests/src/vector.cpp18
4 files changed, 15 insertions, 16 deletions
diff --git a/libs/kstd/tests/src/format.cpp b/libs/kstd/tests/src/format.cpp
index 73c8102..624779a 100644
--- a/libs/kstd/tests/src/format.cpp
+++ b/libs/kstd/tests/src/format.cpp
@@ -1,6 +1,4 @@
-#include <kstd/flat_map>
#include <kstd/format>
-#include <kstd/tests/os_panic.hpp>
#include <catch2/catch_test_macros.hpp>
diff --git a/libs/kstd/tests/src/observer_ptr.cpp b/libs/kstd/tests/src/observer_ptr.cpp
index 006ebde..0c94892 100644
--- a/libs/kstd/tests/src/observer_ptr.cpp
+++ b/libs/kstd/tests/src/observer_ptr.cpp
@@ -3,6 +3,7 @@
#include <catch2/catch_test_macros.hpp>
+#include <array>
#include <compare>
#include <type_traits>
#include <utility>
@@ -313,7 +314,7 @@ SCENARIO("Observer pointer comparisons", "[observer_ptr]")
{
GIVEN("Observer pointers to elements of an array")
{
- int arr[] = {1, 2};
+ auto arr = std::array{1, 2};
auto ptr1 = kstd::observer_ptr{&arr[0]};
auto ptr2 = kstd::observer_ptr{&arr[1]};
diff --git a/libs/kstd/tests/src/string.cpp b/libs/kstd/tests/src/string.cpp
index 43e9a6b..53d7c9a 100644
--- a/libs/kstd/tests/src/string.cpp
+++ b/libs/kstd/tests/src/string.cpp
@@ -3,7 +3,7 @@
#include <catch2/catch_test_macros.hpp>
#include <algorithm>
-#include <ranges>
+#include <cstring>
#include <string_view>
SCENARIO("String initialization and construction", "[string]")
@@ -59,7 +59,7 @@ SCENARIO("String initialization and construction", "[string]")
THEN("the string is not empty and has the same size as the C-style string")
{
REQUIRE(!str.empty());
- REQUIRE(str.size() == strlen(c_str));
+ REQUIRE(str.size() == std::strlen(c_str));
}
THEN("the string contains the same characters as the C-style string")
@@ -266,8 +266,8 @@ SCENARIO("String conversion and comparison", "[string]")
{
GIVEN("An unsigned integer")
{
- auto value1 = 12345u;
- auto value2 = 0u;
+ constexpr auto value1 = 12345u;
+ constexpr auto value2 = 0u;
WHEN("converting the unsigned integer to a string")
{
diff --git a/libs/kstd/tests/src/vector.cpp b/libs/kstd/tests/src/vector.cpp
index 5faaaff..b826820 100644
--- a/libs/kstd/tests/src/vector.cpp
+++ b/libs/kstd/tests/src/vector.cpp
@@ -492,27 +492,27 @@ SCENARIO("Vector modifiers", "[vector]")
WHEN("inserting an element")
{
- auto it = v.insert(v.cbegin(), 42);
+ auto it = v.insert(v.cbegin(), 40);
THEN("the size and capacity increase and the element is inserted")
{
REQUIRE(v.size() == 1);
REQUIRE(v.capacity() >= 1);
- REQUIRE(v[0] == 42);
+ REQUIRE(v[0] == 40);
REQUIRE(it == v.begin());
}
}
WHEN("inserting an lvalue element")
{
- auto const value = 42;
+ auto const value = 40;
auto it = v.insert(v.cbegin(), value);
THEN("the size and capacity increase and the element is inserted")
{
REQUIRE(v.size() == 1);
REQUIRE(v.capacity() >= 1);
- REQUIRE(v[0] == 42);
+ REQUIRE(v[0] == 40);
REQUIRE(it == v.begin());
}
}
@@ -927,7 +927,7 @@ SCENARIO("Vector with non-default-constructible types", "[vector]")
WHEN("using emplace_back")
{
auto v = kstd::vector<kstd::tests::non_default_constructible>{};
- v.emplace_back(42);
+ v.emplace_back(40);
THEN("the element is added and the size and capacity increase")
{
@@ -965,7 +965,7 @@ SCENARIO("Vector modifier move semantics", "[vector]")
GIVEN("An empty vector and a move tracker element")
{
auto v = kstd::vector<kstd::tests::special_member_tracker>{};
- auto tracker = kstd::tests::special_member_tracker{42};
+ auto tracker = kstd::tests::special_member_tracker{40};
WHEN("push_back is called with the move tracker")
{
@@ -976,7 +976,7 @@ SCENARIO("Vector modifier move semantics", "[vector]")
REQUIRE(v.size() == 1);
REQUIRE(v.back().move_constructed_count == 1);
REQUIRE(v.back().copy_constructed_count == 0);
- REQUIRE(v.back().value == 42);
+ REQUIRE(v.back().value == 40);
}
THEN("the original tracker is left in a valid but unspecified state")
@@ -992,14 +992,14 @@ SCENARIO("Vector modifier move semantics", "[vector]")
WHEN("emplace_back is called with constructor arguments")
{
- v.emplace_back(42);
+ v.emplace_back(40);
THEN("the element is constructed directly, without moves or copies")
{
REQUIRE(v.size() == 1);
REQUIRE(v.back().move_constructed_count == 0);
REQUIRE(v.back().copy_constructed_count == 0);
- REQUIRE(v.back().value == 42);
+ REQUIRE(v.back().value == 40);
}
}
}