Add M_FILTER and M_FILTER_C macros (src, tests, doc)
This commit is contained in:
1 parent
0cb1a8054f
commit
f2d5de252b
3 files changed
+58
No files matched your search
@@ -305,10 +305,21 @@ static void test_list(void)
|
||||
assert(M_KEEP_ARGS(1, 1, 0, 0, 0, 0));
|
||||
assert(M_SKIP_ARGS(4, 0, 0, 0, 0, 1));
|
||||
assert(M_MID_ARGS(2, 1, 0, 0, 1, 0));
|
||||
|
||||
const int tab[] = { M_REPLICATE_C(5, 1) };
|
||||
for(int i = 0; i < 5; i++) assert(tab[i] == 1);
|
||||
const char str[] = M_REPLICATE(10, "N");
|
||||
assert(strcmp(str, "NNNNNNNNNN") == 0);
|
||||
|
||||
assert(M_EQUAL(M_REMOVE_PARENTHESIS( 17 ), 17));
|
||||
assert(M_EQUAL(M_REMOVE_PARENTHESIS( (17) ), 17));
|
||||
|
||||
assert( M_FILTER(M_EQUAL, 17, 1, 42, 17, 89) );
|
||||
assert( M_FILTER_C(M_EQUAL, 17, 1, 42, 17, 89) );
|
||||
const int tab2[] = { M_FILTER_C(M_NOTEQUAL, 8, 1, 3, 4, 8, 9, 8, 10) };
|
||||
const int tabref[] = { 1, 3, 4, 9, 10 };
|
||||
assert (sizeof tab2 == sizeof tabref);
|
||||
for(int i = 0; i < 5 ; i++) assert(tab2[i] == tabref[i]);
|
||||
}
|
||||
|
||||
static void test_oplist(void)
|
||||
|
||||
Reference in new issue
Block a user