Files
YYCCommonplace/test/yycc/patch/stream.cpp
T

32 lines
811 B
C++
Raw Normal View History

#include <gtest/gtest.h>
#include <yycc.hpp>
2025-09-25 15:29:55 +08:00
#include <yycc/patch/stream.hpp>
#include <yycc/string/reinterpret.hpp>
#include <sstream>
#define REINTERPRET ::yycc::string::reinterpret
using namespace std::literals::string_view_literals;
2025-09-25 15:29:55 +08:00
using namespace ::yycc::patch::stream;
2025-09-25 15:29:55 +08:00
namespace yycctest::patch::stream {
2025-09-25 15:29:55 +08:00
TEST(PatchStream, StringView) {
std::stringstream ss;
ss << u8"hello"sv;
EXPECT_EQ(REINTERPRET::as_utf8_view(ss.view()), u8"hello"sv);
}
2025-09-25 15:29:55 +08:00
TEST(PatchStream, CStrPtr) {
std::stringstream ss;
ss << u8"hello";
EXPECT_EQ(REINTERPRET::as_utf8_view(ss.view()), u8"hello");
}
2025-09-25 15:29:55 +08:00
TEST(PatchStream, Character) {
std::stringstream ss;
ss << u8'y';
EXPECT_EQ(REINTERPRET::as_utf8_view(ss.view()), u8"y");
}
}