27 static auto operator"" _ife(
const char *
str, std::size_t len)
28 { (void)str; (void)len;
return std::make_shared<bfn::invalid_file_error>(
""); }
31 bfm_ut::test_file_read_with_bad_filename()
34 auto &&filename =
"/blah/bad_filename.txt"_s;
44 bfm_ut::test_file_write_with_bad_filename()
47 auto &&filename =
"/blah/bad_filename.txt"_s;
49 auto &&text_data =
"hello"_s;
50 auto &&binary_data = {
'h',
'e',
'l',
'l',
'o'};
59 this->
expect_exception([&] { f.write_binary(filename, binary_data); },
""_ife);
63 bfm_ut::test_file_read_write_success()
66 auto &&filename =
"/tmp/test_file.txt"_s;
68 auto &&text_data =
"hello"_s;
69 auto &&binary_data = {
'h',
'e',
'l',
'l',
'o'};
72 this->
expect_true(f.read_text(filename) == text_data);
77 auto &&ret = std::remove(filename.c_str());
#define expect_exception(f, e)
#define expect_no_exception(f)
std::vector< char > binary_data