Optimized
This commit is contained in:
@@ -326,39 +326,6 @@ static void test_memoryCompare(void **state) {
|
||||
assert_int_equal(memoryGetAllocatedCount(), 0);
|
||||
}
|
||||
|
||||
static void test_memoryReallocate(void **state) {
|
||||
|
||||
|
||||
size_t initialSize = 16;
|
||||
void *ptr = memoryAllocate(initialSize);
|
||||
assert_non_null(ptr);
|
||||
|
||||
// Reallocate to a larger size
|
||||
size_t newSize = 32;
|
||||
memoryReallocate(&ptr, newSize);
|
||||
assert_non_null(ptr);
|
||||
|
||||
// Reallocate to a smaller size
|
||||
size_t smallerSize = 8;
|
||||
memoryReallocate(&ptr, smallerSize);
|
||||
assert_non_null(ptr);
|
||||
|
||||
// Cannot realloc to size 0
|
||||
expect_assert_failure(memoryReallocate(&ptr, 0));
|
||||
|
||||
// Cannot realloc NULL pointer
|
||||
expect_assert_failure(memoryReallocate(NULL, 16));
|
||||
|
||||
// Cannot reallocate more memory than possible
|
||||
expect_assert_failure(memoryReallocate(&ptr, SIZE_MAX));
|
||||
|
||||
// All we really care about is that the pointer is valid after reallocations
|
||||
memoryFree(ptr);
|
||||
|
||||
// Expect no leaks
|
||||
assert_int_equal(memoryGetAllocatedCount(), 0);
|
||||
}
|
||||
|
||||
static void test_memoryResize(void **state) {
|
||||
|
||||
|
||||
@@ -514,7 +481,6 @@ int main(int argc, char **argv) {
|
||||
cmocka_unit_test(test_memoryCopyRangeSafe),
|
||||
cmocka_unit_test(test_memoryMove),
|
||||
cmocka_unit_test(test_memoryCompare),
|
||||
cmocka_unit_test(test_memoryReallocate),
|
||||
cmocka_unit_test(test_memoryResize),
|
||||
cmocka_unit_test(test_memoryCopyInterleaved),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user