1 /* uTest Copyright (C) 2011 Data Differential, http://datadifferential.com/
3 * Use and distribution licensed under the BSD license. See
4 * the COPYING file in the parent directory for full text.
7 #include <libtest/common.h>
10 static test_return_t
_runner_default(test_callback_fn func
, void *p
)
20 static Runner defualt_runners
= {
26 static test_return_t
_default_callback(void *p
)
33 Framework::Framework() :
37 collection_startup(_default_callback
),
38 collection_shutdown(_default_callback
),
40 runner(&defualt_runners
),
45 Framework::~Framework()
49 if (test_failed(_destroy(_creators_ptr
)))
51 std::cerr
<< "Failure in _destroy(), some resources may not have been cleaned up." << std::endl
;
56 test_return_t
Framework::Item::flush(void* arg
, test_st
* run
)
58 if (run
->requires_flush
and _flush
)
66 test_return_t
Framework::on_error(const test_return_t rc
, void* arg
)
68 if (_on_error
and test_failed(_on_error(rc
, arg
)))
76 test_return_t
Framework::startup(void* arg
)
78 if (collection_startup
)
80 return collection_startup(arg
);
86 test_return_t
Framework::Item::startup(void* arg
)
96 void* Framework::create(test_return_t
& arg
)
101 return _creators_ptr
= _create(&arg
);