Github User Fetcher 1.0.0
C Application with Server and GUI
Loading...
Searching...
No Matches
redirect.h File Reference
#include "common.h"
#include "assert.h"

Go to the source code of this file.

Macros

#define cr_assert_redir_op_(Fail, Fun, Op, File, Str, ...)
 
#define cr_assert_redir_op_va_(Fail, Fun, Op, ...)
 
#define cr_assert_redir_f_op_(Fail, Fun, Op, File, Ref, ...)
 
#define cr_assert_redir_f_op_va_(Fail, Fun, Op, ...)
 
#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_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__))
 
#define cr_assert_file_contents_eq(...)   CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, ==, __VA_ARGS__))
 
#define cr_expect_file_contents_eq(...)   CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, ==, __VA_ARGS__))
 
#define cr_assert_file_contents_neq(...)   CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, !=, __VA_ARGS__))
 
#define cr_expect_file_contents_neq(...)   CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, !=, __VA_ARGS__))
 
#define cr_assert_stdout_eq_str(...)   CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_ABORT_, cr_stdout_match_str, ==, stdout, __VA_ARGS__))
 
#define cr_expect_stdout_eq_str(...)   CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_CONTINUES_, cr_stdout_match_str, ==, stdout, __VA_ARGS__))
 
#define cr_assert_stdout_neq_str(...)   CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_ABORT_, cr_stdout_match_str, !=, stdout, __VA_ARGS__))
 
#define cr_expect_stdout_neq_str(...)   CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_CONTINUES_, cr_stdout_match_str, !=, stdout, __VA_ARGS__))
 
#define cr_assert_stderr_eq_str(...)   CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_ABORT_, cr_stderr_match_str, ==, stderr, __VA_ARGS__))
 
#define cr_expect_stderr_eq_str(...)   CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_CONTINUES_, cr_stderr_match_str, ==, stderr, __VA_ARGS__))
 
#define cr_assert_stderr_neq_str(...)   CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_ABORT_, cr_stderr_match_str, !=, stderr, __VA_ARGS__))
 
#define cr_expect_stderr_neq_str(...)   CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_CONTINUES_, cr_stderr_match_str, !=, stderr, __VA_ARGS__))
 
#define cr_assert_stdout_eq(...)   CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_ABORT_, cr_stdout_match_file, ==, stdout, __VA_ARGS__))
 
#define cr_expect_stdout_eq(...)   CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_CONTINUES_, cr_stdout_match_file, ==, stdout, __VA_ARGS__))
 
#define cr_assert_stdout_neq(...)   CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_ABORT_, cr_stdout_match_file, !=, stdout, __VA_ARGS__))
 
#define cr_expect_stdout_neq(...)   CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_CONTINUES_, cr_stdout_match_file, !=, stdout, __VA_ARGS__))
 
#define cr_assert_stderr_eq(...)   CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_ABORT_, cr_stderr_match_file, ==, stderr, __VA_ARGS__))
 
#define cr_expect_stderr_eq(...)   CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_CONTINUES_, cr_stderr_match_file, ==, stderr, __VA_ARGS__))
 
#define cr_assert_stderr_neq(...)   CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_ABORT_, cr_stderr_match_file, !=, stderr, __VA_ARGS__))
 
#define cr_expect_stderr_neq(...)   CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_CONTINUES_, cr_stderr_match_file, !=, stderr, __VA_ARGS__))
 
#define cr_assert_redir_unop_(Fail, Fun, Op, File, Str, ...)
 
#define cr_assert_redir_unop_va_(Fail, Fun, Op, ...)
 
#define cr_assert_redir_f_unop_(Fail, Fun, Op, File, Ref, ...)
 
#define cr_assert_redir_f_unop_va_(Fail, Fun, Op, ...)
 

Functions

CR_BEGIN_C_API CR_API int cr_stdout_match_file (CR_STDN FILE *ref)
 
CR_API int cr_stdout_match_str (const char *ref)
 
CR_API int cr_stderr_match_file (CR_STDN FILE *ref)
 
CR_API int cr_stderr_match_str (const char *ref)
 

Macro Definition Documentation

◆ cr_assert_file_contents_eq

#define cr_assert_file_contents_eq ( ...)    CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, ==, __VA_ARGS__))

Definition at line 88 of file internal/redirect.h.

◆ cr_assert_file_contents_eq_str

#define cr_assert_file_contents_eq_str ( ...)    CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, ==, __VA_ARGS__))

