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>
25#include <unit_test/unit_base.h>
26
27#include <memory.h>
28#include <stdlib.h>
29
30using namespace application;
31using namespace basis;
32using namespace filesystem;
33using namespace loggers;
34using namespace unit_test;
35
36#define LOG(to_print) EMERGENCY_LOG(program_wide_logger::get(), to_print)
37
39
40class test_boilerplate : virtual public unit_base, virtual public application_shell
41{
42public:
43 test_boilerplate() : unit_base() {}
44 DEFINE_CLASS_NAME("test_boilerplate");
45 virtual int execute();
46};
47
48HOOPLE_MAIN(test_boilerplate, );
49
51
52int 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.
virtual int execute()=0
< retrieves the command line from the /proc hierarchy on linux.
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
Definition enhance_cpp.h:42
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
Definition enhance_cpp.h:54
Provides macros that implement the 'main' program of an application.
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Definition hoople_main.h:61
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.
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
#define ASSERT_TRUE(a, test_name)
Definition unit_base.h:46