Mjolnir Core
Core functionality of the Mjolnir API
Classes | Macros
new_delete_counter.h File Reference

Contains a class that keeps track of the number of new and delete calls. More...

#include "mjolnir/core/fundamental_types.h"
#include <atomic>
#include <iostream>
Include dependency graph for new_delete_counter.h:

Go to the source code of this file.

Classes

class  NewDeleteCounter
 Counts the number of new and delete calls since the instance was created. More...
 

Macros

#define ASSERT_NUM_DELETE_EQ(num_delete_exp)   ASSERT_EQ(new_delete_counter.get_num_delete_calls(), num_delete_exp)
 Assert that the number of delete calls are equal to the passed number. More...
 
#define ASSERT_NUM_NEW_AND_DELETE_EQ(num_new_exp, num_delete_exp)
 Check if the number of new and delete calls are equal to the passed numbers. More...
 
#define ASSERT_NUM_NEW_EQ(num_new_exp)   ASSERT_EQ(new_delete_counter.get_num_new_calls(), num_new_exp)
 Assert the number of new calls are equal to the passed number. More...
 
#define COUNT_NEW_AND_DELETE   auto new_delete_counter = NewDeleteCounter()
 Creates a new NewDeleteCounter and stores it in a variable with a specific name that is needed by other macros. More...
 
#define EXPECT_NUM_DELETE_EQ(num_delete_exp)   EXPECT_EQ(new_delete_counter.get_num_delete_calls(), num_delete_exp)
 Check if the number of delete calls are equal to the passed number. More...
 
#define EXPECT_NUM_NEW_AND_DELETE_EQ(num_new_exp, num_delete_exp)
 Check if the number of new and delete calls are equal to the passed numbers. More...
 
#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. More...
 

Detailed Description

Contains a class that keeps track of the number of new and delete calls.

new_delete_counter.h