feisty meow concerns codebase  2.140
test_boilerplate.cpp
Go to the documentation of this file.
1 /*****************************************************************************\
2 * *
3 * Name : test_boilerplate *
4 * Author : Chris Koeritz *
5 * *
6 * Purpose: *
7 * *
8 * Puts an object through its pacess--this is intended to provide the basic *
9 * framework for a unit test using the hoople testing framework. *
10 * *
11 *******************************************************************************
12 * Copyright (c) 2011-$now By Author. This program is free software; you can *
13 * redistribute it and/or modify it under the terms of the GNU General Public *
14 * License as published by the Free Software Foundation; either version 2 of *
15 * the License or (at your option) any later version. This is online at: *
16 * http://www.fsf.org/copyleft/gpl.html *
17 * Please send any updates to: fred@gruntose.com *
18 \*****************************************************************************/
19 
21 #include <basis/functions.h>
22 #include <basis/guards.h>
23 #include <loggers/combo_logger.h>
25 #include <unit_test/unit_base.h>
26 
27 #include <memory.h>
28 #include <stdlib.h>
29 
30 using namespace application;
31 using namespace basis;
32 using namespace filesystem;
33 using namespace loggers;
34 using namespace unit_test;
35 
36 #define LOG(to_print) EMERGENCY_LOG(program_wide_logger::get(), to_print)
37 
39 
40 class test_boilerplate : virtual public unit_base, virtual public application_shell
41 {
42 public:
43  test_boilerplate() : unit_base() {}
44  DEFINE_CLASS_NAME("test_boilerplate");
45  virtual int execute();
46 };
47 
48 HOOPLE_MAIN(test_boilerplate, );
49 
51 
52 int test_boilerplate::execute()
53 {
54  FUNCDEF("execute");
55 //do some testing
56  ASSERT_TRUE(true, "true is somehow not true?");
57  return final_report();
58 }
59 
The application_shell is a base object for console programs.
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
Definition: enhance_cpp.h:45
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Definition: enhance_cpp.h:57
Provides macros that implement the 'main' program of an application.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
Definition: array.h:30
A platform independent way to obtain the timestamp of a file.
Definition: byte_filer.cpp:37
A logger that sends to the console screen using the standard output device.
Useful support functions for unit testing, especially within hoople.
Definition: unit_base.cpp:35
HOOPLE_MAIN(test_boilerplate,)
#define ASSERT_TRUE(a, test_name)
Definition: unit_base.h:46