Blender  V3.3
BLI_fileops_test.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0 */
2 
3 #include "BLI_fileops.hh"
4 
5 #include "testing/testing.h"
6 
7 namespace blender::tests {
8 
9 TEST(fileops, fstream_open_string_filename)
10 {
11  const std::string test_files_dir = blender::tests::flags_test_asset_dir();
12  if (test_files_dir.empty()) {
13  FAIL();
14  }
15 
16  const std::string filepath = test_files_dir + "/asset_library/новый/blender_assets.cats.txt";
17  fstream in(filepath, std::ios_base::in);
18  ASSERT_TRUE(in.is_open()) << "could not open " << filepath;
19  in.close(); /* This should not crash. */
20 
21  /* Reading the file not tested here. That's deferred to `std::fstream` anyway. */
22 }
23 
24 TEST(fileops, fstream_open_charptr_filename)
25 {
26  const std::string test_files_dir = blender::tests::flags_test_asset_dir();
27  if (test_files_dir.empty()) {
28  FAIL();
29  }
30 
31  const std::string filepath_str = test_files_dir + "/asset_library/новый/blender_assets.cats.txt";
32  const char *filepath = filepath_str.c_str();
33  fstream in(filepath, std::ios_base::in);
34  ASSERT_TRUE(in.is_open()) << "could not open " << filepath;
35  in.close(); /* This should not crash. */
36 
37  /* Reading the file not tested here. That's deferred to `std::fstream` anyway. */
38 }
39 
40 } // namespace blender::tests
File and directory operations.
TEST(any, DefaultConstructor)
Definition: BLI_any_test.cc:10