51 const std::string file_name_src =
"test_file_src.txt";
52 const std::string file_name_dst =
"test_file_dst.txt";
54 const std::string test_filepath_src = temp_dir +
SEP_STR + file_name_src;
55 const std::string test_filepath_dst = temp_dir +
SEP_STR + file_name_dst;
57 ASSERT_FALSE(
BLI_exists(test_filepath_src.c_str()));
58 ASSERT_FALSE(
BLI_exists(test_filepath_dst.c_str()));
60 ASSERT_TRUE(
BLI_exists(test_filepath_src.c_str()));
63 ASSERT_EQ(0,
BLI_rename(test_filepath_src.c_str(), test_filepath_dst.c_str()));
64 ASSERT_FALSE(
BLI_exists(test_filepath_src.c_str()));
65 ASSERT_TRUE(
BLI_exists(test_filepath_dst.c_str()));
68 ASSERT_TRUE(
BLI_exists(test_filepath_src.c_str()));
71 ASSERT_NE(0,
BLI_rename(test_filepath_src.c_str(), test_filepath_dst.c_str()));
72 ASSERT_TRUE(
BLI_exists(test_filepath_src.c_str()));
73 ASSERT_TRUE(
BLI_exists(test_filepath_dst.c_str()));
76 ASSERT_TRUE(
BLI_exists(test_filepath_src.c_str()));
80 ASSERT_FALSE(
BLI_exists(test_filepath_src.c_str()));
81 ASSERT_TRUE(
BLI_exists(test_filepath_dst.c_str()));
84 ASSERT_TRUE(
BLI_exists(test_filepath_src.c_str()));
93 ASSERT_TRUE(
BLI_exists(test_filepath_src.c_str()));
96 ASSERT_FALSE(
BLI_exists(test_filepath_src.c_str()));
98 ASSERT_TRUE(
BLI_exists(test_filepath_dst.c_str()));
106 const std::string dir_name_src =
"test_dir_src";
107 const std::string dir_name_dst =
"test_dir_dst";
109 const std::string test_dirpath_src = temp_dir +
SEP_STR + dir_name_src;
110 const std::string test_dirpath_dst = temp_dir +
SEP_STR + dir_name_dst;
113 ASSERT_TRUE(
BLI_exists(test_dirpath_src.c_str()));
116 ASSERT_EQ(0,
BLI_rename(test_dirpath_src.c_str(), test_dirpath_dst.c_str()));
117 ASSERT_FALSE(
BLI_exists(test_dirpath_src.c_str()));
118 ASSERT_TRUE(
BLI_exists(test_dirpath_dst.c_str()));
121 ASSERT_TRUE(
BLI_exists(test_dirpath_src.c_str()));
124 ASSERT_NE(0,
BLI_rename(test_dirpath_src.c_str(), test_dirpath_dst.c_str()));
125 ASSERT_TRUE(
BLI_exists(test_dirpath_src.c_str()));
126 ASSERT_TRUE(
BLI_exists(test_dirpath_dst.c_str()));
130 ASSERT_FALSE(
BLI_exists(test_dirpath_src.c_str()));
131 ASSERT_TRUE(
BLI_exists(test_dirpath_dst.c_str()));
134 ASSERT_TRUE(
BLI_exists(test_dirpath_src.c_str()));
136 const std::string test_dir_filepath_src = test_dirpath_src +
SEP_STR + file_name_src;
137 const std::string test_dir_filepath_dst = test_dirpath_dst +
SEP_STR + file_name_dst;
139 ASSERT_FALSE(
BLI_exists(test_dir_filepath_src.c_str()));
140 ASSERT_FALSE(
BLI_exists(test_dir_filepath_dst.c_str()));
142 ASSERT_TRUE(
BLI_exists(test_dir_filepath_src.c_str()));
145 ASSERT_EQ(0,
BLI_rename(test_dir_filepath_src.c_str(), test_dir_filepath_dst.c_str()));
146 ASSERT_FALSE(
BLI_exists(test_dir_filepath_src.c_str()));
147 ASSERT_TRUE(
BLI_exists(test_dir_filepath_dst.c_str()));
150 ASSERT_NE(0,
BLI_rename(test_dirpath_src.c_str(), test_dirpath_dst.c_str()));
151 ASSERT_TRUE(
BLI_exists(test_dirpath_src.c_str()));
152 ASSERT_TRUE(
BLI_exists(test_dirpath_dst.c_str()));
156 ASSERT_TRUE(
BLI_exists(test_dirpath_src.c_str()));
157 ASSERT_TRUE(
BLI_exists(test_dirpath_dst.c_str()));
256 ASSERT_FALSE(original_cwd ==
nullptr) <<
"Unable to get the current working directory.";
260 ASSERT_TRUE(original_cwd == original_cwd_buff)
261 <<
"Returned CWD path unexpectedly different than given char buffer.";
263 std::string temp_file_name = make_pseudo_unique_temp_filename();
264 test_temp_dir = temp_file_name +
"_новый";
267 BLI_delete(test_temp_dir.c_str(),
true,
false);
271 <<
"changing directory to a non-existent directory is expected to fail.";
274 <<
"temporary directory should have been created successfully.";
277 <<
"temporary directory should succeed changing directory.";
281 ASSERT_FALSE(new_cwd ==
nullptr) <<
"Unable to get the current working directory.";
282 ASSERT_TRUE(new_cwd == new_cwd_buff)
283 <<
"Returned CWD path unexpectedly different than given char buffer.";
289 test_temp_dir =
"/private" + test_temp_dir;
293 <<
"the path of the current working directory should equal the path of the temporary "
294 "directory that was created.";
297 <<
"changing directory back to the original working directory should succeed.";
301 ASSERT_FALSE(final_cwd ==
nullptr) <<
"Unable to get the current working directory.";
302 ASSERT_TRUE(final_cwd == final_cwd_buff)
303 <<
"Returned CWD path unexpectedly different than given char buffer.";
306 <<
"The final CWD path should be the same as the original CWD path.";