Skip to content

Commit cf769f6

Browse files
committed
Add a test for array_new_filter()
1 parent ef1fdb2 commit cf769f6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

tests/array.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static int _test(intArray * array)
5252
int i;
5353
int j;
5454
int * p;
55+
intArray * a;
5556

5657
if(array_get(array, 0) != NULL
5758
|| array_get_copy(array, 0, &i) == 0)
@@ -88,12 +89,17 @@ static int _test(intArray * array)
8889
return 13;
8990
if((p = array_get(array, 512)) == NULL || *p != 513)
9091
return 14;
92+
if((a = array_new_filter(array, _test_filter, NULL)) == NULL)
93+
return 15;
94+
if(array_count(a) != 1022)
95+
return 16;
96+
array_delete(a);
9197
array_filter(array, _test_filter, NULL);
9298
if(array_count(array) != 1022)
93-
return 15;
99+
return 17;
94100
array_filter_swap(array, _test_filter_swap, NULL);
95101
if(array_count(array) != 0)
96-
return 16;
102+
return 18;
97103
return 0;
98104
}
99105

0 commit comments

Comments
 (0)