| 500 | /// If the failedOpStr is not set, it means it hasn't failed |
| 501 | template<typename TCmpHelper, typename TLhs, typename TRhs> |
| 502 | inline std::optional<std::string> createBinaryMessage(std::string_view lhsStr, std::string_view rhsStr, const TLhs& lhs, const TRhs& rhs) |
| 503 | { |
| 504 | // don't bother creating message when it won't be used |
| 505 | if (TCmpHelper::compare(lhs, rhs)) |
| 506 | return std::optional<std::string>{}; |
| 507 | size_t maxSize = std::max(lhsStr.size(), rhsStr.size()); |
| 508 | return fmt::format( |
| 509 | "Expected: ({}) {} ({}), actual:\n {:<{}} = {}\n {:<{}} = {}", |
| 510 | lhsStr, |
| 511 | TCmpHelper::asString(), |
| 512 | rhsStr, |
| 513 | lhsStr, |
| 514 | maxSize, |
| 515 | lhs, |
| 516 | rhsStr, |
| 517 | maxSize, |
| 518 | rhs |
| 519 | ); |
| 520 | } |
| 521 | |
| 522 | #define FTEST_TEST_BINARY(opHelper, lhs, rhs, userFailMsg, asserts) \ |
| 523 | FTEST_MESSAGE(::Falcor::unittest::createBinaryMessage<::Falcor::unittest::opHelper>(#lhs, #rhs, lhs, rhs), userFailMsg, asserts) |