From 62beef8720971259545e9df90b182e1a94280c09 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 3 May 2009 12:15:53 +0000 Subject: Heap test coverage 100% again. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@945 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- test/testheap.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test/testheap.c b/test/testheap.c index d71b5563c..fd04353e5 100644 --- a/test/testheap.c +++ b/test/testheap.c @@ -67,15 +67,26 @@ static void heap1_execute(void) { test_assert(4, chHeapStatus(&n) == 1, "heap fragmented"); chHeapFree(p2); chHeapFree(p1); + test_assert(5, chHeapStatus(&n) == 1, "heap fragmented"); + + /* Skip fragment handling */ + p1 = chHeapAlloc(SIZE); + p2 = chHeapAlloc(SIZE); + chHeapFree(p1); + test_assert(6, chHeapStatus(&n) == 2, "invalid state"); + p1 = chHeapAlloc(SIZE * 2); /* Skips first fragment */ + chHeapFree(p1); + chHeapFree(p2); + test_assert(7, chHeapStatus(&n) == 1, "heap fragmented"); /* Allocate all handling */ (void)chHeapStatus(&n); p1 = chHeapAlloc(n); - test_assert(5, chHeapStatus(&n) == 0, "not empty"); + test_assert(8, chHeapStatus(&n) == 0, "not empty"); chHeapFree(p1); - test_assert(6, chHeapStatus(&n) == 1, "heap fragmented"); - test_assert(7, n == sz, "size changed"); + test_assert(9, chHeapStatus(&n) == 1, "heap fragmented"); + test_assert(10, n == sz, "size changed"); } else { test_print("--- Size : "); -- cgit v1.2.3