2
0
mirror of https://github.com/boostorg/signals.git synced 2026-01-19 04:42:10 +00:00

replaced BOOST_TEST

[SVN r27054]
This commit is contained in:
Stefan Slapeta
2005-02-03 13:48:49 +00:00
parent c8750f86b4
commit e37e0630b9
6 changed files with 76 additions and 76 deletions

View File

@@ -31,7 +31,7 @@ void do_delayed_connect(with_constant* wc,
delete wc;
boost::BOOST_SIGNALS_NAMESPACE::connection c = sig.connect(slot);
BOOST_TEST(!c.connected());
BOOST_CHECK(!c.connected());
}
int test_main(int, char*[])

View File

@@ -50,14 +50,14 @@ test_remove_self()
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "0123");
BOOST_CHECK(test_output == "0123");
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "013");
BOOST_CHECK(test_output == "013");
s0.disconnect_all_slots();
BOOST_TEST(s0.empty());
BOOST_CHECK(s0.empty());
connections[0] = s0.connect(remove_connection(0));
connections[1] = s0.connect(remove_connection(1));
@@ -68,14 +68,14 @@ test_remove_self()
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "0123");
BOOST_CHECK(test_output == "0123");
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "012");
BOOST_CHECK(test_output == "012");
s0.disconnect_all_slots();
BOOST_TEST(s0.num_slots() == 0);
BOOST_CHECK(s0.num_slots() == 0);
connections[0] = s0.connect(remove_connection(0, 0));
connections[1] = s0.connect(remove_connection(1));
@@ -86,14 +86,14 @@ test_remove_self()
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "0123");
BOOST_CHECK(test_output == "0123");
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "123");
BOOST_CHECK(test_output == "123");
s0.disconnect_all_slots();
BOOST_TEST(s0.empty());
BOOST_CHECK(s0.empty());
connections[0] = s0.connect(remove_connection(0, 0));
connections[1] = s0.connect(remove_connection(1, 1));
@@ -104,11 +104,11 @@ test_remove_self()
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "0123");
BOOST_CHECK(test_output == "0123");
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "");
BOOST_CHECK(test_output == "");
}
static void
@@ -125,14 +125,14 @@ test_remove_prior()
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "0123");
BOOST_CHECK(test_output == "0123");
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "123");
BOOST_CHECK(test_output == "123");
s0.disconnect_all_slots();
BOOST_TEST(s0.empty());
BOOST_CHECK(s0.empty());
connections[0] = s0.connect(remove_connection(0));
connections[1] = s0.connect(remove_connection(1));
@@ -143,11 +143,11 @@ test_remove_prior()
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "0123");
BOOST_CHECK(test_output == "0123");
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "013");
BOOST_CHECK(test_output == "013");
}
static void
@@ -164,14 +164,14 @@ test_remove_after()
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "023");
BOOST_CHECK(test_output == "023");
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "023");
BOOST_CHECK(test_output == "023");
s0.disconnect_all_slots();
BOOST_TEST(s0.empty());
BOOST_CHECK(s0.empty());
connections[0] = s0.connect(remove_connection(0));
connections[1] = s0.connect(remove_connection(1, 3));
@@ -182,11 +182,11 @@ test_remove_after()
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "012");
BOOST_CHECK(test_output == "012");
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "012");
BOOST_CHECK(test_output == "012");
}
static void
@@ -203,11 +203,11 @@ test_bloodbath()
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "023");
BOOST_CHECK(test_output == "023");
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "3");
BOOST_CHECK(test_output == "3");
}
static void
@@ -224,7 +224,7 @@ test_disconnect_equal()
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "0123");
BOOST_CHECK(test_output == "0123");
#if BOOST_WORKAROUND(BOOST_MSVC, <= 0x1700)
connections[2].disconnect();
@@ -234,7 +234,7 @@ test_disconnect_equal()
test_output = "";
s0(); std::cout << std::endl;
BOOST_TEST(test_output == "013");
BOOST_CHECK(test_output == "013");
}
int test_main(int, char* [])

View File

