mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 13:17:34 +00:00
Meta: Build AK and LibRegex tests in Lagom and for Serenity
These tests were never built for the serenity target. Move their Lagom build steps to the Lagom CMakeLists.txt, and add serenity build steps for them. Also, fix the build errors when building them with the serenity cross-compiler :^)
This commit is contained in:
parent
860a3bbce3
commit
e787738c24
10 changed files with 268 additions and 259 deletions
|
@ -1,3 +1,5 @@
|
|||
include(${CMAKE_SOURCE_DIR}/Meta/CMake/utils.cmake)
|
||||
serenity_install_headers(AK)
|
||||
serenity_install_sources(AK)
|
||||
|
||||
add_subdirectory(Tests)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
|
||||
|
||||
set(AK_TEST_SOURCES
|
||||
TestAllOf.cpp
|
||||
TestAnyOf.cpp
|
||||
|
@ -51,17 +53,6 @@ set(AK_TEST_SOURCES
|
|||
foreach(source ${AK_TEST_SOURCES})
|
||||
get_filename_component(name ${source} NAME_WE)
|
||||
add_executable(${name} ${source})
|
||||
target_link_libraries(${name} LagomCore)
|
||||
add_test(
|
||||
NAME ${name}
|
||||
COMMAND ${name}
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
set_tests_properties(
|
||||
${name}
|
||||
PROPERTIES
|
||||
FAIL_REGULAR_EXPRESSION
|
||||
"FAIL"
|
||||
)
|
||||
target_link_libraries(${name} LibCore)
|
||||
install(TARGETS ${name} RUNTIME DESTINATION usr/Tests/AK)
|
||||
endforeach()
|
||||
|
|
|
@ -41,7 +41,7 @@ TEST_CASE(works_like_a_queue)
|
|||
}
|
||||
|
||||
for (size_t idx = 0; idx < capacity; ++idx) {
|
||||
u8 byte;
|
||||
u8 byte = 0;
|
||||
stream >> byte;
|
||||
|
||||
EXPECT_EQ(queue.dequeue(), byte);
|
||||
|
@ -70,7 +70,7 @@ TEST_CASE(overwritting_is_well_defined)
|
|||
stream << static_cast<u8>(idx % 256);
|
||||
|
||||
for (size_t idx = 0; idx < capacity; ++idx) {
|
||||
u8 byte;
|
||||
u8 byte = 0;
|
||||
stream >> byte;
|
||||
|
||||
if (idx < half_capacity)
|
||||
|
|
|
@ -101,7 +101,7 @@ TEST_CASE(seeking_slicing_offset)
|
|||
const Array<u8, 4> expected1 { 4, 5, 6, 7 };
|
||||
const Array<u8, 4> expected2 { 1, 2, 3, 4 };
|
||||
|
||||
Array<u8, 4> actual0, actual1, actual2;
|
||||
Array<u8, 4> actual0 {}, actual1 {}, actual2 {};
|
||||
|
||||
InputMemoryStream stream { input };
|
||||
|
||||
|
|
|
@ -129,35 +129,22 @@ TEST_CASE(extremes_4byte)
|
|||
EXPECT_EQ(human_readable_size(0xffffffff), "3.9 GiB");
|
||||
}
|
||||
|
||||
template<int>
|
||||
void actual_extremes_8byte();
|
||||
|
||||
template<>
|
||||
void actual_extremes_8byte<4>()
|
||||
{
|
||||
warnln("(Skipping 8-byte-size_t test)");
|
||||
}
|
||||
|
||||
template<>
|
||||
void actual_extremes_8byte<8>()
|
||||
{
|
||||
warnln("(Running true 8-byte-size_t test)");
|
||||
// Your editor might show "implicit conversion" warnings here.
|
||||
// This is because your editor thinks the world is 32-bit, but it isn't.
|
||||
EXPECT_EQ(human_readable_size(0x100000000ULL), "4.0 GiB");
|
||||
EXPECT_EQ(human_readable_size(0x100000001ULL), "4.0 GiB");
|
||||
EXPECT_EQ(human_readable_size(0x800000000ULL), "32.0 GiB");
|
||||
EXPECT_EQ(human_readable_size(0x10000000000ULL), "1024.0 GiB");
|
||||
|
||||
// Oh yeah! These are *correct*!
|
||||
EXPECT_EQ(human_readable_size(0x7fffffffffffffffULL), "8589934591.9 GiB");
|
||||
EXPECT_EQ(human_readable_size(0x8000000000000000ULL), "8589934592.0 GiB");
|
||||
EXPECT_EQ(human_readable_size(0xffffffffffffffffULL), "17179869183.9 GiB");
|
||||
}
|
||||
|
||||
TEST_CASE(extremes_8byte)
|
||||
{
|
||||
actual_extremes_8byte<sizeof(size_t)>();
|
||||
if constexpr (sizeof(size_t) == 8) {
|
||||
warnln("(Running 8-byte-size_t test)");
|
||||
EXPECT_EQ(human_readable_size(0x100000000ULL), "4.0 GiB");
|
||||
EXPECT_EQ(human_readable_size(0x100000001ULL), "4.0 GiB");
|
||||
EXPECT_EQ(human_readable_size(0x800000000ULL), "32.0 GiB");
|
||||
EXPECT_EQ(human_readable_size(0x10000000000ULL), "1024.0 GiB");
|
||||
|
||||
// Oh yeah! These are *correct*!
|
||||
EXPECT_EQ(human_readable_size(0x7fffffffffffffffULL), "8589934591.9 GiB");
|
||||
EXPECT_EQ(human_readable_size(0x8000000000000000ULL), "8589934592.0 GiB");
|
||||
EXPECT_EQ(human_readable_size(0xffffffffffffffffULL), "17179869183.9 GiB");
|
||||
} else {
|
||||
warnln("(Skipping 8-byte-size_t test on 32-bit platform)");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_MAIN(NumberFormat)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue