| 135 | // TODO: magic so this works even if const-ness doesn't not match. |
| 136 | template <typename T, typename U> |
| 137 | void assert_num_impl(char const* a_nm, |
| 138 | T const& a, |
| 139 | assert_op op, |
| 140 | char const* b_nm, |
| 141 | U const& b, |
| 142 | char const* file, |
| 143 | int line) { |
| 144 | bool success; |
| 145 | char const* op_name; |
| 146 | switch (op) { |
| 147 | case EQ: |
| 148 | success = a == b; |
| 149 | op_name = "=="; |
| 150 | break; |
| 151 | case NE: |
| 152 | success = a != b; |
| 153 | op_name = "!="; |
| 154 | break; |
| 155 | case LT: |
| 156 | success = a < b; |
| 157 | op_name = "<"; |
| 158 | break; |
| 159 | case GT: |
| 160 | success = a > b; |
| 161 | op_name = ">"; |
| 162 | break; |
| 163 | case LE: |
| 164 | success = a <= b; |
| 165 | op_name = "<="; |
| 166 | break; |
| 167 | case GE: |
| 168 | success = a >= b; |
| 169 | op_name = ">="; |
| 170 | break; |
| 171 | default: |
| 172 | success = false; |
| 173 | op_name = "UNKNOWN OP"; |
| 174 | } |
| 175 | |
| 176 | if (!success) { |
| 177 | throw internal_error_impl(a_nm, (long long)a, op_name, b_nm, (long long)b, file, line); |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | #define ASSERT_EQ(a, b) \ |
| 182 | do { \ |
nothing calls this directly
no test coverage detected