]> Joshua Wise's Git repositories - firearm.git/blame - tests/ack.c
tests: Add the new testbench.
[firearm.git] / tests / ack.c
CommitLineData
392d1bec
JW
1//#test return 61
2
3int ack(int m, int n)
4{
5 if(m == 0) {
6 return n + 1;
7 }
8 else if(n == 0) {
9 return ack(m - 1, 1);
10 }
11 else {
12 return ack(m - 1, ack(m, n - 1));
13 }
14}
15
16void acktest()
17{ int x;
18 if ((x = ack(3, 3)) != 61)
19 {
20 puts("FAIL: Ack test did not return 61\n");
21 puthex(x);
22 }
23 else
24 puts("PASS: Ack test returned 61\n");
25}
This page took 0.03001 seconds and 4 git commands to generate.