From: tho Date: Tue, 16 Mar 2010 09:57:07 +0000 (+0000) Subject: Utils/test: added SENF_CHECK_NOT_EQUAL X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=1ec4c14339e1dbc9a56be7fb528d089e1f37600c;p=senf.git Utils/test: added SENF_CHECK_NOT_EQUAL git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1587 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/doclib/SConscript b/doclib/SConscript index 9dc26c2..97d0fc6 100644 --- a/doclib/SConscript +++ b/doclib/SConscript @@ -238,7 +238,7 @@ FOOTER = """
diff --git a/senf/Packets/80221Bundle/MIHTypes.test.cc b/senf/Packets/80221Bundle/MIHTypes.test.cc index e20d966..01213fb 100644 --- a/senf/Packets/80221Bundle/MIHTypes.test.cc +++ b/senf/Packets/80221Bundle/MIHTypes.test.cc @@ -41,8 +41,8 @@ SENF_AUTO_UNIT_TEST(mihfId) MIHFId id ( MACAddress::from_string("01:02:03:04:05:06")); BOOST_CHECK_EQUAL( id.type(), MIHFId::MACAddress); BOOST_CHECK_EQUAL( id, MIHFId( MACAddress::from_string("01:02:03:04:05:06"))); - BOOST_CHECK( id != MIHFId( MACAddress::from_string("01:02:03:04:05:07"))); - BOOST_CHECK( id != MIHFId( INet4Address::from_string("128.129.130.131"))); + SENF_CHECK_NOT_EQUAL( id, MIHFId( MACAddress::from_string("01:02:03:04:05:07"))); + SENF_CHECK_NOT_EQUAL( id, MIHFId( INet4Address::from_string("128.129.130.131"))); BOOST_CHECK( id < MIHFId( MACAddress::from_string("01:02:03:04:05:07"))); BOOST_CHECK( id < MIHFId( INet4Address::from_string("128.129.130.131"))); } diff --git a/senf/Packets/Packet.test.cc b/senf/Packets/Packet.test.cc index f1b941d..119baa7 100644 --- a/senf/Packets/Packet.test.cc +++ b/senf/Packets/Packet.test.cc @@ -160,7 +160,7 @@ SENF_AUTO_UNIT_TEST(packet) BOOST_CHECK( ! packet.next().next(senf::nothrow) ); BOOST_CHECK( ! packet.prev(senf::nothrow) ); BOOST_CHECK( packet.next().prev() == packet ); - BOOST_CHECK( packet.next() != packet ); + SENF_CHECK_NOT_EQUAL( packet.next(), packet ); BOOST_CHECK_EQUAL( std::distance(packet.data().begin(), packet.next().data().begin()), 4 ); BOOST_CHECK_EQUAL( std::distance(packet.data().begin(), packet.data().end()), 12 ); BOOST_CHECK_EQUAL( std::distance(packet.next().data().begin(), packet.next().data().end()), 8 ); @@ -281,7 +281,7 @@ SENF_AUTO_UNIT_TEST(concretePacket) BOOST_CHECK_EQUAL( FooPacket::createBefore(packet,senf::noinit).size(), 10u ); BOOST_CHECK_EQUAL( packet.size(), 10u ); - BOOST_CHECK( packet.clone() != packet ); + SENF_CHECK_NOT_EQUAL( packet.clone(), packet ); BOOST_CHECK_EQUAL( BarPacket::create()->reserved(), 0xA0A0u ); } diff --git a/senf/Socket/Protocols/BSDSocketAddress.test.cc b/senf/Socket/Protocols/BSDSocketAddress.test.cc index 1827cfd..82329d3 100644 --- a/senf/Socket/Protocols/BSDSocketAddress.test.cc +++ b/senf/Socket/Protocols/BSDSocketAddress.test.cc @@ -46,7 +46,7 @@ SENF_AUTO_UNIT_TEST(bsdSocketAddress) BOOST_CHECK_THROW( senf::sockaddr_cast(g2), std::bad_cast ); BOOST_CHECK( g2 ); BOOST_CHECK( ! g1 ); - BOOST_CHECK( g1 != g2 ); + SENF_CHECK_NOT_EQUAL( g1, g2 ); g1 = g2; BOOST_CHECK( g1 == g2 ); } diff --git a/senf/Socket/Protocols/INet/INet4Address.test.cc b/senf/Socket/Protocols/INet/INet4Address.test.cc index 8365f5e..05a682f 100644 --- a/senf/Socket/Protocols/INet/INet4Address.test.cc +++ b/senf/Socket/Protocols/INet/INet4Address.test.cc @@ -47,7 +47,7 @@ SENF_AUTO_UNIT_TEST(inet4Address) INet4Address addr (INet4Address::from_string("127.0.0.1")); BOOST_CHECK_EQUAL( addr, INet4Address::Loopback ); - BOOST_CHECK( addr != INet4Address::Broadcast ); + SENF_CHECK_NOT_EQUAL( addr, INet4Address::Broadcast ); addr = INet4Address::from_string("localhost"); BOOST_CHECK_EQUAL( addr, INet4Address::Loopback ); @@ -69,7 +69,7 @@ SENF_AUTO_UNIT_TEST(inet4Address) BOOST_CHECK( addr ); BOOST_CHECK( ! INet4Address() ); BOOST_CHECK_THROW( INet4Address::from_string(""), AddressSyntaxException ); - BOOST_CHECK( INet4Address::from_string("www.go6.net") != INet4Address::None ); + SENF_CHECK_NOT_EQUAL( INet4Address::from_string("www.go6.net"), INet4Address::None ); BOOST_CHECK_THROW( INet4Address::from_string("invalid.host.fhg.de"), UnknownHostnameException); { @@ -104,7 +104,7 @@ SENF_AUTO_UNIT_TEST(inet4Network) BOOST_CHECK_EQUAL( net2.address(), senf::INet4Address::from_string("192.0.0.0") ); BOOST_CHECK_EQUAL( net2.prefix_len(), 16u ); - BOOST_CHECK( net != net2 ); + SENF_CHECK_NOT_EQUAL( net, net2 ); BOOST_CHECK( net.match(senf::INet4Address::from_string("127.0.0.1")) ); BOOST_CHECK( ! net2.match(senf::INet4Address::from_string("127.0.0.1")) ); BOOST_CHECK( ! net.match(net2) ); diff --git a/senf/Socket/Protocols/INet/INet6Address.test.cc b/senf/Socket/Protocols/INet/INet6Address.test.cc index 491facc..1283cba 100644 --- a/senf/Socket/Protocols/INet/INet6Address.test.cc +++ b/senf/Socket/Protocols/INet/INet6Address.test.cc @@ -62,12 +62,12 @@ SENF_AUTO_UNIT_TEST(inet6Address) BOOST_CHECK_EQUAL( addr1[13], 14 ); BOOST_CHECK_EQUAL( addr1[14], 15 ); BOOST_CHECK_EQUAL( addr1[15], 0 ); - BOOST_CHECK( INet6Address::from_string("www.go6.net") != INet6Address::None ); + SENF_CHECK_NOT_EQUAL( INet6Address::from_string("www.go6.net"), INet6Address::None ); INet6Address addr2; BOOST_CHECK_EQUAL( senf::str(addr2), "::" ); addr2 = INet6Address::from_string("::1"); - BOOST_CHECK( addr1 != addr2 ); - addr1 =INet6Address::from_string("::1"); + SENF_CHECK_NOT_EQUAL( addr1, addr2 ); + addr1 = INet6Address::from_string("::1"); BOOST_CHECK_EQUAL( addr1, addr2 ); addr1 = INet6Address::None; addr2 = INet6Address::from_string("::"); @@ -180,7 +180,7 @@ SENF_AUTO_UNIT_TEST(inet6Network) BOOST_CHECK_EQUAL( net2.address(), INet6Address::from_string("2001:db8:1230::") ); BOOST_CHECK_EQUAL( net2.prefix_len(), 44u ); - BOOST_CHECK( net != net2 ); + SENF_CHECK_NOT_EQUAL( net, net2 ); BOOST_CHECK( net.match(INet6Address::from_string("ff14:1234::1")) ); BOOST_CHECK( ! net2.match(INet6Address::from_string("ff13:1234::1")) ); BOOST_CHECK( ! net.match(net2) ); diff --git a/senf/Socket/Protocols/INet/INetAddressing.test.cc b/senf/Socket/Protocols/INet/INetAddressing.test.cc index be19a32..29498ae 100644 --- a/senf/Socket/Protocols/INet/INetAddressing.test.cc +++ b/senf/Socket/Protocols/INet/INetAddressing.test.cc @@ -110,7 +110,7 @@ SENF_AUTO_UNIT_TEST(inet6SocketAddress) addr = INet6SocketAddress("[12::21]:12345"); BOOST_CHECK( addr == INet6SocketAddress("[12::21]:12345") ); BOOST_CHECK_EQUAL( addr, INet6SocketAddress(addr) ); - BOOST_CHECK( addr != INet6SocketAddress("[12::21%lo]:12345") ); + SENF_CHECK_NOT_EQUAL( addr, INet6SocketAddress("[12::21%lo]:12345") ); BOOST_CHECK( addr ); BOOST_CHECK_EQUAL( addr.address(), INet6Address::from_string("12::21") ); BOOST_CHECK_EQUAL( addr.port(), 12345u ); diff --git a/senf/Socket/Protocols/Raw/MACAddress.test.cc b/senf/Socket/Protocols/Raw/MACAddress.test.cc index 6272527..fcf9ee1 100644 --- a/senf/Socket/Protocols/Raw/MACAddress.test.cc +++ b/senf/Socket/Protocols/Raw/MACAddress.test.cc @@ -89,7 +89,7 @@ SENF_AUTO_UNIT_TEST(macAddress) char data[] = { 0x01,0x02,0x03,0x04,0x05,0x06 }; mac2 = MACAddress::from_data(data); BOOST_CHECK_EQUAL( senf::str(mac2), "01:02:03:04:05:06" ); - BOOST_CHECK( mac != mac2 ); + SENF_CHECK_NOT_EQUAL( mac, mac2 ); mac2 = mac; BOOST_CHECK( mac == mac2 ); BOOST_CHECK_EQUAL( senf::str(mac2), "a1:b2:c3:d4:e5:f6" ); diff --git a/senf/Utils/TypeIdValue.hh b/senf/Utils/TypeIdValue.hh index f1b8018..d147f47 100644 --- a/senf/Utils/TypeIdValue.hh +++ b/senf/Utils/TypeIdValue.hh @@ -73,14 +73,26 @@ namespace senf { std::type_info const * p_; }; + /** + \related TypeIdValue + */ TypeIdValue const typeIdValue(); + /** + \related TypeIdValue + */ template TypeIdValue const typeIdValue(); + /** + \related TypeIdValue + */ template TypeIdValue const typeidValue(Type const & ob); + /** + \related TypeIdValue + */ std::ostream & operator<<(std::ostream & os, TypeIdValue const & v); } diff --git a/senf/Utils/auto_unit_test.hh b/senf/Utils/auto_unit_test.hh index c7e090a..a05e41b 100644 --- a/senf/Utils/auto_unit_test.hh +++ b/senf/Utils/auto_unit_test.hh @@ -59,8 +59,8 @@ /** \brief Check for compile failure - COMPILE_FAIL() is used to check, that a certain piece of code will produce a compile time - failure. + \c COMPILE_FAIL() is used to check, that a certain piece of code will produce a compile + time failure. \code #ifdef COMPILE_CHECK @@ -85,7 +85,7 @@ /** \brief Show exception information - \ref SENF_CHECK_NO_THROW() is an extension to \c BOOST_CHECK_NO_THROW() which will write out the + \c SENF_CHECK_NO_THROW() is an extension to \c BOOST_CHECK_NO_THROW() which will write out the unabridged exception information when an exception is thrown in addition to signaling an error. \ingroup unittest @@ -105,8 +105,8 @@ namespace test { /** \brief Check ranges for equality, writing char's as int's - \ref SENF_CHECK_EQUAL_COLLECTIONS() is like \c BOOST_CHECK_EQUAL_COLLECTIONS(). The only - difference is, that \ref SENF_CHECK_EQUAL_COLLECTIONS() will write out collection values in + \c SENF_CHECK_EQUAL_COLLECTIONS() is like \c BOOST_CHECK_EQUAL_COLLECTIONS(). The only + difference is, that \c SENF_CHECK_EQUAL_COLLECTIONS() will write out collection values in numeric form (and not as single characters) if the elements are of any char type. Other types are not affected. @@ -120,8 +120,8 @@ namespace test { /** \brief Define new test case - \ref SENF_AUTO_UNIT_TEST() is like \c BOOST_AUTO_UNIT_TEST(). The only difference is, that - if an exception is thrown in the test case \ref SENF_AUTO_UNIT_TEST() will write out the + \c SENF_AUTO_UNIT_TEST() is like \c BOOST_AUTO_UNIT_TEST(). The only difference is, that + if an exception is thrown in the test case \c SENF_AUTO_UNIT_TEST() will write out the complete what-message of the exception. \hideinitializer @@ -141,6 +141,23 @@ namespace test { } \ void senf_test_body_##name() + +#ifdef DOXYGEN + /** \brief Check for non-equality + + \c SENF_CHECK_NOT_EQUAL() is the opposite of \c BOOST_CHECK_EQUAL. + \hideinitializer + \ingroup unittest + */ + #define SENF_CHECK_NOT_EQUAL( Left, Rigth) +#else +#ifdef BOOST_CHECK_NE + #define SENF_CHECK_NOT_EQUAL( Left, Right) BOOST_CHECK_NE( Left, Right) +#else + #define SENF_CHECK_NOT_EQUAL( Left, Right) BOOST_CHECK( Left != Right) +#endif +#endif + ///////////////////////////////hh.e//////////////////////////////////////// //#include "auto_unit_test.cci" //#include "auto_unit_test.ct"