aboutsummaryrefslogtreecommitdiff
path: root/pw_tokenizer/base64_test.cc
diff options
context:
space:
mode:
authorWyatt Hepler <hepler@google.com>2020-06-22 11:21:45 -0700
committerCQ Bot Account <commit-bot@chromium.org>2020-07-01 01:37:27 +0000
commite2cbadfa0cd342abb37ce5a70d4e019fb2b2e790 (patch)
tree5634bcc53aea3055154397f65b6da2917737dd44 /pw_tokenizer/base64_test.cc
parentd3d1cb075535dc3bece256f8cbbf960d3f2bf72e (diff)
downloadpigweed-e2cbadfa0cd342abb37ce5a70d4e019fb2b2e790.tar.gz
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>
Diffstat (limited to 'pw_tokenizer/base64_test.cc')
-rw-r--r--pw_tokenizer/base64_test.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/pw_tokenizer/base64_test.cc b/pw_tokenizer/base64_test.cc
index 8a6f8b6fe..59f3a05dd 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 @@ class PrefixedBase64 : public ::testing::Test {
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_EmptyInput_WritesPrefix) {
}
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_OnlyPrefix_WritesNothing) {
}
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 @@ TEST(PrefixedBase64, DecodeInPlace) {
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()));
}
}