| 1 | #cxx . . $ `<file>/src/constraint.c`/include <cgreen/assertions.h>cxx . . $ `<file>/include/cgreen/assertions.h`/ |
| 2 | #include <cgreen/boxed_double.h>cxx . . $ `<file>/include/cgreen/boxed_double.h`/ |
| 3 | #include <cgreen/constraint.h>cxx . . $ `<file>/include/cgreen/constraint.h`/ |
| 4 | #include <cgreen/message_formatting.h>cxx . . $ `<file>/include/cgreen/message_formatting.h`/ |
| 5 | #include <cgreen/string_comparison.h>cxx . . $ `<file>/include/cgreen/string_comparison.h`/ |
| 6 | #include <cgreen/vector.h>cxx . . $ `<file>/include/cgreen/vector.h`/ |
| 7 | #include <inttypes.h> |
| 8 | #include <float.h> |
| 9 | #include <limits.h> |
| 10 | #include <math.h> |
| 11 | #ifndef __cplusplus |
| 12 | #include <stdbool.h> |
| 13 | #endif |
| 14 | #include <stdio.h> |
| 15 | #include <stdlib.h> |
| 16 | #include <string.h> |
| 17 | |
| 18 | #ifdef __ANDROID__ |
| 19 | #include "cgreen/internal/android_headers/androidcompat.h" |
| 20 | #endif // #ifdef __ANDROID__ |
| 21 | |
| 22 | |
| 23 | #ifdef _MSC_VER |
| 24 | #include "wincompat.h" |
| 25 | #endif |
| 26 | |
| 27 | #include "constraint_internal.h"cxx . . $ `<file>/src/constraint_internal.h`/ |
| 28 | #include "parameters.h"cxx . . $ `<file>/src/parameters.h`/ |
| 29 | #include "utils.h"cxx . . $ `<file>/src/utils.h`/ |
| 30 | #include "cgreen_value_internal.h"cxx . . $ `<file>/src/cgreen_value_internal.h`/ |
| 31 | |
| 32 | |
| 33 | #ifdef max |
| 34 | #undef max |
| 35 | #endif |
| 36 | |
| 37 | #ifdef min |
| 38 | #undef min |
| 39 | #endif |
| 40 | |
| 41 | #define maxcxx . . $ `src/constraint.c:41:9`!(a,b) ((a) > (b) ? (a) : (b)) |
| 42 | #define mincxx . . $ `src/constraint.c:42:9`!(a,b) ((a) > (b) ? (b) : (a)) |
| 43 | |
| 44 | |
| 45 | static int significant_figurescxx . . $ significant_figures. = 8; |
| 46 | static double absolute_tolerancecxx . . $ absolute_tolerance. = DBL_MINcxx . . $ `<external>/8223903785965736313/float.h:122:9`! / 1.0e-8; |
| 47 | |
| 48 | |
| 49 | static double accuracycxx . . $ accuracy(538a8530131fd110).(int significant_figures, double largest); |
| 50 | |
| 51 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_greater_valuecxx . . $ compare_want_greater_value(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 52 | |
| 53 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_lesser_valuecxx . . $ compare_want_lesser_value(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 54 | |
| 55 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_contentscxx . . $ compare_want_contents(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 56 | |
| 57 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_contentscxx . . $ compare_do_not_want_contents(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 58 | |
| 59 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_truecxx . . $ compare_true(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 60 | static void test_truecxx . . $ test_true(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 61 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter); |
| 62 | |
| 63 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_stringcxx . . $ compare_want_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 64 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_stringcxx . . $ compare_do_not_want_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 65 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_substringcxx . . $ compare_want_substring(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 66 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_substringcxx . . $ compare_do_not_want_substring(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 67 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_beginning_of_stringcxx . . $ compare_want_beginning_of_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 68 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_beginning_of_stringcxx . . $ compare_do_not_want_beginning_of_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 69 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_end_of_stringcxx . . $ compare_want_end_of_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 70 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_end_of_stringcxx . . $ compare_do_not_want_end_of_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 71 | |
| 72 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_doublecxx . . $ compare_want_double(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 73 | static void test_want_doublecxx . . $ test_want_double(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 74 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter); |
| 75 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_doublecxx . . $ compare_do_not_want_double(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 76 | static void test_do_not_want_doublecxx . . $ test_do_not_want_double(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 77 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter); |
| 78 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_lesser_doublecxx . . $ compare_want_lesser_double(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 79 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_greater_doublecxx . . $ compare_want_greater_double(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual); |
| 80 | |
| 81 | static void set_contentscxx . . $ set_contents(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 82 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter); |
| 83 | static void execute_sideeffectcxx . . $ execute_sideeffect(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 84 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter); |
| 85 | static void capture_parametercxx . . $ capture_parameter(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 86 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter); |
| 87 | |
| 88 | static const char *default_actual_value_messagecxx . . $ default_actual_value_message. = "\n\t\tactual value:\t\t\t[%" PRIdPTRcxx . . $ `<external>/15933738808807975373/inttypes.h:165:10`! "]"; |
| 89 | static const char *default_expected_value_messagecxx . . $ default_expected_value_message. = "\t\texpected value:\t\t\t[%" PRIdPTRcxx . . $ `<external>/15933738808807975373/inttypes.h:165:10`! "]"; |
| 90 | |
| 91 | Constraintcxx . . $ Constraint# *create_constraintcxx . . $ create_constraint(ba55e2de72051eb6).(void) { |
| 92 | Constraintcxx . . $ Constraint# *constraint = (Constraintcxx . . $ Constraint# *)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(Constraintcxx . . $ Constraint#)); |
| 93 | /* TODO: setting this to NULL as an implicit type check :( */ |
| 94 | constraint->parameter_namecxx . . $ Constraint_#parameter_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 95 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_empty_constraintcxx . . $ destroy_empty_constraint(f159a969fe179808).; |
| 96 | constraint->failure_messagecxx . . $ Constraint_#failure_message. = &failure_message_forcxx . . $ failure_message_for(12dea272953de187).; |
| 97 | constraint->expected_value_namecxx . . $ Constraint_#expected_value_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 98 | constraint->actual_value_messagecxx . . $ Constraint_#actual_value_message. = default_actual_value_messagecxx . . $ default_actual_value_message.; |
| 99 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = default_expected_value_messagecxx . . $ default_expected_value_message.; |
| 100 | |
| 101 | return constraint; |
| 102 | } |
| 103 | |
| 104 | static Constraintcxx . . $ Constraint# *create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(CgreenValuecxx . . $ CgreenValue# expected_value, const char *expected_value_name) { |
| 105 | Constraintcxx . . $ Constraint# *constraint = create_constraintcxx . . $ create_constraint(ba55e2de72051eb6).(); |
| 106 | |
| 107 | constraint->expected_valuecxx . . $ Constraint_#expected_value. = expected_value; |
| 108 | constraint->expected_value_namecxx . . $ Constraint_#expected_value_name. = string_dupcxx . . $ string_dup(a8b8e32347182212).(expected_value_name); |
| 109 | |
| 110 | return constraint; |
| 111 | } |
| 112 | |
| 113 | void destroy_empty_constraintcxx . . $ destroy_empty_constraint(f159a969fe179808).(Constraintcxx . . $ Constraint# *constraint) { |
| 114 | constraint->namecxx . . $ Constraint_#name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 115 | constraint->parameter_namecxx . . $ Constraint_#parameter_name. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 116 | constraint->comparecxx . . $ Constraint_#compare. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 117 | constraint->executecxx . . $ Constraint_#execute. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 118 | constraint->destroycxx . . $ Constraint_#destroy. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 119 | |
| 120 | if (constraint->expected_value_namecxx . . $ Constraint_#expected_value_name. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 121 | freecxx . . $ free(5d22bdacc48458e8).((void *)constraint->expected_value_namecxx . . $ Constraint_#expected_value_name.); |
| 122 | |
| 123 | freecxx . . $ free(5d22bdacc48458e8).(constraint); |
| 124 | } |
| 125 | |
| 126 | void destroy_static_constraintcxx . . $ destroy_static_constraint(f159a969fe179808).(Constraintcxx . . $ Constraint# *constraint) { |
| 127 | /* static constraints helpers (e.g. is_null) act as singletons, and are never destroyed */ |
| 128 | (void)constraint; |
| 129 | } |
| 130 | |
| 131 | void destroy_constraintcxx . . $ destroy_constraint(f159a969fe179808).(Constraintcxx . . $ Constraint# *constraint) { |
| 132 | if (constraint->destroycxx . . $ Constraint_#destroy. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) |
| 133 | (*constraint->destroycxx . . $ Constraint_#destroy.)(constraint); |
| 134 | } |
| 135 | |
| 136 | void destroy_constraintscxx . . $ destroy_constraints(490612dd6b4b3be6).(va_listcxx . . $ va_list# constraints) { |
| 137 | Constraintcxx . . $ Constraint# *constraint = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!; |
| 138 | while ((constraint = va_argcxx . . $ `<external>/8293021631987149590/stdarg.h:54:9`!(constraints, Constraint *)) != (Constraintcxx . . $ Constraint# *)0) { |
| 139 | destroy_constraintcxx . . $ destroy_constraint(f159a969fe179808).(constraint); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! constraint_is_for_parametercxx . . $ constraint_is_for_parameter(74f87f4455e42aa1).(const Constraintcxx . . $ Constraint# *constraint, const char *parameter) { |
| 144 | return !constraint_is_not_for_parametercxx . . $ constraint_is_not_for_parameter(74f87f4455e42aa1).(constraint, parameter); |
| 145 | } |
| 146 | |
| 147 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! constraint_is_not_for_parametercxx . . $ constraint_is_not_for_parameter(74f87f4455e42aa1).(const Constraintcxx . . $ Constraint# *constraint, const char *parameter) { |
| 148 | /* TODO: This should not test for types of constraints... Or it actually checks for something else ... */ |
| 149 | if (is_not_comparingcxx . . $ is_not_comparing(1ba69099f960dda3).(constraint) && is_not_content_settingcxx . . $ is_not_content_setting(1ba69099f960dda3).(constraint)) { |
| 150 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 151 | } |
| 152 | |
| 153 | return strcmpcxx . . $ strcmp(5ae29d726ae57f88).(constraint->parameter_namecxx . . $ Constraint_#parameter_name., parameter) != 0; |
| 154 | } |
| 155 | |
| 156 | Constraintcxx . . $ Constraint# *create_not_null_constraintcxx . . $ create_not_null_constraint(ba55e2de72051eb6).(void) { |
| 157 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_integer_valuecxx . . $ make_cgreen_integer_value(1194b204c86a8e67).(0), "null"); |
| 158 | constraint->typecxx . . $ Constraint_#type. = CGREEN_VALUE_COMPARER_CONSTRAINTcxx . . $ CGREEN_VALUE_COMPARER_CONSTRAINT.; |
| 159 | |
| 160 | constraint->namecxx . . $ Constraint_#name. = "be non null"; |
| 161 | constraint->comparecxx . . $ Constraint_#compare. = &compare_do_not_want_valuecxx . . $ compare_do_not_want_value(967c8d0e1b1425dd).; |
| 162 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 163 | constraint->actual_value_messagecxx . . $ Constraint_#actual_value_message. = ""; |
| 164 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = ""; |
| 165 | |
| 166 | return constraint; |
| 167 | } |
| 168 | |
| 169 | Constraintcxx . . $ Constraint# *create_is_null_constraintcxx . . $ create_is_null_constraint(ba55e2de72051eb6).(void) { |
| 170 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_integer_valuecxx . . $ make_cgreen_integer_value(1194b204c86a8e67).(0), "null"); |
| 171 | constraint->typecxx . . $ Constraint_#type. = CGREEN_VALUE_COMPARER_CONSTRAINTcxx . . $ CGREEN_VALUE_COMPARER_CONSTRAINT.; |
| 172 | |
| 173 | constraint->namecxx . . $ Constraint_#name. = "be null"; |
| 174 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_valuecxx . . $ compare_want_value(967c8d0e1b1425dd).; |
| 175 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 176 | constraint->actual_value_messagecxx . . $ Constraint_#actual_value_message. = ""; |
| 177 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = ""; |
| 178 | |
| 179 | return constraint; |
| 180 | } |
| 181 | |
| 182 | Constraintcxx . . $ Constraint# *create_is_false_constraintcxx . . $ create_is_false_constraint(ba55e2de72051eb6).(void) { |
| 183 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_integer_valuecxx . . $ make_cgreen_integer_value(1194b204c86a8e67).(falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!), "false"); |
| 184 | constraint->typecxx . . $ Constraint_#type. = CGREEN_VALUE_COMPARER_CONSTRAINTcxx . . $ CGREEN_VALUE_COMPARER_CONSTRAINT.; |
| 185 | |
| 186 | constraint->namecxx . . $ Constraint_#name. = "be false"; |
| 187 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_valuecxx . . $ compare_want_value(967c8d0e1b1425dd).; |
| 188 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 189 | constraint->actual_value_messagecxx . . $ Constraint_#actual_value_message. = ""; |
| 190 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = ""; |
| 191 | |
| 192 | return constraint; |
| 193 | } |
| 194 | |
| 195 | Constraintcxx . . $ Constraint# *create_is_true_constraintcxx . . $ create_is_true_constraint(ba55e2de72051eb6).(void) { |
| 196 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_integer_valuecxx . . $ make_cgreen_integer_value(1194b204c86a8e67).(falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!), "true"); |
| 197 | constraint->typecxx . . $ Constraint_#type. = CGREEN_VALUE_COMPARER_CONSTRAINTcxx . . $ CGREEN_VALUE_COMPARER_CONSTRAINT.; |
| 198 | |
| 199 | constraint->namecxx . . $ Constraint_#name. = "be true"; |
| 200 | constraint->comparecxx . . $ Constraint_#compare. = &compare_do_not_want_valuecxx . . $ compare_do_not_want_value(967c8d0e1b1425dd).; |
| 201 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 202 | constraint->actual_value_messagecxx . . $ Constraint_#actual_value_message. = ""; |
| 203 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = ""; |
| 204 | |
| 205 | return constraint; |
| 206 | } |
| 207 | |
| 208 | Constraintcxx . . $ Constraint# *create_equal_to_value_constraintcxx . . $ create_equal_to_value_constraint(f83092978cf2a14d).(intptr_tcxx . . $ intptr_t# expected_value, const char *expected_value_name) { |
| 209 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_integer_valuecxx . . $ make_cgreen_integer_value(1194b204c86a8e67).(expected_value), expected_value_name); |
| 210 | constraint->typecxx . . $ Constraint_#type. = CGREEN_VALUE_COMPARER_CONSTRAINTcxx . . $ CGREEN_VALUE_COMPARER_CONSTRAINT.; |
| 211 | |
| 212 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_valuecxx . . $ compare_want_value(967c8d0e1b1425dd).; |
| 213 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 214 | constraint->namecxx . . $ Constraint_#name. = "equal"; |
| 215 | constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value. = sizeof(intptr_tcxx . . $ intptr_t#); |
| 216 | |
| 217 | return constraint; |
| 218 | } |
| 219 | |
| 220 | Constraintcxx . . $ Constraint# *create_equal_to_hexvalue_constraintcxx . . $ create_equal_to_hexvalue_constraint(f83092978cf2a14d).(intptr_tcxx . . $ intptr_t# expected_value, const char *expected_value_name) { |
| 221 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_integer_valuecxx . . $ make_cgreen_integer_value(1194b204c86a8e67).(expected_value), expected_value_name); |
| 222 | constraint->typecxx . . $ Constraint_#type. = CGREEN_VALUE_COMPARER_CONSTRAINTcxx . . $ CGREEN_VALUE_COMPARER_CONSTRAINT.; |
| 223 | |
| 224 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_valuecxx . . $ compare_want_value(967c8d0e1b1425dd).; |
| 225 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 226 | constraint->namecxx . . $ Constraint_#name. = "equal"; |
| 227 | constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value. = sizeof(intptr_tcxx . . $ intptr_t#); |
| 228 | constraint->actual_value_messagecxx . . $ Constraint_#actual_value_message. = "\n\t\tactual value:\t\t\t[0x%" PRIxPTRcxx . . $ `<external>/15933738808807975373/inttypes.h:169:10`! "]"; |
| 229 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected value:\t\t\t[0x%" PRIxPTRcxx . . $ `<external>/15933738808807975373/inttypes.h:169:10`! "]"; |
| 230 | |
| 231 | return constraint; |
| 232 | } |
| 233 | |
| 234 | Constraintcxx . . $ Constraint# *create_not_equal_to_value_constraintcxx . . $ create_not_equal_to_value_constraint(f83092978cf2a14d).(intptr_tcxx . . $ intptr_t# expected_value, const char *expected_value_name) { |
| 235 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_integer_valuecxx . . $ make_cgreen_integer_value(1194b204c86a8e67).(expected_value), expected_value_name); |
| 236 | constraint->typecxx . . $ Constraint_#type. = CGREEN_VALUE_COMPARER_CONSTRAINTcxx . . $ CGREEN_VALUE_COMPARER_CONSTRAINT.; |
| 237 | |
| 238 | constraint->comparecxx . . $ Constraint_#compare. = &compare_do_not_want_valuecxx . . $ compare_do_not_want_value(967c8d0e1b1425dd).; |
| 239 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 240 | constraint->namecxx . . $ Constraint_#name. = "not equal"; |
| 241 | constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value. = sizeof(intptr_tcxx . . $ intptr_t#); |
| 242 | |
| 243 | return constraint; |
| 244 | } |
| 245 | |
| 246 | Constraintcxx . . $ Constraint# *create_less_than_value_constraintcxx . . $ create_less_than_value_constraint(f83092978cf2a14d).(intptr_tcxx . . $ intptr_t# expected_value, const char *expected_value_name) { |
| 247 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_integer_valuecxx . . $ make_cgreen_integer_value(1194b204c86a8e67).(expected_value), expected_value_name); |
| 248 | constraint->typecxx . . $ Constraint_#type. = CGREEN_VALUE_COMPARER_CONSTRAINTcxx . . $ CGREEN_VALUE_COMPARER_CONSTRAINT.; |
| 249 | |
| 250 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_lesser_valuecxx . . $ compare_want_lesser_value(967c8d0e1b1425dd).; |
| 251 | constraint->executecxx . . $ Constraint_#execute. = &test_truecxx . . $ test_true(c0af3e8d8bd2e1e5).; |
| 252 | constraint->namecxx . . $ Constraint_#name. = "be less than"; |
| 253 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to be less than:\t[%" PRIdPTRcxx . . $ `<external>/15933738808807975373/inttypes.h:165:10`! "]"; |
| 254 | constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value. = sizeof(intptr_tcxx . . $ intptr_t#); |
| 255 | |
| 256 | return constraint; |
| 257 | } |
| 258 | |
| 259 | Constraintcxx . . $ Constraint# *create_greater_than_value_constraintcxx . . $ create_greater_than_value_constraint(f83092978cf2a14d).(intptr_tcxx . . $ intptr_t# expected_value, const char *expected_value_name) { |
| 260 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_integer_valuecxx . . $ make_cgreen_integer_value(1194b204c86a8e67).(expected_value), expected_value_name); |
| 261 | constraint->typecxx . . $ Constraint_#type. = CGREEN_VALUE_COMPARER_CONSTRAINTcxx . . $ CGREEN_VALUE_COMPARER_CONSTRAINT.; |
| 262 | |
| 263 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_greater_valuecxx . . $ compare_want_greater_value(967c8d0e1b1425dd).; |
| 264 | constraint->executecxx . . $ Constraint_#execute. = &test_truecxx . . $ test_true(c0af3e8d8bd2e1e5).; |
| 265 | constraint->namecxx . . $ Constraint_#name. = "be greater than"; |
| 266 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to be greater than:\t[%" PRIdPTRcxx . . $ `<external>/15933738808807975373/inttypes.h:165:10`! "]"; |
| 267 | constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value. = sizeof(intptr_tcxx . . $ intptr_t#); |
| 268 | |
| 269 | return constraint; |
| 270 | } |
| 271 | |
| 272 | Constraintcxx . . $ Constraint# *create_equal_to_contents_constraintcxx . . $ create_equal_to_contents_constraint(329cc2776ae464c5).(void *pointer_to_compare, size_t size_to_compare, const char *compared_pointer_name) { |
| 273 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_pointer_valuecxx . . $ make_cgreen_pointer_value(32799a8d7b9a4e33).(pointer_to_compare), compared_pointer_name); |
| 274 | constraint->typecxx . . $ Constraint_#type. = CGREEN_CONTENT_COMPARER_CONSTRAINTcxx . . $ CGREEN_CONTENT_COMPARER_CONSTRAINT.; |
| 275 | |
| 276 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_contentscxx . . $ compare_want_contents(967c8d0e1b1425dd).; |
| 277 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 278 | constraint->namecxx . . $ Constraint_#name. = "equal contents of"; |
| 279 | constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value. = size_to_compare; |
| 280 | |
| 281 | return constraint; |
| 282 | } |
| 283 | |
| 284 | Constraintcxx . . $ Constraint# *create_not_equal_to_contents_constraintcxx . . $ create_not_equal_to_contents_constraint(329cc2776ae464c5).(void *pointer_to_compare, size_t size_to_compare, const char *compared_pointer_name) { |
| 285 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_pointer_valuecxx . . $ make_cgreen_pointer_value(32799a8d7b9a4e33).(pointer_to_compare), compared_pointer_name); |
| 286 | constraint->typecxx . . $ Constraint_#type. = CGREEN_CONTENT_COMPARER_CONSTRAINTcxx . . $ CGREEN_CONTENT_COMPARER_CONSTRAINT.; |
| 287 | |
| 288 | constraint->comparecxx . . $ Constraint_#compare. = &compare_do_not_want_contentscxx . . $ compare_do_not_want_contents(967c8d0e1b1425dd).; |
| 289 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 290 | constraint->namecxx . . $ Constraint_#name. = "not equal contents of"; |
| 291 | constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value. = size_to_compare; |
| 292 | |
| 293 | return constraint; |
| 294 | } |
| 295 | |
| 296 | Constraintcxx . . $ Constraint# *create_equal_to_string_constraintcxx . . $ create_equal_to_string_constraint(6f3cd94f7e4cc57).(const char* expected_value, const char *expected_value_name) { |
| 297 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_string_valuecxx . . $ make_cgreen_string_value(ec756e338d9bee84).(expected_value), expected_value_name); |
| 298 | constraint->typecxx . . $ Constraint_#type. = CGREEN_STRING_COMPARER_CONSTRAINTcxx . . $ CGREEN_STRING_COMPARER_CONSTRAINT.; |
| 299 | |
| 300 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_stringcxx . . $ compare_want_string(967c8d0e1b1425dd).; |
| 301 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 302 | constraint->namecxx . . $ Constraint_#name. = "equal string"; |
| 303 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_string_constraintcxx . . $ destroy_string_constraint(f159a969fe179808).; |
| 304 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to equal:\t\t[\"%s\"]"; |
| 305 | |
| 306 | return constraint; |
| 307 | } |
| 308 | |
| 309 | Constraintcxx . . $ Constraint# *create_not_equal_to_string_constraintcxx . . $ create_not_equal_to_string_constraint(6f3cd94f7e4cc57).(const char* expected_value, const char *expected_value_name) { |
| 310 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_string_valuecxx . . $ make_cgreen_string_value(ec756e338d9bee84).(expected_value), expected_value_name); |
| 311 | constraint->typecxx . . $ Constraint_#type. = CGREEN_STRING_COMPARER_CONSTRAINTcxx . . $ CGREEN_STRING_COMPARER_CONSTRAINT.; |
| 312 | |
| 313 | constraint->comparecxx . . $ Constraint_#compare. = &compare_do_not_want_stringcxx . . $ compare_do_not_want_string(967c8d0e1b1425dd).; |
| 314 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 315 | constraint->namecxx . . $ Constraint_#name. = "not equal string"; |
| 316 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_string_constraintcxx . . $ destroy_string_constraint(f159a969fe179808).; |
| 317 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to not equal:\t[\"%s\"]"; |
| 318 | |
| 319 | return constraint; |
| 320 | } |
| 321 | |
| 322 | Constraintcxx . . $ Constraint# *create_contains_string_constraintcxx . . $ create_contains_string_constraint(6f3cd94f7e4cc57).(const char* expected_value, const char *expected_value_name) { |
| 323 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_string_valuecxx . . $ make_cgreen_string_value(ec756e338d9bee84).(expected_value), expected_value_name); |
| 324 | constraint->typecxx . . $ Constraint_#type. = CGREEN_STRING_COMPARER_CONSTRAINTcxx . . $ CGREEN_STRING_COMPARER_CONSTRAINT.; |
| 325 | |
| 326 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_substringcxx . . $ compare_want_substring(967c8d0e1b1425dd).; |
| 327 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 328 | constraint->namecxx . . $ Constraint_#name. = "contain string"; |
| 329 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_string_constraintcxx . . $ destroy_string_constraint(f159a969fe179808).; |
| 330 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to contain:\t\t[\"%s\"]"; |
| 331 | |
| 332 | return constraint; |
| 333 | } |
| 334 | |
| 335 | Constraintcxx . . $ Constraint# *create_does_not_contain_string_constraintcxx . . $ create_does_not_contain_string_constraint(6f3cd94f7e4cc57).(const char* expected_value, const char *expected_value_name) { |
| 336 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_string_valuecxx . . $ make_cgreen_string_value(ec756e338d9bee84).(expected_value), expected_value_name); |
| 337 | constraint->typecxx . . $ Constraint_#type. = CGREEN_STRING_COMPARER_CONSTRAINTcxx . . $ CGREEN_STRING_COMPARER_CONSTRAINT.; |
| 338 | |
| 339 | constraint->comparecxx . . $ Constraint_#compare. = &compare_do_not_want_substringcxx . . $ compare_do_not_want_substring(967c8d0e1b1425dd).; |
| 340 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 341 | constraint->namecxx . . $ Constraint_#name. = "not contain string"; |
| 342 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_string_constraintcxx . . $ destroy_string_constraint(f159a969fe179808).; |
| 343 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to not contain:\t[\"%s\"]"; |
| 344 | |
| 345 | return constraint; |
| 346 | } |
| 347 | |
| 348 | Constraintcxx . . $ Constraint# *create_begins_with_string_constraintcxx . . $ create_begins_with_string_constraint(6f3cd94f7e4cc57).(const char* expected_value, const char *expected_value_name) { |
| 349 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_string_valuecxx . . $ make_cgreen_string_value(ec756e338d9bee84).(expected_value), expected_value_name); |
| 350 | constraint->typecxx . . $ Constraint_#type. = CGREEN_STRING_COMPARER_CONSTRAINTcxx . . $ CGREEN_STRING_COMPARER_CONSTRAINT.; |
| 351 | |
| 352 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_beginning_of_stringcxx . . $ compare_want_beginning_of_string(967c8d0e1b1425dd).; |
| 353 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 354 | constraint->namecxx . . $ Constraint_#name. = "begin with string"; |
| 355 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_string_constraintcxx . . $ destroy_string_constraint(f159a969fe179808).; |
| 356 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to begin with:\t\t[\"%s\"]"; |
| 357 | |
| 358 | return constraint; |
| 359 | } |
| 360 | |
| 361 | Constraintcxx . . $ Constraint# *create_does_not_begin_with_string_constraintcxx . . $ create_does_not_begin_with_string_constraint(6f3cd94f7e4cc57).(const char* expected_value, const char *expected_value_name) { |
| 362 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_string_valuecxx . . $ make_cgreen_string_value(ec756e338d9bee84).(expected_value), expected_value_name); |
| 363 | constraint->typecxx . . $ Constraint_#type. = CGREEN_STRING_COMPARER_CONSTRAINTcxx . . $ CGREEN_STRING_COMPARER_CONSTRAINT.; |
| 364 | |
| 365 | constraint->comparecxx . . $ Constraint_#compare. = &compare_do_not_want_beginning_of_stringcxx . . $ compare_do_not_want_beginning_of_string(967c8d0e1b1425dd).; |
| 366 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 367 | constraint->namecxx . . $ Constraint_#name. = "not begin with string"; |
| 368 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_string_constraintcxx . . $ destroy_string_constraint(f159a969fe179808).; |
| 369 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to not begin with:\t[\"%s\"]"; |
| 370 | |
| 371 | return constraint; |
| 372 | } |
| 373 | |
| 374 | Constraintcxx . . $ Constraint# *create_ends_with_string_constraintcxx . . $ create_ends_with_string_constraint(6f3cd94f7e4cc57).(const char* expected_value, const char *expected_value_name) { |
| 375 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_string_valuecxx . . $ make_cgreen_string_value(ec756e338d9bee84).(expected_value), expected_value_name); |
| 376 | constraint->typecxx . . $ Constraint_#type. = CGREEN_STRING_COMPARER_CONSTRAINTcxx . . $ CGREEN_STRING_COMPARER_CONSTRAINT.; |
| 377 | |
| 378 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_end_of_stringcxx . . $ compare_want_end_of_string(967c8d0e1b1425dd).; |
| 379 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 380 | constraint->namecxx . . $ Constraint_#name. = "end with string"; |
| 381 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_string_constraintcxx . . $ destroy_string_constraint(f159a969fe179808).; |
| 382 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to end with:\t\t[\"%s\"]"; |
| 383 | |
| 384 | return constraint; |
| 385 | } |
| 386 | |
| 387 | Constraintcxx . . $ Constraint# *create_does_not_end_with_string_constraintcxx . . $ create_does_not_end_with_string_constraint(6f3cd94f7e4cc57).(const char* expected_value, const char *expected_value_name) { |
| 388 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_string_valuecxx . . $ make_cgreen_string_value(ec756e338d9bee84).(expected_value), expected_value_name); |
| 389 | constraint->typecxx . . $ Constraint_#type. = CGREEN_STRING_COMPARER_CONSTRAINTcxx . . $ CGREEN_STRING_COMPARER_CONSTRAINT.; |
| 390 | |
| 391 | constraint->comparecxx . . $ Constraint_#compare. = &compare_do_not_want_end_of_stringcxx . . $ compare_do_not_want_end_of_string(967c8d0e1b1425dd).; |
| 392 | constraint->executecxx . . $ Constraint_#execute. = &test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).; |
| 393 | constraint->namecxx . . $ Constraint_#name. = "not end with string"; |
| 394 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_string_constraintcxx . . $ destroy_string_constraint(f159a969fe179808).; |
| 395 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to not end with:\t[\"%s\"]"; |
| 396 | |
| 397 | return constraint; |
| 398 | } |
| 399 | |
| 400 | Constraintcxx . . $ Constraint# *create_equal_to_double_constraintcxx . . $ create_equal_to_double_constraint(fadb8cf50565de40).(double expected_value, const char *expected_value_name) { |
| 401 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_double_valuecxx . . $ make_cgreen_double_value(4e2bf7528ffbaa1f).(expected_value), expected_value_name); |
| 402 | constraint->typecxx . . $ Constraint_#type. = CGREEN_DOUBLE_COMPARER_CONSTRAINTcxx . . $ CGREEN_DOUBLE_COMPARER_CONSTRAINT.; |
| 403 | |
| 404 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_doublecxx . . $ compare_want_double(967c8d0e1b1425dd).; |
| 405 | constraint->executecxx . . $ Constraint_#execute. = &test_want_doublecxx . . $ test_want_double(c0af3e8d8bd2e1e5).; |
| 406 | constraint->namecxx . . $ Constraint_#name. = "equal double"; |
| 407 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_double_constraintcxx . . $ destroy_double_constraint(f159a969fe179808).; |
| 408 | |
| 409 | return constraint; |
| 410 | } |
| 411 | |
| 412 | Constraintcxx . . $ Constraint# *create_not_equal_to_double_constraintcxx . . $ create_not_equal_to_double_constraint(fadb8cf50565de40).(double expected_value, const char *expected_value_name) { |
| 413 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_double_valuecxx . . $ make_cgreen_double_value(4e2bf7528ffbaa1f).(expected_value), expected_value_name); |
| 414 | constraint->typecxx . . $ Constraint_#type. = CGREEN_DOUBLE_COMPARER_CONSTRAINTcxx . . $ CGREEN_DOUBLE_COMPARER_CONSTRAINT.; |
| 415 | |
| 416 | constraint->comparecxx . . $ Constraint_#compare. = &compare_do_not_want_doublecxx . . $ compare_do_not_want_double(967c8d0e1b1425dd).; |
| 417 | constraint->executecxx . . $ Constraint_#execute. = &test_do_not_want_doublecxx . . $ test_do_not_want_double(c0af3e8d8bd2e1e5).; |
| 418 | constraint->namecxx . . $ Constraint_#name. = "not equal double"; |
| 419 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_double_constraintcxx . . $ destroy_double_constraint(f159a969fe179808).; |
| 420 | |
| 421 | return constraint; |
| 422 | } |
| 423 | |
| 424 | Constraintcxx . . $ Constraint# *create_less_than_double_constraintcxx . . $ create_less_than_double_constraint(fadb8cf50565de40).(double expected_value, const char *expected_value_name) { |
| 425 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_double_valuecxx . . $ make_cgreen_double_value(4e2bf7528ffbaa1f).(expected_value), expected_value_name); |
| 426 | constraint->typecxx . . $ Constraint_#type. = CGREEN_DOUBLE_COMPARER_CONSTRAINTcxx . . $ CGREEN_DOUBLE_COMPARER_CONSTRAINT.; |
| 427 | |
| 428 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_lesser_doublecxx . . $ compare_want_lesser_double(967c8d0e1b1425dd).; |
| 429 | constraint->executecxx . . $ Constraint_#execute. = &test_truecxx . . $ test_true(c0af3e8d8bd2e1e5).; |
| 430 | constraint->namecxx . . $ Constraint_#name. = "be less than double"; |
| 431 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_double_constraintcxx . . $ destroy_double_constraint(f159a969fe179808).; |
| 432 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to be less than:\t[%08f]"; |
| 433 | |
| 434 | return constraint; |
| 435 | } |
| 436 | |
| 437 | Constraintcxx . . $ Constraint# *create_greater_than_double_constraintcxx . . $ create_greater_than_double_constraint(fadb8cf50565de40).(double expected_value, const char *expected_value_name) { |
| 438 | Constraintcxx . . $ Constraint# *constraint = create_constraint_expectingcxx . . $ create_constraint_expecting(d70c295f996f6406).(make_cgreen_double_valuecxx . . $ make_cgreen_double_value(4e2bf7528ffbaa1f).(expected_value), expected_value_name); |
| 439 | constraint->typecxx . . $ Constraint_#type. = CGREEN_DOUBLE_COMPARER_CONSTRAINTcxx . . $ CGREEN_DOUBLE_COMPARER_CONSTRAINT.; |
| 440 | |
| 441 | constraint->comparecxx . . $ Constraint_#compare. = &compare_want_greater_doublecxx . . $ compare_want_greater_double(967c8d0e1b1425dd).; |
| 442 | constraint->executecxx . . $ Constraint_#execute. = &test_truecxx . . $ test_true(c0af3e8d8bd2e1e5).; |
| 443 | constraint->namecxx . . $ Constraint_#name. = "be greater than double"; |
| 444 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_double_constraintcxx . . $ destroy_double_constraint(f159a969fe179808).; |
| 445 | constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message. = "\t\texpected to be greater than:\t[%08f]"; |
| 446 | |
| 447 | return constraint; |
| 448 | } |
| 449 | |
| 450 | Constraintcxx . . $ Constraint# *create_return_value_constraintcxx . . $ create_return_value_constraint(af2de55a0c7f27d9).(intptr_tcxx . . $ intptr_t# value_to_return) { |
| 451 | Constraintcxx . . $ Constraint#* constraint = create_constraintcxx . . $ create_constraint(ba55e2de72051eb6).(); |
| 452 | constraint->typecxx . . $ Constraint_#type. = CGREEN_RETURN_VALUE_CONSTRAINTcxx . . $ CGREEN_RETURN_VALUE_CONSTRAINT.; |
| 453 | |
| 454 | constraint->comparecxx . . $ Constraint_#compare. = &compare_truecxx . . $ compare_true(967c8d0e1b1425dd).; |
| 455 | constraint->executecxx . . $ Constraint_#execute. = &test_truecxx . . $ test_true(c0af3e8d8bd2e1e5).; |
| 456 | constraint->namecxx . . $ Constraint_#name. = "return value"; |
| 457 | constraint->expected_valuecxx . . $ Constraint_#expected_value. = make_cgreen_integer_valuecxx . . $ make_cgreen_integer_value(1194b204c86a8e67).(value_to_return); |
| 458 | |
| 459 | return constraint; |
| 460 | } |
| 461 | |
| 462 | Constraintcxx . . $ Constraint# *create_return_by_value_constraintcxx . . $ create_return_by_value_constraint(534124a8f269c22c).(intptr_tcxx . . $ intptr_t# value_to_return, size_t size) { |
| 463 | intptr_tcxx . . $ intptr_t# actual_return = (intptr_tcxx . . $ intptr_t#) malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(size); |
| 464 | memcpycxx . . $ memcpy(cc817cb175f282d).((void*)actual_return, (void*)value_to_return, size); |
| 465 | Constraintcxx . . $ Constraint#* constraint = create_constraintcxx . . $ create_constraint(ba55e2de72051eb6).(); |
| 466 | constraint->typecxx . . $ Constraint_#type. = CGREEN_RETURN_BY_VALUE_CONSTRAINTcxx . . $ CGREEN_RETURN_BY_VALUE_CONSTRAINT.; |
| 467 | |
| 468 | constraint->comparecxx . . $ Constraint_#compare. = &compare_truecxx . . $ compare_true(967c8d0e1b1425dd).; |
| 469 | constraint->executecxx . . $ Constraint_#execute. = &test_truecxx . . $ test_true(c0af3e8d8bd2e1e5).; |
| 470 | constraint->namecxx . . $ Constraint_#name. = "return by value"; |
| 471 | constraint->expected_valuecxx . . $ Constraint_#expected_value. = make_cgreen_by_valuecxx . . $ make_cgreen_by_value(117a48668ad621df).((void*)actual_return, size); |
| 472 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_by_value_constraintcxx . . $ destroy_by_value_constraint(f159a969fe179808).; |
| 473 | |
| 474 | return constraint; |
| 475 | } |
| 476 | |
| 477 | Constraintcxx . . $ Constraint# *create_return_double_value_constraintcxx . . $ create_return_double_value_constraint(7ca4a7f473dbe249).(double value_to_return) { |
| 478 | Constraintcxx . . $ Constraint#* constraint = create_constraintcxx . . $ create_constraint(ba55e2de72051eb6).(); |
| 479 | constraint->typecxx . . $ Constraint_#type. = CGREEN_RETURN_VALUE_CONSTRAINTcxx . . $ CGREEN_RETURN_VALUE_CONSTRAINT.; |
| 480 | |
| 481 | constraint->comparecxx . . $ Constraint_#compare. = &compare_truecxx . . $ compare_true(967c8d0e1b1425dd).; |
| 482 | constraint->executecxx . . $ Constraint_#execute. = &test_truecxx . . $ test_true(c0af3e8d8bd2e1e5).; |
| 483 | constraint->namecxx . . $ Constraint_#name. = "return value"; |
| 484 | constraint->expected_valuecxx . . $ Constraint_#expected_value. = make_cgreen_double_valuecxx . . $ make_cgreen_double_value(4e2bf7528ffbaa1f).(value_to_return); |
| 485 | |
| 486 | return constraint; |
| 487 | } |
| 488 | |
| 489 | Constraintcxx . . $ Constraint# *create_set_parameter_value_constraintcxx . . $ create_set_parameter_value_constraint(ee42e014735632dd).(const char *parameter_name, intptr_tcxx . . $ intptr_t# value_to_set, size_t size_to_set) { |
| 490 | Constraintcxx . . $ Constraint#* constraint = create_constraintcxx . . $ create_constraint(ba55e2de72051eb6).(); |
| 491 | constraint->typecxx . . $ Constraint_#type. = CGREEN_CONTENT_SETTER_CONSTRAINTcxx . . $ CGREEN_CONTENT_SETTER_CONSTRAINT.; |
| 492 | |
| 493 | /* Issue #337: copy the source value now, at expect() time, into an owned |
| 494 | buffer. Storing the source pointer let a local or computed source dangle |
| 495 | before the mock ran (and repeated helper calls reused one stack slot). |
| 496 | The copy is freed via destroy_by_value_constraint when the expectation |
| 497 | is retired -- same pattern as create_return_by_value_constraint(). */ |
| 498 | intptr_tcxx . . $ intptr_t# value_copy = (intptr_tcxx . . $ intptr_t#)malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(size_to_set); |
| 499 | memcpycxx . . $ memcpy(cc817cb175f282d).((void *)value_copy, (void *)value_to_set, size_to_set); |
| 500 | |
| 501 | constraint->comparecxx . . $ Constraint_#compare. = &compare_truecxx . . $ compare_true(967c8d0e1b1425dd).; |
| 502 | constraint->executecxx . . $ Constraint_#execute. = &set_contentscxx . . $ set_contents(c0af3e8d8bd2e1e5).; |
| 503 | constraint->destroycxx . . $ Constraint_#destroy. = &destroy_by_value_constraintcxx . . $ destroy_by_value_constraint(f159a969fe179808).; |
| 504 | constraint->namecxx . . $ Constraint_#name. = "set parameter value"; |
| 505 | constraint->expected_valuecxx . . $ Constraint_#expected_value. = make_cgreen_by_valuecxx . . $ make_cgreen_by_value(117a48668ad621df).((void *)value_copy, size_to_set); |
| 506 | constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value. = size_to_set; |
| 507 | constraint->parameter_namecxx . . $ Constraint_#parameter_name. = parameter_name; |
| 508 | |
| 509 | return constraint; |
| 510 | } |
| 511 | |
| 512 | static void report_unsupported_scalar_sizecxx . . $ report_unsupported_scalar_size(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 513 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter) { |
| 514 | (void)constraint; (void)function; (void)actual; |
| 515 | (*reporter->assert_truecxx . . $ TestReporter_#assert_true.)( |
| 516 | reporter, test_file, test_line, falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, |
| 517 | "will_set_scalar_output_parameter() was given an unsupported scalar size;\n" |
| 518 | "\t\tuse will_set_contents_of_output_parameter() for values wider than 8 bytes or for non-scalars."); |
| 519 | } |
| 520 | |
| 521 | Constraintcxx . . $ Constraint# *create_set_scalar_output_parameter_constraintcxx . . $ create_set_scalar_output_parameter_constraint(ee42e014735632dd).(const char *parameter_name, intmax_tcxx . . $ intmax_t# value, size_t size) { |
| 522 | /* Re-narrow the widened value to a real typed temporary so the stored bytes |
| 523 | are native-endian, then reuse the (copy-at-expect-time) contents setter. |
| 524 | The temporary only has to survive the delegated call, which copies it. */ |
| 525 | switch (size) { |
| 526 | case 1: { int8_tcxx . . $ int8_t# v = (int8_tcxx . . $ int8_t#)value; return create_set_parameter_value_constraintcxx . . $ create_set_parameter_value_constraint(ee42e014735632dd).(parameter_name, (intptr_tcxx . . $ intptr_t#)&v, size); } |
| 527 | case 2: { int16_tcxx . . $ int16_t# v = (int16_tcxx . . $ int16_t#)value; return create_set_parameter_value_constraintcxx . . $ create_set_parameter_value_constraint(ee42e014735632dd).(parameter_name, (intptr_tcxx . . $ intptr_t#)&v, size); } |
| 528 | case 4: { int32_tcxx . . $ int32_t# v = (int32_tcxx . . $ int32_t#)value; return create_set_parameter_value_constraintcxx . . $ create_set_parameter_value_constraint(ee42e014735632dd).(parameter_name, (intptr_tcxx . . $ intptr_t#)&v, size); } |
| 529 | case 8: { int64_tcxx . . $ int64_t# v = (int64_tcxx . . $ int64_t#)value; return create_set_parameter_value_constraintcxx . . $ create_set_parameter_value_constraint(ee42e014735632dd).(parameter_name, (intptr_tcxx . . $ intptr_t#)&v, size); } |
| 530 | default: { |
| 531 | /* Only reachable for scalars wider than intmax_t (e.g. __int128); |
| 532 | report at mock time rather than silently truncating. */ |
| 533 | Constraintcxx . . $ Constraint# *constraint = create_constraintcxx . . $ create_constraint(ba55e2de72051eb6).(); |
| 534 | constraint->typecxx . . $ Constraint_#type. = CGREEN_CONTENT_SETTER_CONSTRAINTcxx . . $ CGREEN_CONTENT_SETTER_CONSTRAINT.; |
| 535 | constraint->comparecxx . . $ Constraint_#compare. = &compare_truecxx . . $ compare_true(967c8d0e1b1425dd).; |
| 536 | constraint->executecxx . . $ Constraint_#execute. = &report_unsupported_scalar_sizecxx . . $ report_unsupported_scalar_size(c0af3e8d8bd2e1e5).; |
| 537 | constraint->namecxx . . $ Constraint_#name. = "set parameter value"; |
| 538 | constraint->parameter_namecxx . . $ Constraint_#parameter_name. = parameter_name; |
| 539 | constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value. = size; |
| 540 | return constraint; |
| 541 | } |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | Constraintcxx . . $ Constraint# *create_with_side_effect_constraintcxx . . $ create_with_side_effect_constraint(7acf2b0273734400).(void (*callback)(void *), void *data) { |
| 546 | Constraintcxx . . $ Constraint#* constraint = create_constraintcxx . . $ create_constraint(ba55e2de72051eb6).(); |
| 547 | constraint->typecxx . . $ Constraint_#type. = CGREEN_CALL_CONSTRAINTcxx . . $ CGREEN_CALL_CONSTRAINT.; |
| 548 | |
| 549 | constraint->namecxx . . $ Constraint_#name. = "cause side effect"; |
| 550 | constraint->side_effect_callbackcxx . . $ Constraint_#side_effect_callback. = callback; |
| 551 | constraint->side_effect_datacxx . . $ Constraint_#side_effect_data. = data; |
| 552 | constraint->executecxx . . $ Constraint_#execute. = &execute_sideeffectcxx . . $ execute_sideeffect(c0af3e8d8bd2e1e5).; |
| 553 | |
| 554 | return constraint; |
| 555 | } |
| 556 | |
| 557 | Constraintcxx . . $ Constraint# *create_capture_parameter_constraintcxx . . $ create_capture_parameter_constraint(3cf1c2da969278e8).(const char *parameter_name, void *capture_to, size_t size_to_capture) { |
| 558 | Constraintcxx . . $ Constraint#* constraint = create_constraintcxx . . $ create_constraint(ba55e2de72051eb6).(); |
| 559 | constraint->typecxx . . $ Constraint_#type. = CGREEN_CAPTURE_PARAMETER_CONSTRAINTcxx . . $ CGREEN_CAPTURE_PARAMETER_CONSTRAINT.; |
| 560 | |
| 561 | constraint->comparecxx . . $ Constraint_#compare. = &compare_truecxx . . $ compare_true(967c8d0e1b1425dd).; |
| 562 | constraint->executecxx . . $ Constraint_#execute. = &capture_parametercxx . . $ capture_parameter(c0af3e8d8bd2e1e5).; |
| 563 | constraint->namecxx . . $ Constraint_#name. = "capture parameter"; |
| 564 | constraint->expected_valuecxx . . $ Constraint_#expected_value. = make_cgreen_pointer_valuecxx . . $ make_cgreen_pointer_value(32799a8d7b9a4e33).(capture_to); |
| 565 | constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value. = size_to_capture; |
| 566 | constraint->parameter_namecxx . . $ Constraint_#parameter_name. = parameter_name; |
| 567 | |
| 568 | return constraint; |
| 569 | } |
| 570 | |
| 571 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_valuecxx . . $ compare_want_value(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 572 | return constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value. == actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value.; |
| 573 | } |
| 574 | |
| 575 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_valuecxx . . $ compare_do_not_want_value(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 576 | return !compare_want_valuecxx . . $ compare_want_value(967c8d0e1b1425dd).(constraint, actual); |
| 577 | } |
| 578 | |
| 579 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_greater_valuecxx . . $ compare_want_greater_value(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 580 | return actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value. > constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value. ; |
| 581 | } |
| 582 | |
| 583 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_lesser_valuecxx . . $ compare_want_lesser_value(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 584 | return actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value. < constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value.; |
| 585 | } |
| 586 | |
| 587 | |
| 588 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_contentscxx . . $ compare_want_contents(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 589 | /* We can't inspect the contents of a NULL pointer, so comparison always fails */ |
| 590 | /* TODO: This should really be .pointer_value */ |
| 591 | if ((void *)actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 592 | return 0; |
| 593 | } |
| 594 | |
| 595 | return 0 == memcmpcxx . . $ memcmp(36f949851efa3055).(constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..pointer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#pointer_value., |
| 596 | (void *)actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value., constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value.); |
| 597 | } |
| 598 | |
| 599 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_contentscxx . . $ compare_do_not_want_contents(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 600 | /* we can't inspect the contents of a NULL pointer, so comparison always fails */ |
| 601 | if ((void *)actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 602 | return 0; |
| 603 | } |
| 604 | |
| 605 | return !compare_want_contentscxx . . $ compare_want_contents(967c8d0e1b1425dd).(constraint, actual); |
| 606 | } |
| 607 | |
| 608 | static void set_contentscxx . . $ set_contents(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 609 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter) { |
| 610 | char *message; |
| 611 | (void)function; |
| 612 | |
| 613 | /* TODO: should propagate the whole actual */ |
| 614 | if (parameters_are_not_valid_forcxx . . $ parameters_are_not_valid_for(908815a3afc9f0a1).(constraint, actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value.)) { |
| 615 | message = validation_failure_message_forcxx . . $ validation_failure_message_for(61ddab92ee18b24e).(constraint, actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value.); |
| 616 | (*reporter->assert_truecxx . . $ TestReporter_#assert_true.)( |
| 617 | reporter, |
| 618 | test_file, |
| 619 | test_line, |
| 620 | falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, |
| 621 | message); |
| 622 | |
| 623 | freecxx . . $ free(5d22bdacc48458e8).(message); |
| 624 | return; |
| 625 | } |
| 626 | |
| 627 | if (actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..pointer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#pointer_value. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 628 | return; /* Issue #202: a NULL out-parameter is a no-op, not a crash */ |
| 629 | } |
| 630 | |
| 631 | memmovecxx . . $ memmove(cc817cb175f282d).((void *)actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..pointer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#pointer_value., constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..pointer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#pointer_value., constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value.); |
| 632 | } |
| 633 | |
| 634 | static void execute_sideeffectcxx . . $ execute_sideeffect(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 635 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter) { |
| 636 | (void)function; |
| 637 | (void)actual; |
| 638 | |
| 639 | if (constraint->side_effect_callbackcxx . . $ Constraint_#side_effect_callback. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 640 | (*reporter->assert_truecxx . . $ TestReporter_#assert_true.)( |
| 641 | reporter, |
| 642 | test_file, |
| 643 | test_line, |
| 644 | falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, |
| 645 | "no side effect function was set"); |
| 646 | } |
| 647 | (constraint->side_effect_callbackcxx . . $ Constraint_#side_effect_callback.)(constraint->side_effect_datacxx . . $ Constraint_#side_effect_data.); |
| 648 | } |
| 649 | |
| 650 | #define IS_BIG_ENDIANcxx . . $ `src/constraint.c:650:9`! (!*(unsigned char *)&(uint16_t){1}) |
| 651 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! bigendiancxx . . $ bigendian(c9857a73d68e59ba).(void) { return IS_BIG_ENDIANcxx . . $ `src/constraint.c:650:9`!; } |
| 652 | |
| 653 | static void capture_parametercxx . . $ capture_parameter(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 654 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter) { |
| 655 | (void)function; |
| 656 | (void)test_file; |
| 657 | (void)test_line; |
| 658 | (void)reporter; |
| 659 | |
| 660 | if ((sizeof(intptr_tcxx . . $ intptr_t#) != constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value.) && bigendiancxx . . $ bigendian(c9857a73d68e59ba).()) { |
| 661 | // Then the beginning of a smaller value is not stored at the beginning of the actual.value union |
| 662 | size_t offset = sizeof(intptr_tcxx . . $ intptr_t#) - constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value.; |
| 663 | // Offset is in bytes so we need to cast &actual.value to that before adding the offset |
| 664 | void *start_address = (unsigned char *)&actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value. + offset; |
| 665 | memmovecxx . . $ memmove(cc817cb175f282d).(constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..pointer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#pointer_value., start_address, constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value.); |
| 666 | |
| 667 | } else |
| 668 | memmovecxx . . $ memmove(cc817cb175f282d).(constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..pointer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#pointer_value., &actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value., |
| 669 | constraint->size_of_expected_valuecxx . . $ Constraint_#size_of_expected_value.); |
| 670 | } |
| 671 | |
| 672 | |
| 673 | void test_wantcxx . . $ test_want(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 674 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter) { |
| 675 | char *message; |
| 676 | char parameter_name_actual_string[255]; |
| 677 | |
| 678 | if (parameters_are_not_valid_forcxx . . $ parameters_are_not_valid_for(908815a3afc9f0a1).(constraint, actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value.)) { |
| 679 | message = validation_failure_message_forcxx . . $ validation_failure_message_for(61ddab92ee18b24e).(constraint, actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value.); |
| 680 | |
| 681 | (*reporter->assert_truecxx . . $ TestReporter_#assert_true.)( |
| 682 | reporter, |
| 683 | test_file, |
| 684 | test_line, |
| 685 | falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!, |
| 686 | message); |
| 687 | |
| 688 | freecxx . . $ free(5d22bdacc48458e8).(message); |
| 689 | |
| 690 | return; |
| 691 | } |
| 692 | |
| 693 | snprintfcxx . . $ snprintf(ea502d73e74c754c).(parameter_name_actual_string, sizeof(parameter_name_actual_string) - 1, "[%s] parameter in [%s]", constraint->parameter_namecxx . . $ Constraint_#parameter_name., function); |
| 694 | message = constraint->failure_messagecxx . . $ Constraint_#failure_message.(constraint, parameter_name_actual_string, actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..integer_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#integer_value.); |
| 695 | |
| 696 | (*reporter->assert_truecxx . . $ TestReporter_#assert_true.)( |
| 697 | reporter, |
| 698 | test_file, |
| 699 | test_line, |
| 700 | (*constraint->comparecxx . . $ Constraint_#compare.)(constraint, actual), |
| 701 | message); |
| 702 | |
| 703 | freecxx . . $ free(5d22bdacc48458e8).(message); |
| 704 | } |
| 705 | |
| 706 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_stringcxx . . $ compare_want_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 707 | return strings_are_equalcxx . . $ strings_are_equal(b7a7aa4a824b7595).(constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value., actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value.); |
| 708 | } |
| 709 | |
| 710 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_stringcxx . . $ compare_do_not_want_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 711 | return !compare_want_stringcxx . . $ compare_want_string(967c8d0e1b1425dd).(constraint, actual); |
| 712 | } |
| 713 | |
| 714 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_substringcxx . . $ compare_do_not_want_substring(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 715 | return !compare_want_substringcxx . . $ compare_want_substring(967c8d0e1b1425dd).(constraint, actual); |
| 716 | } |
| 717 | |
| 718 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_substringcxx . . $ compare_want_substring(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 719 | return string_containscxx . . $ string_contains(b7a7aa4a824b7595).(actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value., constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value.); |
| 720 | } |
| 721 | |
| 722 | |
| 723 | const unsigned int NOT_FOUNDcxx . . $ NOT_FOUND. = UINT_MAXcxx . . $ `<external>/2419331716647297546/limits.h:124:9`!; |
| 724 | |
| 725 | static unsigned int strposcxx . . $ strpos(d4414ff42889198).(const char *haystack, const char *needle) |
| 726 | { |
| 727 | const char *offset = strstrcxx . . $ strstr(a713fe7b9a57cf96).(haystack, needle); |
| 728 | if (offset != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) { |
| 729 | return offset - haystack; |
| 730 | } |
| 731 | |
| 732 | return NOT_FOUNDcxx . . $ NOT_FOUND.; |
| 733 | } |
| 734 | |
| 735 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_beginning_of_stringcxx . . $ compare_want_beginning_of_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 736 | return strposcxx . . $ strpos(d4414ff42889198).(actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value., constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value.) == 0; |
| 737 | } |
| 738 | |
| 739 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_beginning_of_stringcxx . . $ compare_do_not_want_beginning_of_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 740 | return strposcxx . . $ strpos(d4414ff42889198).(actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value., constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value.) != 0; |
| 741 | } |
| 742 | |
| 743 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_end_of_stringcxx . . $ compare_want_end_of_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 744 | int match_length = strlencxx . . $ strlen(751346f8406fd082).(constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value.); |
| 745 | int start_position = strlencxx . . $ strlen(751346f8406fd082).(actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value.) - match_length; |
| 746 | if (start_position < 0) |
| 747 | return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 748 | return strcmpcxx . . $ strcmp(5ae29d726ae57f88).(&actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value.[start_position], constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value.) == 0; |
| 749 | } |
| 750 | |
| 751 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_end_of_stringcxx . . $ compare_do_not_want_end_of_string(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 752 | return !compare_want_end_of_stringcxx . . $ compare_want_end_of_string(967c8d0e1b1425dd).(constraint, actual); |
| 753 | } |
| 754 | |
| 755 | |
| 756 | |
| 757 | // Double |
| 758 | |
| 759 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_doublecxx . . $ compare_want_double(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 760 | return doubles_are_equalcxx . . $ doubles_are_equal(828b76dce88fac).(constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..double_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#double_value., actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..double_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#double_value.); |
| 761 | } |
| 762 | |
| 763 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_lesser_doublecxx . . $ compare_want_lesser_double(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 764 | return double_is_lessercxx . . $ double_is_lesser(828b76dce88fac).(constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..double_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#double_value., actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..double_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#double_value.); |
| 765 | } |
| 766 | |
| 767 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_want_greater_doublecxx . . $ compare_want_greater_double(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 768 | return double_is_greatercxx . . $ double_is_greater(828b76dce88fac).(constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..double_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#double_value., actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..double_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#double_value.); |
| 769 | } |
| 770 | |
| 771 | static void test_want_doublecxx . . $ test_want_double(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 772 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter) { |
| 773 | (*reporter->assert_truecxx . . $ TestReporter_#assert_true.)( |
| 774 | reporter, |
| 775 | test_file, |
| 776 | test_line, |
| 777 | (*constraint->comparecxx . . $ Constraint_#compare.)(constraint, actual), |
| 778 | "Wanted [%f], but got [%f] in function [%s] parameter [%s]", |
| 779 | constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..double_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#double_value., |
| 780 | actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..double_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#double_value., |
| 781 | function, |
| 782 | constraint->parameter_namecxx . . $ Constraint_#parameter_name.); |
| 783 | } |
| 784 | |
| 785 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_do_not_want_doublecxx . . $ compare_do_not_want_double(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 786 | return !compare_want_doublecxx . . $ compare_want_double(967c8d0e1b1425dd).(constraint, actual); |
| 787 | } |
| 788 | |
| 789 | static void test_do_not_want_doublecxx . . $ test_do_not_want_double(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 790 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter) { |
| 791 | (*reporter->assert_truecxx . . $ TestReporter_#assert_true.)( |
| 792 | reporter, |
| 793 | test_file, |
| 794 | test_line, |
| 795 | (*constraint->comparecxx . . $ Constraint_#compare.)(constraint, actual), |
| 796 | "Did not want [%f], but got [%f] in function [%s] parameter [%s]", |
| 797 | constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..double_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#double_value., |
| 798 | actual.valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..double_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#double_value., |
| 799 | function, |
| 800 | constraint->parameter_namecxx . . $ Constraint_#parameter_name.); |
| 801 | } |
| 802 | |
| 803 | void destroy_double_constraintcxx . . $ destroy_double_constraint(f159a969fe179808).(Constraintcxx . . $ Constraint# *constraint) { |
| 804 | destroy_empty_constraintcxx . . $ destroy_empty_constraint(f159a969fe179808).(constraint); |
| 805 | } |
| 806 | |
| 807 | void destroy_string_constraintcxx . . $ destroy_string_constraint(f159a969fe179808).(Constraintcxx . . $ Constraint# *constraint) { |
| 808 | destroy_cgreen_valuecxx . . $ destroy_cgreen_value(2cf67620db0eb1fe).(constraint->expected_valuecxx . . $ Constraint_#expected_value.); |
| 809 | destroy_empty_constraintcxx . . $ destroy_empty_constraint(f159a969fe179808).(constraint); |
| 810 | } |
| 811 | |
| 812 | void destroy_by_value_constraintcxx . . $ destroy_by_value_constraint(f159a969fe179808).(Constraintcxx . . $ Constraint# *constraint) { |
| 813 | // TODO: we should return the allocated area, but that conflicts with reporter printing it |
| 814 | // Now, how does the string constraints do it? |
| 815 | destroy_cgreen_valuecxx . . $ destroy_cgreen_value(2cf67620db0eb1fe).(constraint->expected_valuecxx . . $ Constraint_#expected_value.); |
| 816 | destroy_empty_constraintcxx . . $ destroy_empty_constraint(f159a969fe179808).(constraint); |
| 817 | } |
| 818 | |
| 819 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! compare_truecxx . . $ compare_true(967c8d0e1b1425dd).(Constraintcxx . . $ Constraint# *constraint, CgreenValuecxx . . $ CgreenValue# actual) { |
| 820 | (void)constraint; |
| 821 | (void)actual; |
| 822 | |
| 823 | return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 824 | } |
| 825 | |
| 826 | static void test_truecxx . . $ test_true(c0af3e8d8bd2e1e5).(Constraintcxx . . $ Constraint# *constraint, const char *function, CgreenValuecxx . . $ CgreenValue# actual, |
| 827 | const char *test_file, int test_line, TestReportercxx . . $ TestReporter# *reporter) { |
| 828 | (void)constraint; |
| 829 | (void)function; |
| 830 | (void)actual; |
| 831 | (void)test_file; |
| 832 | (void)test_line; |
| 833 | (void)reporter; |
| 834 | } |
| 835 | |
| 836 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! values_are_strings_incxx . . $ values_are_strings_in(1ba69099f960dda3).(const Constraintcxx . . $ Constraint# *constraint) { |
| 837 | return is_string_comparingcxx . . $ is_string_comparing(1ba69099f960dda3).(constraint) && |
| 838 | (constraint->expected_valuecxx . . $ Constraint_#expected_value..valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#value..string_valuecxx . . $ $anonymous_type_b16cac6eed758fe0_1#$anonymous_type_2#string_value. != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!); |
| 839 | } |
| 840 | |
| 841 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! no_expected_value_incxx . . $ no_expected_value_in(1ba69099f960dda3).(const Constraintcxx . . $ Constraint# *constraint) { |
| 842 | return strlencxx . . $ strlen(751346f8406fd082).(constraint->expected_value_messagecxx . . $ Constraint_#expected_value_message.) == 0; |
| 843 | } |
| 844 | |
| 845 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_content_comparingcxx . . $ is_content_comparing(1ba69099f960dda3).(const Constraintcxx . . $ Constraint# *constraint) { |
| 846 | return constraint->typecxx . . $ Constraint_#type. == CGREEN_CONTENT_COMPARER_CONSTRAINTcxx . . $ CGREEN_CONTENT_COMPARER_CONSTRAINT.; |
| 847 | } |
| 848 | |
| 849 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_content_settingcxx . . $ is_content_setting(1ba69099f960dda3).(const Constraintcxx . . $ Constraint# *constraint) { |
| 850 | return constraint->typecxx . . $ Constraint_#type. == CGREEN_CONTENT_SETTER_CONSTRAINTcxx . . $ CGREEN_CONTENT_SETTER_CONSTRAINT.; |
| 851 | } |
| 852 | |
| 853 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_not_content_settingcxx . . $ is_not_content_setting(1ba69099f960dda3).(const Constraintcxx . . $ Constraint# *constraint) { |
| 854 | return !is_content_settingcxx . . $ is_content_setting(1ba69099f960dda3).(constraint); |
| 855 | } |
| 856 | |
| 857 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_string_comparingcxx . . $ is_string_comparing(1ba69099f960dda3).(const Constraintcxx . . $ Constraint# *constraint) { |
| 858 | return constraint->typecxx . . $ Constraint_#type. == CGREEN_STRING_COMPARER_CONSTRAINTcxx . . $ CGREEN_STRING_COMPARER_CONSTRAINT.; |
| 859 | } |
| 860 | |
| 861 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_double_comparingcxx . . $ is_double_comparing(1ba69099f960dda3).(const Constraintcxx . . $ Constraint# *constraint) { |
| 862 | return constraint->typecxx . . $ Constraint_#type. == CGREEN_DOUBLE_COMPARER_CONSTRAINTcxx . . $ CGREEN_DOUBLE_COMPARER_CONSTRAINT.; |
| 863 | } |
| 864 | |
| 865 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_comparingcxx . . $ is_comparing(1ba69099f960dda3).(const Constraintcxx . . $ Constraint# *constraint) { |
| 866 | return is_string_comparingcxx . . $ is_string_comparing(1ba69099f960dda3).(constraint) || |
| 867 | is_content_comparingcxx . . $ is_content_comparing(1ba69099f960dda3).(constraint) || |
| 868 | is_double_comparingcxx . . $ is_double_comparing(1ba69099f960dda3).(constraint) || |
| 869 | constraint->typecxx . . $ Constraint_#type. == CGREEN_VALUE_COMPARER_CONSTRAINTcxx . . $ CGREEN_VALUE_COMPARER_CONSTRAINT. || |
| 870 | constraint->typecxx . . $ Constraint_#type. == CGREEN_CAPTURE_PARAMETER_CONSTRAINTcxx . . $ CGREEN_CAPTURE_PARAMETER_CONSTRAINT.; |
| 871 | } |
| 872 | |
| 873 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_not_comparingcxx . . $ is_not_comparing(1ba69099f960dda3).(const Constraintcxx . . $ Constraint# *constraint) { |
| 874 | return !is_comparingcxx . . $ is_comparing(1ba69099f960dda3).(constraint); |
| 875 | } |
| 876 | |
| 877 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! is_parametercxx . . $ is_parameter(1ba69099f960dda3).(const Constraintcxx . . $ Constraint# *constraint) { |
| 878 | return is_comparingcxx . . $ is_comparing(1ba69099f960dda3).(constraint) || is_content_settingcxx . . $ is_content_setting(1ba69099f960dda3).(constraint); |
| 879 | } |
| 880 | |
| 881 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! constraint_is_for_parameter_incxx . . $ constraint_is_for_parameter_in(74f87f4455e42aa1).(const Constraintcxx . . $ Constraint# *constraint, const char *names) { |
| 882 | int i; |
| 883 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! found = falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 884 | |
| 885 | CgreenVectorcxx . . $ CgreenVector# *parameter_names = create_vector_of_namescxx . . $ create_vector_of_names(d5a3278d3d52ae11).(names); |
| 886 | if (!is_parametercxx . . $ is_parameter(1ba69099f960dda3).(constraint)) return falsecxx . . $ `<external>/13015445228558014418/stdbool.h:38:9`!; |
| 887 | |
| 888 | for (i = 0; i < cgreen_vector_sizecxx . . $ cgreen_vector_size(d6a9fa4a29061fe2).(parameter_names); i++) { |
| 889 | const char *mock_parameter_name = (const char *)cgreen_vector_getcxx . . $ cgreen_vector_get(3d562d97df0b0b67).(parameter_names, i); |
| 890 | |
| 891 | if (constraint_is_for_parametercxx . . $ constraint_is_for_parameter(74f87f4455e42aa1).(constraint, mock_parameter_name)) { |
| 892 | found = truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 893 | break; |
| 894 | } |
| 895 | } |
| 896 | |
| 897 | destroy_cgreen_vectorcxx . . $ destroy_cgreen_vector(fe9e7a16718af6c0).(parameter_names); |
| 898 | return found; |
| 899 | } |
| 900 | |
| 901 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! doubles_are_equalcxx . . $ doubles_are_equal(828b76dce88fac).(double tried, double expected) { |
| 902 | double abs_diff = fabs(tried - expected); |
| 903 | if (abs_diff < absolute_tolerancecxx . . $ absolute_tolerance.) return truecxx . . $ `<external>/13015445228558014418/stdbool.h:37:9`!; |
| 904 | return abs_diff < accuracycxx . . $ accuracy(538a8530131fd110).(significant_figurescxx . . $ significant_figures., maxcxx . . $ `src/constraint.c:41:9`!(fabs(tried), fabs(expected))); |
| 905 | } |
| 906 | |
| 907 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! double_is_lessercxx . . $ double_is_lesser(828b76dce88fac).(double actual, double expected) { |
| 908 | return expected < actual + accuracycxx . . $ accuracy(538a8530131fd110).(significant_figurescxx . . $ significant_figures., maxcxx . . $ `src/constraint.c:41:9`!(actual, expected)); |
| 909 | } |
| 910 | |
| 911 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! double_is_greatercxx . . $ double_is_greater(828b76dce88fac).(double actual, double expected) { |
| 912 | return expected > actual - accuracycxx . . $ accuracy(538a8530131fd110).(significant_figurescxx . . $ significant_figures., maxcxx . . $ `src/constraint.c:41:9`!(actual, expected)); |
| 913 | } |
| 914 | |
| 915 | static double accuracycxx . . $ accuracy(538a8530131fd110).(int figures, double largest) { |
| 916 | return pow(10.0, 1.0 + floor(log10(fabs(largest))) - figures); |
| 917 | } |
| 918 | |
| 919 | void significant_figures_for_assert_double_arecxx . . $ significant_figures_for_assert_double_are(d4f767463ce0a6b3).(int figures) { |
| 920 | significant_figurescxx . . $ significant_figures. = figures; |
| 921 | } |
| 922 | |
| 923 | int get_significant_figurescxx . . $ get_significant_figures(b126dc7c1de90089).(void) { |
| 924 | return significant_figurescxx . . $ significant_figures.; |
| 925 | } |
| 926 | |
| 927 | /* vim: set ts=4 sw=4 et cindent: */ |