@@ -25,7 +25,7 @@ struct emit_int {
void operator()() const
{
BOOST_TEST(value == 42 || (!ungrouped1 && !ungrouped2 && !ungrouped3));
BOOST_CHECK(value == 42 || (!ungrouped1 && !ungrouped2 && !ungrouped3));
valuesOutput.push_back(value);
std::cout << value << ' ';
}
@@ -37,7 +37,7 @@ private:
struct write_ungrouped1 {
void operator()() const
{
BOOST_TEST(!ungrouped1);
BOOST_CHECK(!ungrouped1);
ungrouped1 = true;
std::cout << "(Ungrouped #1)" << ' ';
}
@@ -46,7 +46,7 @@ struct write_ungrouped1 {
struct write_ungrouped2 {
void operator()() const
{
BOOST_TEST(!ungrouped2);
BOOST_CHECK(!ungrouped2);
ungrouped2 = true;
std::cout << "(Ungrouped #2)" << ' ';
}
@@ -55,7 +55,7 @@ struct write_ungrouped2 {
struct write_ungrouped3 {
void operator()() const
{
BOOST_TEST(!ungrouped3);
BOOST_CHECK(!ungrouped3);
ungrouped3 = true;
std::cout << "(Ungrouped #3)" << ' ';
}
@@ -96,9 +96,9 @@ int test_main(int, char* [])
sig();
std::cout << std::endl;
BOOST_TEST(valuesOutput == sortedValues);
BOOST_TEST(ungrouped1);
BOOST_TEST(ungrouped2);
BOOST_TEST(ungrouped3);
BOOST_CHECK(valuesOutput == sortedValues);
BOOST_CHECK(ungrouped1);
BOOST_CHECK(ungrouped2);
BOOST_CHECK(ungrouped3);
return 0;
}

View File

@@ -66,33 +66,33 @@ test_zero_args()
boost::BOOST_SIGNALS_NAMESPACE::connection c42 = s0.connect(i42);
boost::BOOST_SIGNALS_NAMESPACE::connection c37 = s0.connect(&get_37);
BOOST_TEST(s0() == 72);
BOOST_CHECK(s0() == 72);
s0.disconnect("72");
BOOST_TEST(s0() == 62);
BOOST_CHECK(s0() == 62);
c72.disconnect(); // Double-disconnect should be safe
BOOST_TEST(s0() == 62);
BOOST_CHECK(s0() == 62);
s0.disconnect("72"); // Triple-disconect should be safe
BOOST_TEST(s0() == 62);
BOOST_CHECK(s0() == 62);
// Also connect 63 in the same group as 62
s0.connect("6x", i63);
BOOST_TEST(s0() == 63);
BOOST_CHECK(s0() == 63);
// Disconnect all of the 60's
s0.disconnect("6x");
BOOST_TEST(s0() == 42);
BOOST_CHECK(s0() == 42);
c42.disconnect();
BOOST_TEST(s0() == 37);
BOOST_CHECK(s0() == 37);
c37.disconnect();
BOOST_TEST(s0() == 2);
BOOST_CHECK(s0() == 2);
c2.disconnect();
BOOST_TEST(s0() == 0);
BOOST_CHECK(s0() == 0);
}
{
@@ -103,7 +103,7 @@ test_zero_args()
boost::BOOST_SIGNALS_NAMESPACE::connection c42 = s0.connect(i42);
const boost::signal0<int, max_or_default<int> >& cs0 = s0;
BOOST_TEST(cs0() == 72);
BOOST_CHECK(cs0() == 72);
}
{
@@ -114,8 +114,8 @@ test_zero_args()
boost::BOOST_SIGNALS_NAMESPACE::connection c7 = s0.connect(i7);
boost::BOOST_SIGNALS_NAMESPACE::connection c10 = s0.connect(i10);
BOOST_TEST(s0() == 10);
BOOST_TEST(s0() == 11);
BOOST_CHECK(s0() == 10);
BOOST_CHECK(s0() == 11);
}
}
@@ -127,8 +127,8 @@ test_one_arg()
s1.connect(std::negate<int>());
s1.connect(std::bind1st(std::multiplies<int>(), 2));
BOOST_TEST(s1(1) == 2);
BOOST_TEST(s1(-1) == 1);
BOOST_CHECK(s1(1) == 2);
BOOST_CHECK(s1(-1) == 1);
}
static void
@@ -138,7 +138,7 @@ test_signal_signal_connect()
s1.connect(std::negate<int>());
BOOST_TEST(s1(3) == -3);
BOOST_CHECK(s1(3) == -3);
{
boost::signal1<int, int, max_or_default<int> > s2;
@@ -146,11 +146,11 @@ test_signal_signal_connect()
s2.connect(std::bind1st(std::multiplies<int>(), 2));
s2.connect(std::bind1st(std::multiplies<int>(), -3));
BOOST_TEST(s2(-3) == 9);
BOOST_TEST(s1(3) == 6);
BOOST_CHECK(s2(-3) == 9);
BOOST_CHECK(s1(3) == 6);
} // s2 goes out of scope and disconnects
BOOST_TEST(s1(3) == -3);
BOOST_CHECK(s1(3) == -3);
}
struct EventCounter
@@ -173,12 +173,12 @@ test_ref()
{
boost::BOOST_SIGNALS_NAMESPACE::scoped_connection c = s.connect(boost::ref(ec));
BOOST_TEST(ec.count == 0);
BOOST_CHECK(ec.count == 0);
s();
BOOST_TEST(ec.count == 1);
BOOST_CHECK(ec.count == 1);
}
s();
BOOST_TEST(ec.count == 1);
BOOST_CHECK(ec.count == 1);
}
int

