summaryrefslogtreecommitdiff
path: root/asl
diff options
context:
space:
mode:
authorSteven Le Rouzic <steven.lerouzic@gmail.com>2024-11-13 00:04:12 +0100
committerSteven Le Rouzic <steven.lerouzic@gmail.com>2024-12-20 15:35:58 +0100
commitae9d36675a21b5a81bc87279dc9ee1224cdcb963 (patch)
tree6490e5e3dfa07aa2f799fb82405fd0633adab0d1 /asl
parent35a996490200126e72775398fa3d6daa0ec4f435 (diff)
Also test as_mutable_bytes
Diffstat (limited to 'asl')
-rw-r--r--asl/tests/span_tests.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/asl/tests/span_tests.cpp b/asl/tests/span_tests.cpp
index 547ba16..18945b2 100644
--- a/asl/tests/span_tests.cpp
+++ b/asl/tests/span_tests.cpp
@@ -451,3 +451,20 @@ ASL_TEST(as_bytes)
ASL_TEST_ASSERT(static_cast<int>(s2[6]) == 0x06);
ASL_TEST_ASSERT(static_cast<int>(s2[7]) == 0x05);
}
+
+ASL_TEST(as_mutable_bytes)
+{
+ uint32_t data[] = {0x01020304, 0x05060708};
+ asl::span s1(data);
+ asl::span s2 = asl::as_mutable_bytes(s1);
+
+ ASL_TEST_ASSERT(s2.size() == 8);
+ ASL_TEST_ASSERT(static_cast<int>(s2[0]) == 0x04);
+ ASL_TEST_ASSERT(static_cast<int>(s2[1]) == 0x03);
+ ASL_TEST_ASSERT(static_cast<int>(s2[2]) == 0x02);
+ ASL_TEST_ASSERT(static_cast<int>(s2[3]) == 0x01);
+ ASL_TEST_ASSERT(static_cast<int>(s2[4]) == 0x08);
+ ASL_TEST_ASSERT(static_cast<int>(s2[5]) == 0x07);
+ ASL_TEST_ASSERT(static_cast<int>(s2[6]) == 0x06);
+ ASL_TEST_ASSERT(static_cast<int>(s2[7]) == 0x05);
+}