6 #include "testing/testing.h"
10 TEST(string_ref_null, DefaultConstructor)
17 TEST(string_ref_null, CStringConstructor)
19 const char *
str =
"Hello";
25 TEST(string_ref_null, CStringLengthConstructor)
27 const char *
str =
"Hello";
33 TEST(string_ref, DefaultConstructor)
39 TEST(string_ref, StartEndConstructor)
41 const char *text =
"hello world";
44 EXPECT_TRUE(ref ==
"hello");
45 EXPECT_FALSE(ref ==
"hello ");
48 TEST(string_ref, StartEndConstructorNullptr)
52 EXPECT_TRUE(ref ==
"");
55 TEST(string_ref, StartEndConstructorSame)
57 const char *text =
"hello world";
60 EXPECT_TRUE(ref ==
"");
63 TEST(string_ref, CStringConstructor)
65 const char *
str =
"Test";
71 TEST(string_ref, PointerWithLengthConstructor)
73 const char *
str =
"Test";
79 TEST(string_ref, StdStringConstructor)
81 std::string
str =
"Test";
87 TEST(string_ref, SubscriptOperator)
98 TEST(string_ref, ToStdString)
101 std::string
str = ref;
109 std::stringstream ss;
112 std::string
str = ss.str();
128 std::string
result = ref +
"qwe";
135 std::string
result =
"qwe" + ref;
142 std::string
result = ref + std::string(
"asd");
149 std::string
result = std::string(
"asd") + ref;
158 EXPECT_TRUE(ref1 == ref2);
159 EXPECT_FALSE(ref1 == ref3);
160 EXPECT_TRUE(ref1 != ref3);
161 EXPECT_FALSE(ref1 != ref2);
164 TEST(string_ref, CompareEqualCharPtr1)
167 EXPECT_TRUE(ref ==
"test");
168 EXPECT_FALSE(ref ==
"other");
169 EXPECT_TRUE(ref !=
"other");
170 EXPECT_FALSE(ref !=
"test");
173 TEST(string_ref, CompareEqualCharPtr2)
176 EXPECT_TRUE(
"test" == ref);
177 EXPECT_FALSE(
"other" == ref);
178 EXPECT_TRUE(ref !=
"other");
179 EXPECT_FALSE(ref !=
"test");
182 TEST(string_ref, CompareEqualString1)
185 EXPECT_TRUE(ref == std::string(
"test"));
186 EXPECT_FALSE(ref == std::string(
"other"));
187 EXPECT_TRUE(ref != std::string(
"other"));
188 EXPECT_FALSE(ref != std::string(
"test"));
191 TEST(string_ref, CompareEqualString2)
194 EXPECT_TRUE(std::string(
"test") == ref);
195 EXPECT_FALSE(std::string(
"other") == ref);
196 EXPECT_TRUE(std::string(
"other") != ref);
197 EXPECT_FALSE(std::string(
"test") != ref);
234 EXPECT_FALSE(ref.
endswith(
" test"));
249 TEST(string_ref, DropPrefixLargeN)
257 TEST(string_ref, DropKnownPrefix)
273 TEST(string_ref, DropSuffixLargeN)
281 TEST(string_ref, TrimArbitrary)
296 TEST(string_ref, TrimWhitespace)
308 TEST(string_ref, TrimCharacter)
334 memset(dst, 0xFF, 10);
341 TEST(string_ref, FromStringView)
343 std::string_view
view =
"hello";
351 std::string_view
view = ref;
360 std::array<int, static_cast<std::size_t>(sref.find_first_of(
'o'))> compiles = {1};
#define BLI_STATIC_ASSERT(a, msg)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
static btMatrix3x3 Add(const btMatrix3x3 &a, const btMatrix3x3 &b)
void copy(char *dst, int64_t dst_size) const
constexpr StringRef substr(int64_t start, int64_t size) const
constexpr bool startswith(StringRef prefix) const
constexpr bool endswith(StringRef suffix) const
constexpr int64_t size() const
constexpr StringRef trim() const
constexpr const char * data() const
constexpr StringRef drop_prefix(int64_t n) const
constexpr StringRef drop_suffix(int64_t n) const
constexpr StringRef drop_known_prefix(StringRef prefix) const
void append(const T &value)
TEST(any, DefaultConstructor)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)