1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 03:08:13 +00:00

AK: Add constructors to Bytes and ReadonlyBytes that take void pointers.

This commit is contained in:
asynts 2020-07-27 13:51:12 +02:00 committed by Andreas Kling
parent 7036a9b6f7
commit 2b57891e07
2 changed files with 143 additions and 74 deletions

View file

@ -131,4 +131,17 @@ TEST_CASE(can_subspan_as_intended)
EXPECT_EQ(subspan[1], 5);
}
TEST_CASE(span_from_void_pointer)
{
int value = 0;
[[maybe_unused]] Bytes bytes0 { reinterpret_cast<void*>(value), 4 };
[[maybe_unused]] ReadonlyBytes bytes1 { reinterpret_cast<const void*>(value), 4 };
}
TEST_CASE(span_from_c_string)
{
const char* str = "Serenity";
[[maybe_unused]] ReadonlyBytes bytes { str, strlen(str) };
}
TEST_MAIN(Span)