mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-29 13:45:45 +00:00
heap: Fix memory boundary condition checks when adding new region
Previously, condition_4 was making impossible the valid scenario start > heap_start && end == heap_end. Now, the end == heap_end and start == heap_start case is handled separately allowing the case start > heap_start && ned == heap_end to be considered a valid scenario
This commit is contained in:
@@ -100,8 +100,10 @@ TEST_CASE("Add heap region address range checks", "[heap]")
|
||||
const intptr_t heap_end = 0x3000;
|
||||
|
||||
TEST_ASSERT_TRUE(heap_caps_check_add_region_allowed(heap_start, heap_end, 0x0, 0x1000));
|
||||
TEST_ASSERT_TRUE(heap_caps_check_add_region_allowed(heap_start, heap_end, 0x1000, 0x2000));
|
||||
TEST_ASSERT_TRUE(heap_caps_check_add_region_allowed(heap_start, heap_end, 0x3000, 0x4000));
|
||||
TEST_ASSERT_TRUE(heap_caps_check_add_region_allowed(heap_start, heap_end, 0x1000, 0x2999));
|
||||
TEST_ASSERT_TRUE(heap_caps_check_add_region_allowed(heap_start, heap_end, 0x1001, 0x3000));
|
||||
TEST_ASSERT_TRUE(heap_caps_check_add_region_allowed(heap_start, heap_end, 0x1001, 0x2999));
|
||||
TEST_ASSERT_FALSE(heap_caps_check_add_region_allowed(heap_start, heap_end, 0x0, 0x2000));
|
||||
TEST_ASSERT_FALSE(heap_caps_check_add_region_allowed(heap_start, heap_end, 0x0, 0x4000));
|
||||
TEST_ASSERT_FALSE(heap_caps_check_add_region_allowed(heap_start, heap_end, 0x1000, 0x4000));
|
||||
|
Reference in New Issue
Block a user