+ heap_freemem(&h, a[i], size);
+ }
+ ASSERT(heap_freeSpace(&h) == HEAP_SIZE);
+}
+
+int heap_testRun(void)
+{
+ alloc_test(ALLOC_SIZE, TEST_LEN);
+ alloc_test(ALLOC_SIZE2, TEST_LEN2);
+ /* Try to allocate the whole heap */
+ uint8_t *b = heap_allocmem(&h, HEAP_SIZE);
+ ASSERT(b);
+ ASSERT(heap_freeSpace(&h) == 0);
+
+ ASSERT(!heap_allocmem(&h, HEAP_SIZE));
+
+ for (int j = 0; j < HEAP_SIZE; j++)
+ b[j] = j;
+
+ for (int j = 0; j < HEAP_SIZE; j++)
+ {
+ kprintf("b[%d] = %d\n", j, j);
+ ASSERT(b[j] == (j & 0xff));