Definition at line 80 of file internal/redirect.h.

◆ cr_assert_file_contents_neq

#define cr_assert_file_contents_neq ( ...)    CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_ABORT_, cr_file_match_file, !=, __VA_ARGS__))

Definition at line 92 of file internal/redirect.h.

◆ cr_assert_file_contents_neq_str

#define cr_assert_file_contents_neq_str ( ...)    CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_ABORT_, cr_file_match_str, !=, __VA_ARGS__))

Definition at line 84 of file internal/redirect.h.

◆ cr_assert_redir_f_op_

#define cr_assert_redir_f_op_ ( Fail,
Fun,
Op,
File,
Ref,
... )
Value:
Fail, \
!(Fun((File), (Ref)) Op 0), \
dummy, \
(CR_STR(File), CR_STR(Ref)), \
__VA_ARGS__ \
))
#define cr_assert_impl(Fail, Condition,...)
@ CRITERION_ASSERT_MSG_FILE_MATCH
#define CR_EXPAND(x)
Definition preprocess.h:35
#define CR_STR(...)
Definition preprocess.h:58

Definition at line 59 of file internal/redirect.h.

59#define cr_assert_redir_f_op_(Fail, Fun, Op, File, Ref, ...) \
60 CR_EXPAND(cr_assert_impl( \
61 Fail, \
62 !(Fun((File), (Ref)) Op 0), \
63 dummy, \
64 CRITERION_ASSERT_MSG_FILE_MATCH, \
65 (CR_STR(File), CR_STR(Ref)), \
66 __VA_ARGS__ \
67 ))

◆ cr_assert_redir_f_op_va_

#define cr_assert_redir_f_op_va_ ( Fail,
Fun,
Op,
... )
Value:
Fail, \
Fun, \
Op, \
CR_VA_HEAD(__VA_ARGS__), \
CR_VA_HEAD(CR_VA_TAIL(__VA_ARGS__)), \
CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__)) \
))
#define cr_assert_redir_f_op_(Fail, Fun, Op, File, Ref,...)
#define CR_VA_TAIL(...)
Definition preprocess.h:61
#define CR_VA_HEAD(...)
Definition preprocess.h:68

Definition at line 69 of file internal/redirect.h.

69#define cr_assert_redir_f_op_va_(Fail, Fun, Op, ...) \
70 CR_EXPAND(cr_assert_redir_f_op_( \
71 Fail, \
72 Fun, \
73 Op, \
74 CR_VA_HEAD(__VA_ARGS__), \
75 CR_VA_HEAD(CR_VA_TAIL(__VA_ARGS__)), \
76 CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__)) \
77 ))

◆ cr_assert_redir_f_unop_

#define cr_assert_redir_f_unop_ ( Fail,
Fun,
Op,
File,
Ref,
... )
Value:
Fail, \
!(Fun((Ref)) Op 0), \
dummy, \
(CR_STR(File), CR_STR(Ref)), \
__VA_ARGS__ \
))

Definition at line 149 of file internal/redirect.h.

149#define cr_assert_redir_f_unop_(Fail, Fun, Op, File, Ref, ...) \
150 CR_EXPAND(cr_assert_impl( \
151 Fail, \
152 !(Fun((Ref)) Op 0), \
153 dummy, \
154 CRITERION_ASSERT_MSG_FILE_MATCH, \
155 (CR_STR(File), CR_STR(Ref)), \
156 __VA_ARGS__ \
157 ))

◆ cr_assert_redir_f_unop_va_

#define cr_assert_redir_f_unop_va_ ( Fail,
Fun,
Op,
... )
Value:
Fail, \
Fun, \
Op, \
CR_VA_HEAD(__VA_ARGS__), \
CR_VA_HEAD(CR_VA_TAIL(__VA_ARGS__)), \
CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__)) \
))
#define cr_assert_redir_f_unop_(Fail, Fun, Op, File, Ref,...)

Definition at line 159 of file internal/redirect.h.

159#define cr_assert_redir_f_unop_va_(Fail, Fun, Op, ...) \
160 CR_EXPAND(cr_assert_redir_f_unop_( \
161 Fail, \
162 Fun, \
163 Op, \
164 CR_VA_HEAD(__VA_ARGS__), \
165 CR_VA_HEAD(CR_VA_TAIL(__VA_ARGS__)), \
166 CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__)) \
167 ))

◆ cr_assert_redir_op_

