| 6 | |
| 7 | Y_UNIT_TEST_SUITE(TStrBufTest) { |
| 8 | Y_UNIT_TEST(TestConstructorsAndOperators) { |
| 9 | TStringBuf str("qwerty"); |
| 10 | |
| 11 | UNIT_ASSERT_EQUAL(*str.data(), 'q'); |
| 12 | UNIT_ASSERT_EQUAL(str.size(), 6); |
| 13 | |
| 14 | TStringBuf str1("qwe\0rty"sv); |
| 15 | TStringBuf str2(str1.data()); |
| 16 | UNIT_ASSERT_VALUES_UNEQUAL(str1, str2); |
| 17 | UNIT_ASSERT_VALUES_EQUAL(str1.size(), 7); |
| 18 | UNIT_ASSERT_VALUES_EQUAL(str2.size(), 3); |
| 19 | |
| 20 | std::string_view helloWorld("Hello, World!"); |
| 21 | TStringBuf fromStringView(helloWorld); |
| 22 | UNIT_ASSERT_EQUAL(fromStringView.data(), helloWorld.data()); |
| 23 | UNIT_ASSERT_EQUAL(fromStringView.size(), helloWorld.size()); |
| 24 | |
| 25 | std::string_view fromStringBuf = fromStringView; |
| 26 | UNIT_ASSERT_EQUAL(helloWorld.data(), fromStringBuf.data()); |
| 27 | UNIT_ASSERT_EQUAL(helloWorld.size(), fromStringBuf.size()); |
| 28 | } |
| 29 | |
| 30 | Y_UNIT_TEST(TestConstExpr) { |
| 31 | static constexpr TStringBuf str1("qwe\0rty", 7); |
nothing calls this directly
no test coverage detected