1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#include <tut/tut.hpp>
namespace tut
{
/**
* Tests if dummy tests do not recreate object.
*/
struct same_object_for_dummy_tests
{
static int counter;
test_runner tr;
struct dummy
{
dummy()
{
counter++;
}
};
typedef test_group<dummy> tf;
typedef tf::object object;
tf factory;
same_object_for_dummy_tests();
};
int same_object_for_dummy_tests::counter = 0;
template<>
template<>
void same_object_for_dummy_tests::object::test<1>()
{
}
template<>
template<>
void same_object_for_dummy_tests::object::test<10>()
{
}
/**
* Internal constructor
*/
same_object_for_dummy_tests::same_object_for_dummy_tests()
: factory("internal", tr)
{
}
typedef test_group<same_object_for_dummy_tests> tg;
typedef tg::object object;
tg same_object_for_dummy_tests("new test object for each test except dummies");
/**
* Checks getting unknown exception in setup.
*/
template<>
template<>
void object::test<1>()
{
set_test_name("checks getting unknown exception in setup");
tr.run_tests("internal");
// two for tests, and one at getting final no_more_tests exception
ensure_equals("three objects created",counter,3);
}
}
|