1 /*****************************************************************************\
3 * Name : test_math_ops *
4 * Author : Chris Koeritz *
6 *******************************************************************************
7 * Copyright (c) 1993-$now By Author. This program is free software; you can *
8 * redistribute it and/or modify it under the terms of the GNU General Public *
9 * License as published by the Free Software Foundation; either version 2 of *
10 * the License or (at your option) any later version. This is online at: *
11 * http://www.fsf.org/copyleft/gpl.html *
12 * Please send any updates to: fred@gruntose.com *
13 \*****************************************************************************/
15 #include <application/hoople_main.h>
16 #include <basis/guards.h>
17 #include <basis/astring.h>
18 #include <mathematics/math_ops.h>
19 #include <loggers/console_logger.h>
20 #include <structures/static_memory_gremlin.h>
21 #include <unit_test/unit_base.h>
23 using namespace application;
24 using namespace basis;
25 //using namespace filesystem;
26 using namespace loggers;
27 using namespace mathematics;
28 using namespace structures;
29 using namespace textual;
30 using namespace timely;
31 using namespace unit_test;
33 #define LOG(to_print) EMERGENCY_LOG(program_wide_logger().get(), astring(to_print))
35 class test_math_ops : virtual public unit_base, virtual public application_shell
39 DEFINE_CLASS_NAME("test_math_ops");
40 virtual int execute();
45 int test_math_ops::execute()
48 // test one: make sure factorial is working.
49 basis::un_int fact3 = math_ops::factorial(3);
50 ASSERT_EQUAL(fact3, 6, "3! did not equal 6");
51 basis::un_int fact8 = math_ops::factorial(8);
52 ASSERT_EQUAL(fact8, 40320, "8! did not equal 40320");
53 basis::un_int fact10 = math_ops::factorial(10);
54 ASSERT_EQUAL(fact10, 3628800, "10! did not equal 3628800");
56 return final_report();
59 HOOPLE_MAIN(test_math_ops, )