mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Use std::string_view and fmtlib across all libraries (#3402)
- Twine, StringRef, Format, and NativeFormatting have been removed - Logging now uses fmtlib style formatting - Nearly all uses of wpi::outs/errs have been replaced with fmt::print() or std::puts()/std::fputs() (for unformatted strings). - A wpi/fmt/raw_ostream.h header has been added to enable fmt::print() with wpi::raw_ostream
This commit is contained in:
@@ -23,11 +23,11 @@ std::ostream& operator<<(std::ostream& os, const Base64TestParam& param) {
|
||||
|
||||
class Base64Test : public ::testing::TestWithParam<Base64TestParam> {
|
||||
protected:
|
||||
StringRef GetPlain() {
|
||||
std::string_view GetPlain() {
|
||||
if (GetParam().plain_len < 0) {
|
||||
return StringRef(GetParam().plain);
|
||||
return GetParam().plain;
|
||||
} else {
|
||||
return StringRef(GetParam().plain, GetParam().plain_len);
|
||||
return std::string_view(GetParam().plain, GetParam().plain_len);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -51,7 +51,7 @@ TEST_P(Base64Test, EncodeSmallString) {
|
||||
|
||||
TEST_P(Base64Test, DecodeStdString) {
|
||||
std::string s;
|
||||
StringRef encoded = GetParam().encoded;
|
||||
std::string_view encoded = GetParam().encoded;
|
||||
EXPECT_EQ(encoded.size(), Base64Decode(encoded, &s));
|
||||
ASSERT_EQ(GetPlain(), s);
|
||||
|
||||
@@ -62,9 +62,9 @@ TEST_P(Base64Test, DecodeStdString) {
|
||||
|
||||
TEST_P(Base64Test, DecodeSmallString) {
|
||||
SmallString<128> buf;
|
||||
StringRef encoded = GetParam().encoded;
|
||||
std::string_view encoded = GetParam().encoded;
|
||||
size_t len;
|
||||
StringRef plain = Base64Decode(encoded, &len, buf);
|
||||
std::string_view plain = Base64Decode(encoded, &len, buf);
|
||||
EXPECT_EQ(encoded.size(), len);
|
||||
ASSERT_EQ(GetPlain(), plain);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user