Mjolnir Core
Core functionality of the Mjolnir API

◆ EXPECT_NUM_NEW_EQ

#define EXPECT_NUM_NEW_EQ (   num_new_exp)    EXPECT_EQ(new_delete_counter.get_num_new_calls(), num_new_exp)

Check if the number of new calls are equal to the passed number.

Requires a variable with name new_delete_counter and the type NewDeleteCounter that is valid in the current scope. The macro COUNT_NEW_AND_DELETE performs the required initialization. This macro should only be used in a test using gtest.h and relies on EXPECT_EQ. The test is passed if the number of new calls since the macro COUNT_NEW_AND_DELETE was used is equal to the passed number. Otherwise, the test fails.

If DISABLE_NEW_DELETE_COUNTER is defined, this macro does nothing.

Parameters
num_new_expExpected number of new calls
Remarks
In case that a check fails, EXPECT_EQ will perform a lot of allocations. In result, all subsequent checks will not only fail too but the presented number of calls will also be significantly higher than expected.