-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.c
40 lines (35 loc) · 860 Bytes
/
test.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include <assert.h>
#include "helpers.h"
int test_recursive_factorial()
{
assert(recursive_factorial(0) == 1);
assert(recursive_factorial(1) == 1);
assert(recursive_factorial(2) == 2);
assert(recursive_factorial(3) == 6);
assert(recursive_factorial(20) == 2432902008176640000);
return 0;
}
int test_loopfactorial()
{
assert(loopfactorial(0) == 1);
assert(loopfactorial(1) == 1);
assert(loopfactorial(2) == 2);
assert(loopfactorial(3) == 6);
assert(loopfactorial(20) == 2432902008176640000);
return 0;
}
int test_pandigital()
{
assert(pandigital(123456789));
assert(!pandigital(1234567890));
assert(!pandigital(88654321));
assert(!pandigital(97654321));
assert(pandigital(2143));
}
int main(int argc, const char *argv[])
{
/*test_recursive_factorial(); */
/*test_loopfactorial(); */
test_pandigital();
return 0;
}