15#include "testing/testing.h"
35 const std::string str_const =
"the/path";
38 std::string str_variable =
"the/path";
41 std::string long_string =
"this is a long/string/with/a/path in the middle";
45 EXPECT_EQ(from_string_ref,
"long/string/with/a/path");
81 EXPECT_EQ(empty, empty) <<
"Identical empty instances should compare equal.";
82 EXPECT_EQ(empty,
"") <<
"Comparison to empty string should be possible.";
83 EXPECT_EQ(the_path, the_path) <<
"Identical non-empty instances should compare equal.";
84 EXPECT_EQ(the_path,
"the/path") <<
"Comparison to string should be possible.";
85 EXPECT_EQ(the_path, other_instance_same_path)
86 <<
"Different instances with equal path should compare equal.";
112 <<
"Appending a child path should not modify the parent.";
113 EXPECT_EQ(child,
"some/родитель/ребенок");
116 EXPECT_EQ(appended_compound_path,
"some/родитель/ребенок/внук");
121 <<
"Appending to an empty path should not create an initial slash.";
124 EXPECT_EQ(parent_of_the_void,
"some/родитель")
125 <<
"Prepending to an empty path should not create a trailing slash.";
127 std::string subpath =
"child";
129 EXPECT_EQ(concatenated_with_string,
"some/родитель/child");
136 std::set<AssetCatalogPath> path_std_set;
137 path_std_set.insert(path);
140 path_blender_set.
add(path);
146 std::stringstream sstream;
148 EXPECT_EQ(
"путь/в/Пермь", sstream.str());
160 <<
"Non-normalized paths are not expected to work.";
178 AssetCatalogPath child_with_dotdot = some_parent /
"../../other/hierarchy/part";
180 <<
"dotdot path components should have no meaning";
189 <<
"cleanup should not modify the path instance itself";
220 std::pair<std::string, bool> parameter_pair = std::make_pair<std::string, bool>(
221 component_name,
bool(is_last_component));
222 seen_components.
append(parameter_pair);
225 ASSERT_EQ(3, seen_components.
size());
227 EXPECT_EQ(
"путь", seen_components[0].first);
228 EXPECT_EQ(
"в", seen_components[1].first);
229 EXPECT_EQ(
"Пермь", seen_components[2].first);
239 EXPECT_EQ(path.
rebase(
"some/path",
"new/base"),
"new/base/to/some/catalog");
240 EXPECT_EQ(path.
rebase(
"",
"new/base"),
"new/base/some/path/to/some/catalog");
242 EXPECT_EQ(path.
rebase(
"some/path/to/some/catalog",
"some/path/to/some/catalog"),
243 "some/path/to/some/catalog")
244 <<
"Rebasing to itself should not change the path.";
247 <<
"Non-matching base path should return empty string to indicate 'NO'.";
constexpr StringRefNull()
void append(const T &value)
AssetCatalogPath parent() const
const std::string & str() const
AssetCatalogPath cleanup() const
AssetCatalogPath rebase(const AssetCatalogPath &from_path, const AssetCatalogPath &to_path) const
AssetCatalogPath()=default
bool is_contained_in(const AssetCatalogPath &other_path) const
void iterate_components(ComponentIteratorFn callback) const
constexpr StringRef substr(int64_t start, int64_t size) const
float length(VecOp< float, D >) RET
#define EXPECT_FALSE(result)
#define EXPECT_LT(result, expect)
#define EXPECT_NE(result, expect)
#define EXPECT_TRUE(result)
TEST_F(AssetCatalogPathTest, construction)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)