Mjolnir Core
Core functionality of the Mjolnir API

◆ ASSERT_NUM_NEW_AND_DELETE_EQ

#define ASSERT_NUM_NEW_AND_DELETE_EQ (   num_new_exp,
  num_delete_exp 
)
Value:
ASSERT_NUM_NEW_EQ(num_new_exp); \
ASSERT_NUM_DELETE_EQ(num_delete_exp)
#define ASSERT_NUM_NEW_EQ(num_new_exp)
Assert the number of new calls are equal to the passed number.
Definition: new_delete_counter.h:84

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

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 and delete calls since the macro COUNT_NEW_AND_DELETE was used are equal to the passed numbers. Otherwise, the test fails.

If DISABLE_NEW_DELETE_COUNTER is defined, this macro does nothing.

Parameters
num_new_expExpected number of new calls
num_delete_expExpected number of delete calls