8#include "testing/testing.h"
14TEST(string_ref_null, DefaultConstructor)
21TEST(string_ref_null, CStringConstructor)
23 const char *
str =
"Hello";
29TEST(string_ref_null, CStringLengthConstructor)
31 const char *
str =
"Hello";
37TEST(string_ref_null, CompareEqual)
42 EXPECT_TRUE(ref1 == ref2);
43 EXPECT_FALSE(ref1 == ref3);
44 EXPECT_TRUE(ref1 != ref3);
45 EXPECT_FALSE(ref1 != ref2);
48TEST(string_ref_null, CompareEqualCharPtr1)
51 EXPECT_TRUE(ref ==
"test");
52 EXPECT_FALSE(ref ==
"other");
53 EXPECT_TRUE(ref !=
"other");
54 EXPECT_FALSE(ref !=
"test");
57TEST(string_ref_null, CompareEqualCharPtr2)
60 EXPECT_TRUE(
"test" == ref);
61 EXPECT_FALSE(
"other" == ref);
62 EXPECT_TRUE(ref !=
"other");
63 EXPECT_FALSE(ref !=
"test");
66TEST(string_ref_null, CompareEqualString1)
69 EXPECT_TRUE(ref == std::string(
"test"));
70 EXPECT_FALSE(ref == std::string(
"other"));
71 EXPECT_TRUE(ref != std::string(
"other"));
72 EXPECT_FALSE(ref != std::string(
"test"));
75TEST(string_ref_null, CompareEqualString2)
78 EXPECT_TRUE(std::string(
"test") == ref);
79 EXPECT_FALSE(std::string(
"other") == ref);
80 EXPECT_TRUE(std::string(
"other") != ref);
81 EXPECT_FALSE(std::string(
"test") != ref);
84TEST(string_ref_null, CompareEqualStringRef1)
93TEST(string_ref_null, CompareEqualStringRef2)
102TEST(string_ref, DefaultConstructor)
108TEST(string_ref, StartEndConstructor)
110 const char *text =
"hello world";
113 EXPECT_TRUE(ref ==
"hello");
114 EXPECT_FALSE(ref ==
"hello ");
117TEST(string_ref, StartEndConstructorNullptr)
121 EXPECT_TRUE(ref ==
"");
124TEST(string_ref, StartEndConstructorSame)
126 const char *text =
"hello world";
129 EXPECT_TRUE(ref ==
"");
132TEST(string_ref, CStringConstructor)
134 const char *
str =
"Test";
140TEST(string_ref, PointerWithLengthConstructor)
142 const char *
str =
"Test";
148TEST(string_ref, StdStringConstructor)
150 std::string
str =
"Test";
156TEST(string_ref, SubscriptOperator)
170 std::string
str = ref;
178 std::stringstream ss;
181 std::string
str = ss.str();
190 std::string result = a +
b;
197 std::string result = ref +
"qwe";
204 std::string result =
"qwe" + ref;
211 std::string result = ref + std::string(
"asd");
218 std::string result = std::string(
"asd") + ref;
227 EXPECT_TRUE(ref1 == ref2);
228 EXPECT_FALSE(ref1 == ref3);
229 EXPECT_TRUE(ref1 != ref3);
230 EXPECT_FALSE(ref1 != ref2);
233TEST(string_ref, CompareEqualCharPtr1)
236 EXPECT_TRUE(ref ==
"test");
237 EXPECT_FALSE(ref ==
"other");
238 EXPECT_TRUE(ref !=
"other");
239 EXPECT_FALSE(ref !=
"test");
242TEST(string_ref, CompareEqualCharPtr2)
245 EXPECT_TRUE(
"test" == ref);
246 EXPECT_FALSE(
"other" == ref);
247 EXPECT_TRUE(ref !=
"other");
248 EXPECT_FALSE(ref !=
"test");
251TEST(string_ref, CompareEqualString1)
254 EXPECT_TRUE(ref == std::string(
"test"));
255 EXPECT_FALSE(ref == std::string(
"other"));
256 EXPECT_TRUE(ref != std::string(
"other"));
257 EXPECT_FALSE(ref != std::string(
"test"));
260TEST(string_ref, CompareEqualString2)
263 EXPECT_TRUE(std::string(
"test") == ref);
264 EXPECT_FALSE(std::string(
"other") == ref);
265 EXPECT_TRUE(std::string(
"other") != ref);
266 EXPECT_FALSE(std::string(
"test") != ref);
303 EXPECT_FALSE(ref.
endswith(
" test"));
318TEST(string_ref, DropPrefixLargeN)
326TEST(string_ref, DropKnownPrefix)
342TEST(string_ref, DropSuffixLargeN)
365TEST(string_ref, TrimWhitespace)
403 memset(dst, 0xFF, 10);
410TEST(string_ref, FromStringView)
412 std::string_view view =
"hello";
420 std::string_view view = ref;
#define BLI_STATIC_ASSERT(a, msg)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
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 find_first_of(StringRef chars, int64_t pos=0) 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)
local_group_size(16, 16) .push_constant(Type b
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
TEST(any, DefaultConstructor)