forked from boostorg/function
Fix tests for compilers that actually have a real is_stateless
[SVN r28784]
This commit is contained in:
@ -41,11 +41,20 @@ struct counting_allocator : public std::allocator<T>
|
||||
}
|
||||
};
|
||||
|
||||
struct plus_int
|
||||
{
|
||||
int operator()(int x, int y) const { return x + y; }
|
||||
|
||||
int unused_state_data;
|
||||
};
|
||||
|
||||
static int do_minus(int x, int y) { return x-y; }
|
||||
|
||||
struct DoNothing
|
||||
{
|
||||
void operator()() const {}
|
||||
|
||||
int unused_state_data;
|
||||
};
|
||||
|
||||
static void do_nothing() {}
|
||||
@ -54,7 +63,7 @@ int
|
||||
test_main(int, char*[])
|
||||
{
|
||||
function2<int, int, int, counting_allocator<int> > f;
|
||||
f = plus<int>();
|
||||
f = plus_int();
|
||||
f.clear();
|
||||
BOOST_CHECK(alloc_count == 1);
|
||||
BOOST_CHECK(dealloc_count == 1);
|
||||
@ -63,6 +72,8 @@ test_main(int, char*[])
|
||||
dealloc_count = 0;
|
||||
f = &do_minus;
|
||||
f.clear();
|
||||
BOOST_CHECK(alloc_count == 0);
|
||||
BOOST_CHECK(dealloc_count == 0);
|
||||
|
||||
function0<void, counting_allocator<int> > fv;
|
||||
alloc_count = 0;
|
||||
@ -76,6 +87,8 @@ test_main(int, char*[])
|
||||
dealloc_count = 0;
|
||||
fv = &do_nothing;
|
||||
fv.clear();
|
||||
BOOST_CHECK(alloc_count == 0);
|
||||
BOOST_CHECK(dealloc_count == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user