cmoon::test::assert_is


Defined in module <cmoon.test>


template<class T>
void assert_is(const T& first, const T& second, std::string_view message = "", const std::source_location& location = std::source_location::current());


(1)

Throws an assert_exception if first and second are not the same object (located at the same memory address).

Parameters

first - First object in the comparison
second - Second object in the comparison
message - Extra information to be added to the error message
location - Information about where in the file this assertion was ran

Return value

(none)

Example



import cmoon.test;

class example_test : public cmoon::test::test_case
{
    public:
        example_test()
            : cmoon::test::test_case{"example test"} {}

        void operator()() override
        {
            int value {3};
            int& value_ref {value};

            cmoon::test::assert_is(value, value_ref);
        }
};