Add special (and frequent !) handler for functions add, sum, and and or

for the reduction macro.
This commit is contained in:
Patrick Pelissier committed 2017-03-04 19:10:56 +01:00
1 parent dee40608d7
commit 9ce1c69753
2 files changed
+38 -3

No files matched your search

+9
View File
@@ -99,6 +99,15 @@ static void test_extract(void)
ALGO_REDUCE(dst, a, ARRAY_OPLIST(int), inc, sqr2, 4);
assert (dst == (100*99/2-10*11/2) *4 );
ALGO_REDUCE(dst, a, ARRAY_OPLIST(int), sum);
assert (dst == 100*99/2-10*11/2);
ALGO_REDUCE(dst, a, ARRAY_OPLIST(int), add);
assert (dst == 100*99/2-10*11/2);
ALGO_REDUCE(dst, a, ARRAY_OPLIST(int), and);
assert (dst == 0);
ALGO_REDUCE(dst, a, ARRAY_OPLIST(int), or);
assert (dst == 127);
array_int_clear(a);
list_int_clear(l);
}