aboutsummaryrefslogtreecommitdiffstats
path: root/test/testpools.c
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-05-04 12:31:05 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-05-04 12:31:05 +0000
commitbc9d319ddb279f973404c2b1abf15ec1091bd891 (patch)
tree1d66cd2898724e9e582332da57f8d863ad8b11a7 /test/testpools.c
parent0074052e3f64b2166258f2d117faf8acdf5d4566 (diff)
downloadChibiOS-bc9d319ddb279f973404c2b1abf15ec1091bd891.tar.gz
ChibiOS-bc9d319ddb279f973404c2b1abf15ec1091bd891.tar.bz2
ChibiOS-bc9d319ddb279f973404c2b1abf15ec1091bd891.zip
Improved code coverage.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1902 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'test/testpools.c')
-rw-r--r--test/testpools.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/testpools.c b/test/testpools.c
index 75b26d50f..af4999547 100644
--- a/test/testpools.c
+++ b/test/testpools.c
@@ -60,6 +60,11 @@ static MEMORYPOOL_DECL(mp1, THD_WA_SIZE(THREADS_STACK_SIZE), NULL);
* operation.
*/
+static void *null_provider(size_t size) {
+
+ return NULL;
+}
+
static char *pools1_gettest(void) {
return "Memory Pools, queue/dequeue";
@@ -83,6 +88,10 @@ static void pools1_execute(void) {
/* Now must be empty. */
test_assert(2, chPoolAlloc(&mp1) == NULL, "list not empty");
+
+ /* Covering the case where a provider is unable to return more memory.*/
+ chPoolInit(&mp1, 16, null_provider);
+ test_assert(3, chPoolAlloc(&mp1) == NULL, "provider returned memory");
}
const struct testcase testpools1 = {