TEST(TestHarness_c, callocShouldReturnNULLWhenOutOfMeory)
{
	cpputest_malloc_set_out_of_memory_countdown(0);
	void * m = cpputest_calloc(1, 1);
	CHECK(m == 0);
	cpputest_malloc_set_not_out_of_memory();
}
TEST(TestHarness_c, cpputest_malloc_out_of_memory_after_0_mallocs)
{
	cpputest_malloc_set_out_of_memory_countdown(0);
	void * m1 = cpputest_malloc(10);
	CHECK(m1 == 0);
	cpputest_malloc_set_not_out_of_memory();
}
TEST(TestHarness_c, cpputest_malloc_out_of_memory_after_n_mallocs)
{
	cpputest_malloc_set_out_of_memory_countdown(3);
	void * m1 = cpputest_malloc(10);
	void * m2 = cpputest_malloc(11);
	void * m3 = cpputest_malloc(12);
	CHECK(m1);
	CHECK(m2);
	POINTERS_EQUAL(0, m3);
	cpputest_malloc_set_not_out_of_memory();
	cpputest_free(m1);
	cpputest_free(m2);
}
TEST(TestHarness_c, cpputest_malloc_out_of_memory_after_n_mallocs)
{
    cpputest_malloc_set_out_of_memory_countdown(3);
    void * m1 = cpputest_malloc(10);
    void * m2 = cpputest_malloc(11);
    void * m3 = cpputest_malloc(12);
    CHECK(m1 != NULLPTR);
    CHECK(m2 != NULLPTR);
    CHECK(m3 == NULLPTR);
    cpputest_malloc_set_not_out_of_memory();
    cpputest_free(m1);
    cpputest_free(m2);
}