diff --git a/test/test_span_dynamic_extent.cpp b/test/test_span_dynamic_extent.cpp index d9bce00b..3d7df1ec 100644 --- a/test/test_span_dynamic_extent.cpp +++ b/test/test_span_dynamic_extent.cpp @@ -1187,6 +1187,22 @@ namespace CHECK_EQUAL(const_bytes.size(), sizeof(data)); CHECK_EQUAL(writable_bytes.size(), sizeof(data)); + + etl::byte* pdata = reinterpret_cast(data); + + // Test the reading of bytes. + for (size_t i = 0; i < sizeof(data); ++i) + { + CHECK_EQUAL(int(pdata[i]), int(const_bytes[i])); + CHECK_EQUAL(int(pdata[i]), int(writable_bytes[i])); + } + + // Test writing of bytes. + for (size_t i = 0; i < writable_bytes.size(); ++i) + { + writable_bytes[i] = ~writable_bytes[i]; + CHECK_EQUAL(int(pdata[i]), int(writable_bytes[i])); + } } #include "etl/private/diagnostic_pop.h" diff --git a/test/test_span_fixed_extent.cpp b/test/test_span_fixed_extent.cpp index b59237c1..157170a0 100644 --- a/test/test_span_fixed_extent.cpp +++ b/test/test_span_fixed_extent.cpp @@ -1105,6 +1105,22 @@ namespace CHECK_EQUAL(const_bytes.size(), sizeof(data)); CHECK_EQUAL(writable_bytes.size(), sizeof(data)); + + etl::byte* pdata = reinterpret_cast(data); + + // Test the reading of bytes. + for (size_t i = 0; i < sizeof(data); ++i) + { + CHECK_EQUAL(int(pdata[i]), int(const_bytes[i])); + CHECK_EQUAL(int(pdata[i]), int(writable_bytes[i])); + } + + // Test writing of bytes. + for (size_t i = 0; i < writable_bytes.size(); ++i) + { + writable_bytes[i] = ~writable_bytes[i]; + CHECK_EQUAL(int(pdata[i]), int(writable_bytes[i])); + } } #include "etl/private/diagnostic_pop.h"