| 1 |
#include <cgreen/cgreen.h> |
| 2 |
#include <cgreen/message_formatting.h> |
| 3 |
#include "constraint_internal.h" |
| 4 |
|
| 5 |
Describe(TestConstraint); |
| 6 |
BeforeEach(TestConstraint) {} |
| 7 |
AfterEach(TestConstraint) {} |
| 8 |
|
| 9 |
bool compare_want_greater_than_5(Constraint *constraint, CgreenValue actual) { |
| 10 |
return actual.value.integer_value > 5; |
| 11 |
} |
| 12 |
|
| 13 |
Constraint static_is_bigger_than_5 = { |
| 14 |
CGREEN_VALUE_COMPARER_CONSTRAINT, |
| 15 |
"be bigger than 5", |
| 16 |
destroy_static_constraint, |
| 17 |
compare_want_greater_than_5, |
| 18 |
test_want, |
| 19 |
failure_message_for, |
| 20 |
"", |
| 21 |
"", |
| 22 |
{CGREEN_INTEGER, {5}}, |
| 23 |
"null", |
| 24 |
NULL, |
| 25 |
0 |
| 26 |
}; |
| 27 |
|
| 28 |
Ensure(TestConstraint, custom_constraint_using_static_function) { |
| 29 |
Constraint * is_bigger_than_5 = &static_is_bigger_than_5; |
| 30 |
assert_that(10, is_bigger_than_5); |
| 31 |
} |
| 32 |
|
| 33 |
int main(int argc, char **argv) { |
| 34 |
TestSuite *suite = create_test_suite(); |
| 35 |
add_test_with_context(suite, TestConstraint, custom_constraint_using_static_function); |
| 36 |
run_test_suite(suite, create_text_reporter()); |
| 37 |
} |