pw_span: Switch from pw::span to std::span
Replace pw::span with std::span and "pw_span/span.h" with <span>
throughout the codebase.
Change-Id: Ib1fa873168b6093794e861611d750fcad6285d6c
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/12801
Commit-Queue: Wyatt Hepler <hepler@google.com>
Reviewed-by: Rob Mohr <mohrr@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
diff --git a/pw_tokenizer/base64_test.cc b/pw_tokenizer/base64_test.cc
index 8a6f8b6..59f3a05 100644
--- a/pw_tokenizer/base64_test.cc
+++ b/pw_tokenizer/base64_test.cc
@@ -15,10 +15,10 @@
#include "pw_tokenizer/base64.h"
#include <cstring>
+#include <span>
#include <string_view>
#include "gtest/gtest.h"
-#include "pw_span/span.h"
namespace pw::tokenizer {
namespace {
@@ -34,9 +34,10 @@
const struct TestData {
template <size_t kSize>
TestData(const char (&binary_data)[kSize], const char* base64_data)
- : binary{as_bytes(span(binary_data, kSize - 1))}, base64(base64_data) {}
+ : binary{std::as_bytes(std::span(binary_data, kSize - 1))},
+ base64(base64_data) {}
- span<const std::byte> binary;
+ std::span<const std::byte> binary;
std::string_view base64;
} kTestData[] = {
{"", "$"},
@@ -68,7 +69,8 @@
}
TEST_F(PrefixedBase64, Encode_EmptyOutput_WritesNothing) {
- EXPECT_EQ(0u, PrefixedBase64Encode(kTestData[5].binary, span(base64_, 0)));
+ EXPECT_EQ(0u,
+ PrefixedBase64Encode(kTestData[5].binary, std::span(base64_, 0)));
EXPECT_EQ('\0', base64_[0]);
}
@@ -90,15 +92,16 @@
}
TEST_F(PrefixedBase64, Decode_EmptyOutput_WritesNothing) {
- EXPECT_EQ(0u, PrefixedBase64Decode(kTestData[5].base64, span(binary_, 0)));
+ EXPECT_EQ(0u,
+ PrefixedBase64Decode(kTestData[5].base64, std::span(binary_, 0)));
EXPECT_EQ(std::byte{0}, binary_[0]);
}
TEST_F(PrefixedBase64, Decode_OutputTooSmall_WritesNothing) {
auto& item = kTestData[5];
- EXPECT_EQ(
- 0u,
- PrefixedBase64Decode(item.base64, span(binary_, item.binary.size() - 1)));
+ EXPECT_EQ(0u,
+ PrefixedBase64Decode(item.base64,
+ std::span(binary_, item.binary.size() - 1)));
EXPECT_EQ(std::byte{0}, binary_[0]);
}
@@ -109,7 +112,7 @@
std::memcpy(buffer, base64.data(), base64.size());
EXPECT_EQ(binary.size(),
- PrefixedBase64DecodeInPlace(span(buffer, base64.size())));
+ PrefixedBase64DecodeInPlace(std::span(buffer, base64.size())));
ASSERT_EQ(0, std::memcmp(binary.data(), buffer, binary.size()));
}
}