unordered/test/exception/copy_exception_tests.cpp
Daniel James be93c29493 Merge the latest unordered changes. These are concerned with getting the tests
working on more compilers. The biggest change is that the exception tests have
been changed to use a very simple exception testing mechanism on top of
lightweight_test. This was because Boost.Test exception testing isn't working
on several platforms. I'm trying to set this up so that I can use Boost.Test on
compilers which it completely supports, and lightweight test on others.
Boost.Test tests more than my simple exception testing code ever will so it's
worth using where I can.


[SVN r42698]
2008-01-12 14:43:40 +00:00

50 lines
958 B
C++

// Copyright 2006-2007 Daniel James.
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include "./containers.hpp"
#include "../helpers/random_values.hpp"
test::seed_t seed(73041);
template <class T>
struct copy_test1 : public test::exception_base
{
T x;
void run() const {
T y(x);
}
};
template <class T>
struct copy_test2 : public test::exception_base
{
test::random_values<T> values;
T x;
copy_test2() : values(5), x(values.begin(), values.end()) {}
void run() const {
T y(x);
}
};
template <class T>
struct copy_test3 : public test::exception_base
{
test::random_values<T> values;
T x;
copy_test3() : values(100), x(values.begin(), values.end()) {}
void run() const {
T y(x);
}
};
RUN_EXCEPTION_TESTS(
(copy_test1)(copy_test2)(copy_test3),
CONTAINER_SEQ)