| 1 | #cxx . . $ `<file>/tests/assertion_messages_tests.c`/include <cgreen/cgreen.h>cxx . . $ `<file>/include/cgreen/cgreen.h`/ |
| 2 | #include <cgreen/mocks.h>cxx . . $ `<file>/include/cgreen/mocks.h`/ |
| 3 | #include <cgreen/constraint.h>cxx . . $ `<file>/include/cgreen/constraint.h`/ |
| 4 | |
| 5 | #include <stdio.h> |
| 6 | #include <stdlib.h> |
| 7 | #include <unistd.h> |
| 8 | |
| 9 | #ifdef __cplusplus |
| 10 | using namespace cgreen; |
| 11 | #endif |
| 12 | |
| 13 | Describecxx . . $ `include/cgreen/unit.h:12:9`!(AssertionMessage); |
| 14 | BeforeEachcxx . . $ `include/cgreen/unit.h:15:9`!(AssertionMessage) {} |
| 15 | AfterEachcxx . . $ `include/cgreen/unit.h:18:9`!(AssertionMessage) {} |
| 16 | |
| 17 | |
| 18 | char somethingcxx . . $ something.[42]; |
| 19 | Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(AssertionMessage, for_comparing_content_with_negative_length) { |
| 20 | assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(47, is_equal_to_contents_ofcxx . . $ `include/cgreen/constraint_syntax_helpers.h:38:9`!(something, -4)); |
| 21 | } |
| 22 | |
| 23 | Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(AssertionMessage, return_value_constraints_are_not_allowed) { |
| 24 | assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(0, will_returncxx . . $ `include/cgreen/constraint_syntax_helpers.h:58:9`!(1)); |
| 25 | } |
| 26 | |
| 27 | Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(AssertionMessage, for_compare_area_to_null) { |
| 28 | char area[100]; |
| 29 | void *null_pointer = NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!; |
| 30 | assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(area, is_equal_to_contents_ofcxx . . $ `include/cgreen/constraint_syntax_helpers.h:38:9`!(null_pointer, 1)); |
| 31 | } |
| 32 | |
| 33 | Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(AssertionMessage, for_compare_null_to_area) { |
| 34 | char area[100]; |
| 35 | assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(NULLcxx . . $ `<external>/16391990256953433862/stddef.h:419:9`!, is_equal_to_contents_ofcxx . . $ `include/cgreen/constraint_syntax_helpers.h:38:9`!(area, 1)); |
| 36 | } |
| 37 | |
| 38 | Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(AssertionMessage, for_actual_with_percent) { |
| 39 | assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(strlen("%d"), is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(3)); /* Actually, it's not but should preserve '%' */ |
| 40 | } |
| 41 | |
| 42 | /* CAUTION: These two tests outputs the expected warning messages, but |
| 43 | also fails the comparisons, obviously, since that is what they try |
| 44 | to warn against. So the output of those failed constraints might |
| 45 | change unintentionally. */ |
| 46 | Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(AssertionMessage, for_using_double_constraints_with_assert_that) { |
| 47 | assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(3, is_equal_to_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:50:9`!(3.1415926)); |
| 48 | assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(0, is_less_than_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:53:9`!(3.1415926)); |
| 49 | assert_thatcxx . . $ `include/cgreen/assertions.h:30:9`!(7, is_greater_than_doublecxx . . $ `include/cgreen/constraint_syntax_helpers.h:54:9`!(3.1415926)); |
| 50 | } |
| 51 | |
| 52 | Ensurecxx . . $ `include/cgreen/unit.h:25:9`!(AssertionMessage, for_using_non_double_constraints_with_assert_that_double) { |
| 53 | assert_that_doublecxx . . $ `include/cgreen/assertions.h:31:9`!(3, is_equal_tocxx . . $ `include/cgreen/constraint_syntax_helpers.h:26:9`!(3)); |
| 54 | } |