![]() |
![]() |
![]() |
Cutter Reference Manual | ![]() |
---|---|---|---|---|
#define cut_error (format, ...) #define cut_fail (format, ...) #define cut_pending (format, ...) #define cut_notify (format, ...) #define cut_assert (expression, ...) #define cut_assert_null (expression, ...) #define cut_assert_not_null (expression, ...) #define cut_assert_equal_int (expected, actual, ...) #define cut_assert_equal_double (expected, error, actual, ...) #define cut_assert_equal_string (expected, actual, ...) #define cut_assert_equal_string_or_null (expected, actual, ...) #define cut_assert_equal_memory (expected, expected_size, actual, actual_size, ...) #define cut_assert_equal_string_array (expected, actual, ...) #define cut_assert_operator (lhs, operator, rhs, ...) #define cut_assert_operator_int (lhs, operator, rhs, ...) #define cut_assert_equal (function, expected, actual, ...)
To check that your program works as you expect, you use
cut_assert_XXX()
where you want to check expected value
is got.
e.g.:
cut_assert_equal_int(3, 1 + 2);
#define cut_error(format, ...)
Raises an error with message.
|
the message format. See the printf() documentation.
|
|
the parameters to insert into the format string. |
#define cut_fail(format, ...)
Raises a failure with message.
|
the message format. See the printf() documentation.
|
|
the parameters to insert into the format string. |
#define cut_pending(format, ...)
Marks the test is pending with message. The test is stopped.
|
the message format. See the printf() documentation.
|
|
the parameters to insert into the format string. |
#define cut_notify(format, ...)
Leaves a notification message. The test is continued.
|
the message format. See the printf() documentation.
|
|
the parameters to insert into the format string. |
#define cut_assert(expression, ...)
Passes if expression
is not 0 or NULL.
|
the expression to check. |
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|
#define cut_assert_null(expression, ...)
Passes if expression
is NULL.
|
the expression to check. |
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|
#define cut_assert_not_null(expression, ...)
Passes if expression
is not NULL.
|
the expression to check. |
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|
#define cut_assert_equal_int(expected, actual, ...)
Passes if expected
== actual
.
|
an expected integer value. |
|
an actual integer value. |
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|
#define cut_assert_equal_double(expected, error, actual, ...)
Passes if (expected
- error
) <= actual
<= (expected
+ error
).
|
an expected float value. |
|
an float value that specifies error range. |
|
an actual float value. |
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|
#define cut_assert_equal_string(expected, actual, ...)
Passes if both expected
and actual
are not NULL and
strcmp(expected
, actual
) == 0.
|
an expected string value. |
|
an expected string value. |
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|
#define cut_assert_equal_string_or_null(expected, actual, ...)
Passes if both expected
and actual
are NULL or
strcmp(expected
, actual
) == 0.
|
an expected string value. |
|
an expected string value. |
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|
#define cut_assert_equal_memory(expected, expected_size, \ actual, actual_size, ...)
Passes if expected_size
== actual_size
and
memcmp(expected
, actual
, expected_size
) == 0.
|
an expected data. |
|
a size of expected .
|
|
an actual data. |
|
a size of actual .
|
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|
#define cut_assert_equal_string_array(expected, actual, ...)
Passes if both expected
and actual
are not NULL and
have same content (strcmp()
== 0) strings.
|
an expected NULL-terminated array of strings. |
|
an actual NULL-terminated array of strings. |
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|
#define cut_assert_operator(lhs, operator, rhs, ...)
Passes if (lhs
operator
rhs
) is TRUE.
e.g.:
cut_assert_operator(1, <, 2) -> (1 < 2)
|
a left hand side value. |
|
a binary operator. |
|
a right hand side value. |
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|
#define cut_assert_operator_int(lhs, operator, rhs, ...)
Passes if (lhs
operator
rhs
) is TRUE.
e.g.:
cut_assert_operator_int(1, <, 2) -> (1 < 2)
|
a left hand side integer value. |
|
a binary operator. |
|
a right hand side integer value. |
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|
#define cut_assert_equal(function, expected, actual, ...)
Passes if function
(expected
, actual
) returns TRUE.
e.g.:
cut_assert_equal(!strcmp, "abc", "abc") -> Pass
|
a function that compares actual with expected .
|
|
an expected value. |
|
an actual value. |
|
optional format string, followed by parameters to insert
into the format string (as with printf() )
|