提交 53bdb689 编写于 作者: J jsalling

Ability to set size of pointer list, smaller default size

上级 0603c1cf
...@@ -305,8 +305,7 @@ struct PointerPair ...@@ -305,8 +305,7 @@ struct PointerPair
void* old_value; void* old_value;
}; };
enum { MAX_POINTERS = 50 }; static struct PointerPair pointer_store[UNITY_MAX_POINTERS];
static struct PointerPair pointer_store[MAX_POINTERS];
static int pointer_index = 0; static int pointer_index = 0;
void UnityPointer_Init(void) void UnityPointer_Init(void)
...@@ -316,7 +315,7 @@ void UnityPointer_Init(void) ...@@ -316,7 +315,7 @@ void UnityPointer_Init(void)
void UnityPointer_Set(void** pointer, void* newValue, UNITY_LINE_TYPE line) void UnityPointer_Set(void** pointer, void* newValue, UNITY_LINE_TYPE line)
{ {
if (pointer_index >= MAX_POINTERS) if (pointer_index >= UNITY_MAX_POINTERS)
{ {
UNITY_TEST_FAIL(line, "Too many pointers set"); UNITY_TEST_FAIL(line, "Too many pointers set");
} }
......
...@@ -40,6 +40,9 @@ void UnityConcludeFixtureTest(void); ...@@ -40,6 +40,9 @@ void UnityConcludeFixtureTest(void);
void UnityPointer_Set(void** ptr, void* newValue, UNITY_LINE_TYPE line); void UnityPointer_Set(void** ptr, void* newValue, UNITY_LINE_TYPE line);
void UnityPointer_UndoAllSets(void); void UnityPointer_UndoAllSets(void);
void UnityPointer_Init(void); void UnityPointer_Init(void);
#ifndef UNITY_MAX_POINTERS
#define UNITY_MAX_POINTERS 5
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -465,7 +465,7 @@ TEST(LeakDetection, PointerSettingMax) ...@@ -465,7 +465,7 @@ TEST(LeakDetection, PointerSettingMax)
TEST_IGNORE(); TEST_IGNORE();
#else #else
int i; int i;
for (i = 0; i < 50; i++) UT_PTR_SET(pointer1, &int1); for (i = 0; i < UNITY_MAX_POINTERS; i++) UT_PTR_SET(pointer1, &int1);
UnityOutputCharSpy_Enable(1); UnityOutputCharSpy_Enable(1);
EXPECT_ABORT_BEGIN EXPECT_ABORT_BEGIN
UT_PTR_SET(pointer1, &int1); UT_PTR_SET(pointer1, &int1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册