diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-05-03 12:15:53 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-05-03 12:15:53 +0000 |
commit | 62beef8720971259545e9df90b182e1a94280c09 (patch) | |
tree | 1b9d9c7c7509e3bdd832da6b5a21f36985941cab /test | |
parent | 5a8670e50f3114981835e5f2a1e2d2dbe196db59 (diff) | |
download | ChibiOS-62beef8720971259545e9df90b182e1a94280c09.tar.gz ChibiOS-62beef8720971259545e9df90b182e1a94280c09.tar.bz2 ChibiOS-62beef8720971259545e9df90b182e1a94280c09.zip |
Heap test coverage 100% again.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@945 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test')
-rw-r--r-- | test/testheap.c | 17 |
1 files 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 : ");
|