| 50 | |
| 51 | |
| 52 | unittest(test_permutations) |
| 53 | { |
| 54 | fprintf(stderr, "\n\tpermutations(12, k)\n"); |
| 55 | for (int k = 0; k <= 12; k++) |
| 56 | { |
| 57 | fprintf(stderr, "%d\t%d\n", k, permutations(12, k)); |
| 58 | } |
| 59 | |
| 60 | fprintf(stderr, "\n\tpermutations64(20, k)\n"); |
| 61 | for (int k = 0; k <= 20; k++) |
| 62 | { |
| 63 | fprintf(stderr, "%d\t%ld\n", k, permutations64(20, k)); |
| 64 | } |
| 65 | |
| 66 | fprintf(stderr, "\n\tdpermutations(34, k)\n"); |
| 67 | for (int k = 0; k <= 34; k++) |
| 68 | { |
| 69 | fprintf(stderr, "%d\t%f\n", k, dpermutations(34, k)); |
| 70 | } |
| 71 | |
| 72 | fprintf(stderr, "\n120 permutations of abcde\n\n"); |
| 73 | char text[] = "abcde"; |
| 74 | int count = 0; |
| 75 | do |
| 76 | { |
| 77 | fprintf(stderr, "%s\t", text); |
| 78 | count++; |
| 79 | if (count % 5 == 0) fprintf(stderr, "\n"); |
| 80 | } |
| 81 | while (nextPermutation<char>(text, 5)); |
| 82 | fprintf(stderr, "\n\n"); |
| 83 | |
| 84 | assertEqual(120, count); |
| 85 | } |
| 86 | |
| 87 | |
| 88 | unittest(test_factorial) |
nothing calls this directly
no test coverage detected