aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/CMakeLists.txt2
-rw-r--r--kernel/kernel/test_support/string_makers.hpp24
-rw-r--r--kernel/kernel/test_support/string_makers.tests.cpp6
3 files changed, 15 insertions, 17 deletions
diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt
index eb14f619..2ed3ac62 100644
--- a/kernel/CMakeLists.txt
+++ b/kernel/CMakeLists.txt
@@ -185,7 +185,7 @@ if(BUILD_TESTING)
)
target_compile_options("${TEST_TARGET}" PRIVATE
- "SHELL:-include ${CMAKE_CURRENT_SOURCE_DIR}/kernel/test_support/string_makers.hpp"
+ "$<$<CXX_COMPILER_ID:Clang,GNU>:SHELL:-include ${CMAKE_CURRENT_SOURCE_DIR}/kernel/test_support/string_makers.hpp>"
)
target_compile_definitions("${TEST_TARGET}" PRIVATE
diff --git a/kernel/kernel/test_support/string_makers.hpp b/kernel/kernel/test_support/string_makers.hpp
index 98eed3e8..c158ac3a 100644
--- a/kernel/kernel/test_support/string_makers.hpp
+++ b/kernel/kernel/test_support/string_makers.hpp
@@ -6,12 +6,12 @@
//! This header is force-included into every kernel test translation unit by the build system and must therefore never
//! be included by kernel code. See kstd/test_support/string_makers.hpp for the conversions of kstd types.
-#include <kstd/test_support/string_makers.hpp> // IWYU pragma: export
-
#include <kapi/devices.hpp>
#include <kapi/filesystem.hpp>
#include <kapi/memory.hpp>
+#include <kstd/test_support/string_makers.hpp> // IWYU pragma: export
+
#include <catch2/catch_tostring.hpp>
#include <string>
@@ -22,7 +22,7 @@ namespace Catch
template<>
struct StringMaker<kapi::filesystem::device_number>
{
- static auto convert(kapi::filesystem::device_number number) -> std::string
+ auto static convert(kapi::filesystem::device_number number) -> std::string
{
return std::to_string(number.major) + ':' + std::to_string(number.minor);
}
@@ -31,7 +31,7 @@ namespace Catch
template<>
struct StringMaker<kapi::filesystem::directory_cursor>
{
- static auto convert(kapi::filesystem::directory_cursor cursor) -> std::string
+ auto static convert(kapi::filesystem::directory_cursor cursor) -> std::string
{
return "directory_cursor{" + std::to_string(cursor.value) + '}';
}
@@ -40,7 +40,7 @@ namespace Catch
template<>
struct StringMaker<kapi::filesystem::file_status>
{
- static auto convert(kapi::filesystem::file_status const & status) -> std::string
+ auto static convert(kapi::filesystem::file_status const & status) -> std::string
{
return "file_status{mode: " + Catch::Detail::stringify(status.mode) +
", size: " + Catch::Detail::stringify(status.size) +
@@ -53,7 +53,7 @@ namespace Catch
template<>
struct StringMaker<kapi::memory::frame>
{
- static auto convert(kapi::memory::frame frame) -> std::string
+ auto static convert(kapi::memory::frame frame) -> std::string
{
return "frame{" + std::to_string(frame.number()) + '}';
}
@@ -62,7 +62,7 @@ namespace Catch
template<>
struct StringMaker<kapi::memory::page>
{
- static auto convert(kapi::memory::page page) -> std::string
+ auto static convert(kapi::memory::page page) -> std::string
{
return "page{" + std::to_string(page.number()) + '}';
}
@@ -71,7 +71,7 @@ namespace Catch
template<>
struct StringMaker<kapi::devices::mmio_range>
{
- static auto convert(kapi::devices::mmio_range const & range) -> std::string
+ auto static convert(kapi::devices::mmio_range const & range) -> std::string
{
return "mmio{" + Catch::Detail::stringify(range.start) + ", " + Catch::Detail::stringify(range.size) + '}';
}
@@ -80,7 +80,7 @@ namespace Catch
template<>
struct StringMaker<kapi::devices::io_port>
{
- static auto convert(kapi::devices::io_port const & port) -> std::string
+ auto static convert(kapi::devices::io_port const & port) -> std::string
{
return "port{" + std::to_string(port.start) + ", " + std::to_string(port.count) + '}';
}
@@ -89,7 +89,7 @@ namespace Catch
template<>
struct StringMaker<kapi::devices::interrupt_line>
{
- static auto convert(kapi::devices::interrupt_line const & line) -> std::string
+ auto static convert(kapi::devices::interrupt_line const & line) -> std::string
{
return "irq{" + std::to_string(line.number) + '}';
}
@@ -98,7 +98,7 @@ namespace Catch
template<>
struct StringMaker<kapi::devices::dma_channel>
{
- static auto convert(kapi::devices::dma_channel const & channel) -> std::string
+ auto static convert(kapi::devices::dma_channel const & channel) -> std::string
{
return "dma{" + std::to_string(channel.number) + '}';
}
@@ -107,7 +107,7 @@ namespace Catch
template<>
struct StringMaker<kapi::devices::resource>
{
- static auto convert(kapi::devices::resource const & resource) -> std::string
+ auto static convert(kapi::devices::resource const & resource) -> std::string
{
using kapi::devices::resource_type;
diff --git a/kernel/kernel/test_support/string_makers.tests.cpp b/kernel/kernel/test_support/string_makers.tests.cpp
index 1bcb332f..3c3cd791 100644
--- a/kernel/kernel/test_support/string_makers.tests.cpp
+++ b/kernel/kernel/test_support/string_makers.tests.cpp
@@ -1,5 +1,3 @@
-#include <kernel/test_support/string_makers.hpp>
-
#include <kapi/devices.hpp>
#include <kapi/filesystem.hpp>
#include <kapi/memory.hpp>
@@ -17,8 +15,8 @@ SCENARIO("Catch2 string conversion of kapi types", "[test_support][string_makers
{
auto const number = kapi::filesystem::device_number{.major = 1, .minor = 2};
auto const cursor = kapi::filesystem::directory_cursor{3};
- auto const status = kapi::filesystem::file_status{
- .mode = 4, .size = 5_B, .raw_device = number, .inode_number = 6, .link_count = 7};
+ auto const status =
+ kapi::filesystem::file_status{.mode = 4, .size = 5_B, .raw_device = number, .inode_number = 6, .link_count = 7};
THEN("they are printed with their fields")
{