2 * This file is part of mutest, a simple micro unit testing framework for C.
4 * mutest was written by Leandro Lucarella <llucax@gmail.com> and is released
5 * under the BOLA license, please see the LICENSE file or visit:
6 * http://blitiri.com.ar/p/bola/
8 * This is the factorial module test suite. Each (public) function starting
9 * with mu_test will be picked up by mkmutest as a test case.
11 * Please, read the README file for more details.
14 #include "factorial.h"
16 #include "../mutest.h"
18 void mu_test_factorial_zero() {
19 unsigned x = factorial(0);
23 void mu_test_factorial_one() {
24 unsigned x = factorial(1);
25 /* this test is wrong on purpose, to see how it fails */
29 void mu_test_factorial_positive() {
30 unsigned x = factorial(2);
31 /* this test is wrong on purpose, to see how it fails */
35 /* we don't want to continue if this fails, because the next result
36 * depends on this one. This one will succeed. */
43 mu_ensure(x == 6); /* same as before, but this one will fail. */
45 x = factorial(x-15); /* and this will never be executed */
46 mu_check(x == 362881); /* but if excecuted, will fail */