/* Utility function tests */ #include "test.h" #define TOTAL 10 #define NUM 3 #define PRINT { \ int i; \ for (i = 0; i < NUM; i++) printf("%2d ", result[i]); \ printf("\n"); \ } int main(void) { int *result, count; TEST_START("utils"); v_combine(TOTAL, NUM); for (count = 0; (result = v_combine_next()) != NULL; count++); TEST("combinations", count == 120); v_permute(TOTAL, NUM); for (count = 0; (result = v_permute_next()) != NULL; count++); TEST("permutations", count == 720); TEST_FINISH; }