#define cr_assert_redir_op_ ( Fail,
Fun,
Op,
File,
Str,
... )
Value:
Fail, \
!(Fun((File), (Str)) Op 0), \
dummy, \
(CR_STR(File), Str), \
__VA_ARGS__ \
))
@ CRITERION_ASSERT_MSG_FILE_STR_MATCH

Definition at line 39 of file internal/redirect.h.

39#define cr_assert_redir_op_(Fail, Fun, Op, File, Str, ...) \
40 CR_EXPAND(cr_assert_impl( \
41 Fail, \
42 !(Fun((File), (Str)) Op 0), \
43 dummy, \
44 CRITERION_ASSERT_MSG_FILE_STR_MATCH, \
45 (CR_STR(File), Str), \
46 __VA_ARGS__ \
47 ))

◆ cr_assert_redir_op_va_

#define cr_assert_redir_op_va_ ( Fail,
Fun,
Op,
... )
Value:
Fail, \
Fun, \
Op, \
CR_VA_HEAD(__VA_ARGS__), \
CR_VA_HEAD(CR_VA_TAIL(__VA_ARGS__)), \
CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__)) \
))
#define cr_assert_redir_op_(Fail, Fun, Op, File, Str,...)

Definition at line 49 of file internal/redirect.h.

49#define cr_assert_redir_op_va_(Fail, Fun, Op, ...) \
50 CR_EXPAND(cr_assert_redir_op_( \
51 Fail, \
52 Fun, \
53 Op, \
54 CR_VA_HEAD(__VA_ARGS__), \
55 CR_VA_HEAD(CR_VA_TAIL(__VA_ARGS__)), \
56 CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__)) \
57 ))

◆ cr_assert_redir_unop_

#define cr_assert_redir_unop_ ( Fail,
Fun,
Op,
File,
Str,
... )
Value:
Fail, \
!(Fun((Str)) Op 0), \
dummy, \
(CR_STR(File), Str), \
__VA_ARGS__ \
))

Definition at line 129 of file internal/redirect.h.

129#define cr_assert_redir_unop_(Fail, Fun, Op, File, Str, ...) \
130 CR_EXPAND(cr_assert_impl( \
131 Fail, \
132 !(Fun((Str)) Op 0), \
133 dummy, \
134 CRITERION_ASSERT_MSG_FILE_STR_MATCH, \
135 (CR_STR(File), Str), \
136 __VA_ARGS__ \
137 ))

◆ cr_assert_redir_unop_va_

#define cr_assert_redir_unop_va_ ( Fail,
Fun,
Op,
... )
Value:
Fail, \
Fun, \
Op, \
CR_VA_HEAD(__VA_ARGS__), \
CR_VA_HEAD(CR_VA_TAIL(__VA_ARGS__)), \
CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__)) \
))
#define cr_assert_redir_unop_(Fail, Fun, Op, File, Str,...)

Definition at line 139 of file internal/redirect.h.

139#define cr_assert_redir_unop_va_(Fail, Fun, Op, ...) \
140 CR_EXPAND(cr_assert_redir_unop_( \
141 Fail, \
142 Fun, \
143 Op, \
144 CR_VA_HEAD(__VA_ARGS__), \
145 CR_VA_HEAD(CR_VA_TAIL(__VA_ARGS__)), \
146 CR_VA_TAIL(CR_VA_TAIL(__VA_ARGS__)) \
147 ))

◆ cr_assert_stderr_eq

#define cr_assert_stderr_eq ( ...)    CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_ABORT_, cr_stderr_match_file, ==, stderr, __VA_ARGS__))

Definition at line 121 of file internal/redirect.h.

◆ cr_assert_stderr_eq_str

#define cr_assert_stderr_eq_str ( ...)    CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_ABORT_, cr_stderr_match_str, ==, stderr, __VA_ARGS__))

Definition at line 105 of file internal/redirect.h.

◆ cr_assert_stderr_neq

#define cr_assert_stderr_neq ( ...)    CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_ABORT_, cr_stderr_match_file, !=, stderr, __VA_ARGS__))

Definition at line 125 of file internal/redirect.h.

◆ cr_assert_stderr_neq_str

#define cr_assert_stderr_neq_str ( ...)    CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_ABORT_, cr_stderr_match_str, !=, stderr, __VA_ARGS__))

Definition at line 109 of file internal/redirect.h.

◆ cr_assert_stdout_eq

#define cr_assert_stdout_eq ( ...)    CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_ABORT_, cr_stdout_match_file, ==, stdout, __VA_ARGS__))

