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()));
238 ASSERT_FALSE(original_cwd ==
nullptr) <<
"Unable to get the current working directory.";
242 ASSERT_TRUE(original_cwd == original_cwd_buff)
243 <<
"Returned CWD path unexpectedly different than given char buffer.";
245 std::string temp_file_name = make_pseudo_unique_temp_filename();
246 test_temp_dir = temp_file_name +
"_новый";
249 BLI_delete(test_temp_dir.c_str(),
true,
false);
253 <<
"changing directory to a non-existent directory is expected to fail.";
256 <<
"temporary directory should have been created successfully.";
259 <<
"temporary directory should succeed changing directory.";
263 ASSERT_FALSE(new_cwd ==
nullptr) <<
"Unable to get the current working directory.";
264 ASSERT_TRUE(new_cwd == new_cwd_buff)
265 <<
"Returned CWD path unexpectedly different than given char buffer.";
271 test_temp_dir =
"/private" + test_temp_dir;
275 <<
"the path of the current working directory should equal the path of the temporary "
276 "directory that was created.";
279 <<
"changing directory back to the original working directory should succeed.";
283 ASSERT_FALSE(final_cwd ==
nullptr) <<
"Unable to get the current working directory.";
284 ASSERT_TRUE(final_cwd == final_cwd_buff)
285 <<
"Returned CWD path unexpectedly different than given char buffer.";
288 <<
"The final CWD path should be the same as the original CWD path.";