View File

@@ -67,30 +67,30 @@ test_zero_args()
boost::BOOST_SIGNALS_NAMESPACE::connection c62 = s0.connect(60, i62);
boost::BOOST_SIGNALS_NAMESPACE::connection c42 = s0.connect(i42);
BOOST_TEST(s0() == 72);
BOOST_CHECK(s0() == 72);
s0.disconnect(72);
BOOST_TEST(s0() == 62);
BOOST_CHECK(s0() == 62);
c72.disconnect(); // Double-disconnect should be safe
BOOST_TEST(s0() == 62);
BOOST_CHECK(s0() == 62);
s0.disconnect(72); // Triple-disconect should be safe
BOOST_TEST(s0() == 62);
BOOST_CHECK(s0() == 62);
// Also connect 63 in the same group as 62
s0.connect(60, i63);
BOOST_TEST(s0() == 63);
BOOST_CHECK(s0() == 63);
// Disconnect all of the 60's
s0.disconnect(60);
BOOST_TEST(s0() == 42);
BOOST_CHECK(s0() == 42);
c42.disconnect();
BOOST_TEST(s0() == 2);
BOOST_CHECK(s0() == 2);
c2.disconnect();
BOOST_TEST(s0() == 0);
BOOST_CHECK(s0() == 0);
}
{
@@ -101,7 +101,7 @@ test_zero_args()
boost::BOOST_SIGNALS_NAMESPACE::connection c42 = s0.connect(i42);
const boost::signal<int (), max_or_default<int> >& cs0 = s0;
BOOST_TEST(cs0() == 72);
BOOST_CHECK(cs0() == 72);
}
{
@@ -112,8 +112,8 @@ test_zero_args()
boost::BOOST_SIGNALS_NAMESPACE::connection c7 = s0.connect(i7);
boost::BOOST_SIGNALS_NAMESPACE::connection c10 = s0.connect(i10);
BOOST_TEST(s0() == 10);
BOOST_TEST(s0() == 11);
BOOST_CHECK(s0() == 10);
BOOST_CHECK(s0() == 11);
}
}
@@ -125,8 +125,8 @@ test_one_arg()
s1.connect(std::negate<int>());
s1.connect(std::bind1st(std::multiplies<int>(), 2));
BOOST_TEST(s1(1) == 2);
BOOST_TEST(s1(-1) == 1);
BOOST_CHECK(s1(1) == 2);
BOOST_CHECK(s1(-1) == 1);
}
static void
@@ -136,7 +136,7 @@ test_signal_signal_connect()
s1.connect(std::negate<int>());
BOOST_TEST(s1(3) == -3);
BOOST_CHECK(s1(3) == -3);
{
boost::signal<int (int value), max_or_default<int> > s2;
@@ -144,11 +144,11 @@ test_signal_signal_connect()
s2.connect(std::bind1st(std::multiplies<int>(), 2));
s2.connect(std::bind1st(std::multiplies<int>(), -3));
BOOST_TEST(s2(-3) == 9);
BOOST_TEST(s1(3) == 6);
BOOST_CHECK(s2(-3) == 9);
BOOST_CHECK(s1(3) == 6);
} // s2 goes out of scope and disconnects
BOOST_TEST(s1(3) == -3);
BOOST_CHECK(s1(3) == -3);
}
int

View File

@@ -43,13 +43,13 @@ int test_main(int, char*[])
sig_type s1;
// Test auto-disconnection
BOOST_TEST(s1(5) == 0);
BOOST_CHECK(s1(5) == 0);
{
short_lived shorty;
s1.connect(boost::bind<int>(swallow(), &shorty, _1));
BOOST_TEST(s1(5) == 5);
BOOST_CHECK(s1(5) == 5);
}
BOOST_TEST(s1(5) == 0);
BOOST_CHECK(s1(5) == 0);
// Test auto-disconnection of slot before signal connection
{
@@ -58,7 +58,7 @@ int test_main(int, char*[])
sig_type::slot_type slot(boost::bind<int>(swallow(), shorty, _1));
delete shorty;
BOOST_TEST(s1(5) == 0);
BOOST_CHECK(s1(5) == 0);
}
return 0;