summaryrefslogtreecommitdiff
path: root/AK/Tests
diff options
context:
space:
mode:
authorasynts <asynts@gmail.com>2020-07-27 13:51:12 +0200
committerAndreas Kling <kling@serenityos.org>2020-07-27 19:58:09 +0200
commit2b57891e076b770361a1d6e1745e2fd7151c4ba4 (patch)
tree4ee80573d6a317694d4d154fd54a6e4f9873f823 /AK/Tests
parent7036a9b6f7d7df230b060252cc56f5f9a09eb43b (diff)
downloadserenity-2b57891e076b770361a1d6e1745e2fd7151c4ba4.zip
AK: Add constructors to Bytes and ReadonlyBytes that take void pointers.
Diffstat (limited to 'AK/Tests')
-rw-r--r--AK/Tests/Span.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/AK/Tests/Span.cpp b/AK/Tests/Span.cpp
index 301a1f9c28..1eb0dd68de 100644
--- a/AK/Tests/Span.cpp
+++ b/AK/Tests/Span.cpp
@@ -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)