From cf769f60b9ae19ff2be4244fac35efc2006a23a0 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Tue, 24 Apr 2018 01:47:52 +0200 Subject: [PATCH] Add a test for array_new_filter() --- tests/array.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/array.c b/tests/array.c index 749484c..516c177 100644 --- a/tests/array.c +++ b/tests/array.c @@ -52,6 +52,7 @@ static int _test(intArray * array) int i; int j; int * p; + intArray * a; if(array_get(array, 0) != NULL || array_get_copy(array, 0, &i) == 0) @@ -88,12 +89,17 @@ static int _test(intArray * array) return 13; if((p = array_get(array, 512)) == NULL || *p != 513) return 14; + if((a = array_new_filter(array, _test_filter, NULL)) == NULL) + return 15; + if(array_count(a) != 1022) + return 16; + array_delete(a); array_filter(array, _test_filter, NULL); if(array_count(array) != 1022) - return 15; + return 17; array_filter_swap(array, _test_filter_swap, NULL); if(array_count(array) != 0) - return 16; + return 18; return 0; }