Skip to content

Latest commit

 

History

History
22 lines (14 loc) · 613 Bytes

File metadata and controls

22 lines (14 loc) · 613 Bytes

assert_equal

Asserts that two values are equal.

For normal values, both arguments must have the same unqualified type and are compared with operator==. C string forms are handled specially so text is compared instead of pointer identity. This allows practical checks like comparing char const* with a string literal.

#include <string>

#include <kaycxx/assert.hpp>

using namespace kaycxx::assert;

int main() {
    assert_equal(40 + 2, 42);

    auto name = std::string{"Kay"};
    assert_equal(name, "Kay");
}

On failure, the exception message includes rendered actual and expected values.