MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / unittest

Function unittest

libraries/statHelpers/test/unit_test_001.cpp:52–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50
51
52unittest(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
88unittest(test_factorial)

Callers

nothing calls this directly

Calls 13

permutationsFunction · 0.85
permutations64Function · 0.85
dpermutationsFunction · 0.85
factorialFunction · 0.85
factorial64Function · 0.85
dfactorialFunction · 0.85
stirlingFunction · 0.85
combinationsFunction · 0.85
combinations64Function · 0.85
dcombinationsFunction · 0.85
rcombinationsFunction · 0.85
rcombinations64Function · 0.85

Tested by

no test coverage detected