diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-04-21 14:44:01 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-04-21 14:44:01 +0200 |
| commit | e8ce02d63f096147fc54824f0a45c23e3a3ced25 (patch) | |
| tree | e96658cb58f91c48d345348bb4e08491dac8581b /libs/kstd | |
| parent | e3fa6b1adbd7fce3b080d75fd0959949b7d3bef4 (diff) | |
| download | teachos-e8ce02d63f096147fc54824f0a45c23e3a3ced25.tar.xz teachos-e8ce02d63f096147fc54824f0a45c23e3a3ced25.zip | |
libs: prepare for clang-tidy
Diffstat (limited to 'libs/kstd')
| -rw-r--r-- | libs/kstd/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | libs/kstd/include/kstd/bits/format/vformat.hpp | 2 | ||||
| -rw-r--r-- | libs/kstd/tests/src/format.cpp | 2 | ||||
| -rw-r--r-- | libs/kstd/tests/src/observer_ptr.cpp | 3 | ||||
| -rw-r--r-- | libs/kstd/tests/src/string.cpp | 8 | ||||
| -rw-r--r-- | libs/kstd/tests/src/vector.cpp | 18 |
6 files changed, 16 insertions, 19 deletions
diff --git a/libs/kstd/CMakeLists.txt b/libs/kstd/CMakeLists.txt index ee84ff1..2b5ee12 100644 --- a/libs/kstd/CMakeLists.txt +++ b/libs/kstd/CMakeLists.txt @@ -108,8 +108,6 @@ if(BUILD_TESTING) ) set_target_properties("kstd_tests" PROPERTIES - C_CLANG_TIDY "" - CXX_CLANG_TIDY "" EXCLUDE_FROM_ALL NO ) diff --git a/libs/kstd/include/kstd/bits/format/vformat.hpp b/libs/kstd/include/kstd/bits/format/vformat.hpp index 4fec7dd..994fae5 100644 --- a/libs/kstd/include/kstd/bits/format/vformat.hpp +++ b/libs/kstd/include/kstd/bits/format/vformat.hpp @@ -45,7 +45,7 @@ namespace kstd : m_output{iterator} {} - auto iterator() const -> Output + [[nodiscard]] auto iterator() const -> Output { return m_output; } 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); } } } |
