From 36ee2d21111560fa4ecf670e0b59d3d8573b52de Mon Sep 17 00:00:00 2001 From: jsalling Date: Tue, 9 Feb 2016 10:36:33 -0600 Subject: [PATCH] Add test for setting max number of pointers in Fixture --- extras/fixture/test/unity_fixture_Test.c | 20 +++++++++++++++++++ .../fixture/test/unity_fixture_TestRunner.c | 1 + 2 files changed, 21 insertions(+) diff --git a/extras/fixture/test/unity_fixture_Test.c b/extras/fixture/test/unity_fixture_Test.c index 0527fbe..2a16e2d 100644 --- a/extras/fixture/test/unity_fixture_Test.c +++ b/extras/fixture/test/unity_fixture_Test.c @@ -422,6 +422,26 @@ TEST(LeakDetection, BufferGuardWriteFoundDuringRealloc) #endif } +TEST(LeakDetection, PointerSettingMax) +{ +#ifndef USING_OUTPUT_SPY + UNITY_PRINT_EOL(); + TEST_IGNORE(); +#else + int i; + for (i = 0; i < 50; i++) UT_PTR_SET(pointer1, &int1); + UnityOutputCharSpy_Enable(1); + EXPECT_ABORT_BEGIN + UT_PTR_SET(pointer1, &int1); + EXPECT_ABORT_END + UnityOutputCharSpy_Enable(0); + Unity.CurrentTestFailed = 0; + CHECK(strstr(UnityOutputCharSpy_Get(), "Too many pointers set")); +#endif +} + +//------------------------------------------------------------ + TEST_GROUP(InternalMalloc); TEST_SETUP(InternalMalloc) { } diff --git a/extras/fixture/test/unity_fixture_TestRunner.c b/extras/fixture/test/unity_fixture_TestRunner.c index bc0bf5a..e0b5684 100644 --- a/extras/fixture/test/unity_fixture_TestRunner.c +++ b/extras/fixture/test/unity_fixture_TestRunner.c @@ -42,6 +42,7 @@ TEST_GROUP_RUNNER(LeakDetection) RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); RUN_TEST_CASE(LeakDetection, BufferGuardWriteFoundDuringFree); RUN_TEST_CASE(LeakDetection, BufferGuardWriteFoundDuringRealloc); + RUN_TEST_CASE(LeakDetection, PointerSettingMax); } TEST_GROUP_RUNNER(InternalMalloc)