Definition at line 113 of file internal/redirect.h.

◆ cr_assert_stdout_eq_str

#define cr_assert_stdout_eq_str ( ...)    CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_ABORT_, cr_stdout_match_str, ==, stdout, __VA_ARGS__))

Definition at line 97 of file internal/redirect.h.

◆ cr_assert_stdout_neq

#define cr_assert_stdout_neq ( ...)    CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_ABORT_, cr_stdout_match_file, !=, stdout, __VA_ARGS__))

Definition at line 117 of file internal/redirect.h.

◆ cr_assert_stdout_neq_str

#define cr_assert_stdout_neq_str ( ...)    CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_ABORT_, cr_stdout_match_str, !=, stdout, __VA_ARGS__))

Definition at line 101 of file internal/redirect.h.

◆ cr_expect_file_contents_eq

#define cr_expect_file_contents_eq ( ...)    CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, ==, __VA_ARGS__))

Definition at line 90 of file internal/redirect.h.

◆ cr_expect_file_contents_eq_str

#define cr_expect_file_contents_eq_str ( ...)    CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, ==, __VA_ARGS__))

Definition at line 82 of file internal/redirect.h.

◆ cr_expect_file_contents_neq

#define cr_expect_file_contents_neq ( ...)    CR_EXPAND(cr_assert_redir_f_op_va_(CR_FAIL_CONTINUES_, cr_file_match_file, !=, __VA_ARGS__))

Definition at line 94 of file internal/redirect.h.

◆ cr_expect_file_contents_neq_str

#define cr_expect_file_contents_neq_str ( ...)    CR_EXPAND(cr_assert_redir_op_va_(CR_FAIL_CONTINUES_, cr_file_match_str, !=, __VA_ARGS__))

Definition at line 86 of file internal/redirect.h.

◆ cr_expect_stderr_eq

#define cr_expect_stderr_eq ( ...)    CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_CONTINUES_, cr_stderr_match_file, ==, stderr, __VA_ARGS__))

Definition at line 123 of file internal/redirect.h.

◆ cr_expect_stderr_eq_str

#define cr_expect_stderr_eq_str ( ...)    CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_CONTINUES_, cr_stderr_match_str, ==, stderr, __VA_ARGS__))

Definition at line 107 of file internal/redirect.h.

◆ cr_expect_stderr_neq

#define cr_expect_stderr_neq ( ...)    CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_CONTINUES_, cr_stderr_match_file, !=, stderr, __VA_ARGS__))

Definition at line 127 of file internal/redirect.h.

◆ cr_expect_stderr_neq_str

#define cr_expect_stderr_neq_str ( ...)    CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_CONTINUES_, cr_stderr_match_str, !=, stderr, __VA_ARGS__))

Definition at line 111 of file internal/redirect.h.

◆ cr_expect_stdout_eq

#define cr_expect_stdout_eq ( ...)    CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_CONTINUES_, cr_stdout_match_file, ==, stdout, __VA_ARGS__))

Definition at line 115 of file internal/redirect.h.

◆ cr_expect_stdout_eq_str

#define cr_expect_stdout_eq_str ( ...)    CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_CONTINUES_, cr_stdout_match_str, ==, stdout, __VA_ARGS__))

Definition at line 99 of file internal/redirect.h.

◆ cr_expect_stdout_neq

#define cr_expect_stdout_neq ( ...)    CR_EXPAND(cr_assert_redir_f_unop_va_(CR_FAIL_CONTINUES_, cr_stdout_match_file, !=, stdout, __VA_ARGS__))

Definition at line 119 of file internal/redirect.h.

◆ cr_expect_stdout_neq_str

#define cr_expect_stdout_neq_str ( ...)    CR_EXPAND(cr_assert_redir_unop_va_(CR_FAIL_CONTINUES_, cr_stdout_match_str, !=, stdout, __VA_ARGS__))

Definition at line 103 of file internal/redirect.h.

Function Documentation

◆ cr_stderr_match_file()

CR_API int cr_stderr_match_file ( CR_STDN FILE * ref)

◆ cr_stderr_match_str()

CR_API int cr_stderr_match_str ( const char * ref)

◆ cr_stdout_match_file()

CR_BEGIN_C_API CR_API int cr_stdout_match_file ( CR_STDN FILE * ref)

◆ cr_stdout_match_str()

CR_API int cr_stdout_match_str ( const char * ref)