Renamed file assertion macros for consistency
This commit is contained in:
parent
5e8491af90
commit
0e2203df43
3 changed files with 10 additions and 10 deletions
|
@ -73,11 +73,11 @@ CR_END_C_API
|
|||
CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__)) \
|
||||
))
|
||||
|
||||
# define cr_assert_file_contents_match_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, ==, __VA_ARGS__))
|
||||
# define cr_expect_file_contents_match_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, ==, __VA_ARGS__))
|
||||
# define cr_assert_file_contents_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, ==, __VA_ARGS__))
|
||||
# define cr_expect_file_contents_eq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, ==, __VA_ARGS__))
|
||||
|
||||
# define cr_assert_file_contents_not_match_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, !=, __VA_ARGS__))
|
||||
# define cr_expect_file_contents_not_match_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, !=, __VA_ARGS__))
|
||||
# define cr_assert_file_contents_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, !=, __VA_ARGS__))
|
||||
# define cr_expect_file_contents_neq_str(...) CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, !=, __VA_ARGS__))
|
||||
|
||||
# ifdef __cplusplus
|
||||
namespace criterion {
|
||||
|
|
|
@ -17,14 +17,14 @@ Test(redirect, test_outputs, .init = redirect_all_std) {
|
|||
fprintf(stdout, "foo");
|
||||
fflush(stdout);
|
||||
|
||||
cr_assert_file_contents_match_str(f_stdout, "foo");
|
||||
cr_assert_file_contents_eq_str(f_stdout, "foo");
|
||||
|
||||
FILE* f_stderr = cr_get_redirected_stderr();
|
||||
|
||||
fprintf(stderr, "bar");
|
||||
fflush(stderr);
|
||||
|
||||
cr_assert_file_contents_match_str(f_stderr, "bar");
|
||||
cr_assert_file_contents_eq_str(f_stderr, "bar");
|
||||
}
|
||||
|
||||
// Testing general I/O with sample command-line rot13
|
||||
|
@ -53,5 +53,5 @@ Test(redirect, rot13, .init = cr_redirect_stdout) {
|
|||
rot13_io();
|
||||
|
||||
FILE* f_stdout = cr_get_redirected_stdout();
|
||||
cr_assert_file_contents_match_str(f_stdout, "gur dhvpx oebja sbk whzcf bire gur ynml qbt");
|
||||
cr_assert_file_contents_eq_str(f_stdout, "gur dhvpx oebja sbk whzcf bire gur ynml qbt");
|
||||
}
|
||||
|
|
|
@ -22,10 +22,10 @@ Test(redirect, test_outputs, .init = redirect_all_std) {
|
|||
std::cerr << "bar" << std::flush;
|
||||
|
||||
std::FILE* f_stdout = cr_get_redirected_stdout();
|
||||
cr_assert_file_contents_match_str(f_stdout, "foo");
|
||||
cr_assert_file_contents_eq_str(f_stdout, "foo");
|
||||
|
||||
std::FILE* f_stderr = cr_get_redirected_stderr();
|
||||
cr_assert_file_contents_match_str(f_stderr, "bar");
|
||||
cr_assert_file_contents_eq_str(f_stderr, "bar");
|
||||
}
|
||||
|
||||
// Testing general I/O with sample command-line rot13
|
||||
|
@ -52,5 +52,5 @@ Test(redirect, rot13, .init = cr_redirect_stdout) {
|
|||
rot13_io();
|
||||
|
||||
std::FILE* f_stdout = cr_get_redirected_stdout();
|
||||
cr_assert_file_contents_match_str(f_stdout, "gur dhvpx oebja sbk whzcf bire gur ynml qbt");
|
||||
cr_assert_file_contents_eq_str(f_stdout, "gur dhvpx oebja sbk whzcf bire gur ynml qbt");
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue