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"
17 #include "../py/mutest.h"
19 #include "../mutest.h"
22 void mu_test_factorial_zero() {
23 unsigned x = factorial(0);
27 void mu_test_factorial_one() {
28 unsigned x = factorial(1);
29 /* this test is wrong on purpose, to see how it fails */
33 void mu_test_factorial_positive() {
34 unsigned x = factorial(2);
35 /* this test is wrong on purpose, to see how it fails */
39 /* we don't want to continue if this fails, because the next result
40 * depends on this one. This one will succeed. */
47 mu_ensure(x == 6); /* same as before, but this one will fail. */
49 x = factorial(x-15); /* and this will never be executed */
50 mu_check(x == 362881); /* but if excecuted, will fail */