@ -30,15 +30,15 @@ BOOST_AUTO_TEST_CASE(bloom_create_insert_serialize)
CBloomFilter filter ( 3 , 0.01 , 0 , BLOOM_UPDATE_ALL ) ;
CBloomFilter filter ( 3 , 0.01 , 0 , BLOOM_UPDATE_ALL ) ;
filter . insert ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) ;
filter . insert ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " BloomF ilter doesn't contain just-inserted object! " ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " Bloom f ilter doesn't contain just-inserted object! " ) ;
// One bit different in first byte
// One bit different in first byte
BOOST_CHECK_MESSAGE ( ! filter . contains ( ParseHex ( " 19108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " BloomF ilter contains something it shouldn't! " ) ;
BOOST_CHECK_MESSAGE ( ! filter . contains ( ParseHex ( " 19108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " Bloom f ilter contains something it shouldn't! " ) ;
filter . insert ( ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee " ) ) ;
filter . insert ( ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee " ) ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee " ) ) , " BloomF ilter doesn't contain just-inserted object (2)! " ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee " ) ) , " Bloom f ilter doesn't contain just-inserted object (2)! " ) ;
filter . insert ( ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5 " ) ) ;
filter . insert ( ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5 " ) ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5 " ) ) , " BloomF ilter doesn't contain just-inserted object (3)! " ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5 " ) ) , " Bloom f ilter doesn't contain just-inserted object (3)! " ) ;
CDataStream stream ( SER_NETWORK , PROTOCOL_VERSION ) ;
CDataStream stream ( SER_NETWORK , PROTOCOL_VERSION ) ;
stream < < filter ;
stream < < filter ;
@ -51,9 +51,9 @@ BOOST_AUTO_TEST_CASE(bloom_create_insert_serialize)
BOOST_CHECK_EQUAL_COLLECTIONS ( stream . begin ( ) , stream . end ( ) , expected . begin ( ) , expected . end ( ) ) ;
BOOST_CHECK_EQUAL_COLLECTIONS ( stream . begin ( ) , stream . end ( ) , expected . begin ( ) , expected . end ( ) ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " BloomF ilter doesn't contain just-inserted object! " ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " Bloom f ilter doesn't contain just-inserted object! " ) ;
filter . clear ( ) ;
filter . clear ( ) ;
BOOST_CHECK_MESSAGE ( ! filter . contains ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " BloomF ilter should be empty! " ) ;
BOOST_CHECK_MESSAGE ( ! filter . contains ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " Bloom f ilter should be empty! " ) ;
}
}
BOOST_AUTO_TEST_CASE ( bloom_create_insert_serialize_with_tweak )
BOOST_AUTO_TEST_CASE ( bloom_create_insert_serialize_with_tweak )
@ -62,15 +62,15 @@ BOOST_AUTO_TEST_CASE(bloom_create_insert_serialize_with_tweak)
CBloomFilter filter ( 3 , 0.01 , 2147483649UL , BLOOM_UPDATE_ALL ) ;
CBloomFilter filter ( 3 , 0.01 , 2147483649UL , BLOOM_UPDATE_ALL ) ;
filter . insert ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) ;
filter . insert ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " BloomF ilter doesn't contain just-inserted object! " ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " 99108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " Bloom f ilter doesn't contain just-inserted object! " ) ;
// One bit different in first byte
// One bit different in first byte
BOOST_CHECK_MESSAGE ( ! filter . contains ( ParseHex ( " 19108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " BloomF ilter contains something it shouldn't! " ) ;
BOOST_CHECK_MESSAGE ( ! filter . contains ( ParseHex ( " 19108ad8ed9bb6274d3980bab5a85c048f0950c8 " ) ) , " Bloom f ilter contains something it shouldn't! " ) ;
filter . insert ( ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee " ) ) ;
filter . insert ( ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee " ) ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee " ) ) , " BloomF ilter doesn't contain just-inserted object (2)! " ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " b5a2c786d9ef4658287ced5914b37a1b4aa32eee " ) ) , " Bloom f ilter doesn't contain just-inserted object (2)! " ) ;
filter . insert ( ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5 " ) ) ;
filter . insert ( ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5 " ) ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5 " ) ) , " BloomF ilter doesn't contain just-inserted object (3)! " ) ;
BOOST_CHECK_MESSAGE ( filter . contains ( ParseHex ( " b9300670b4c5366e95b2699e8b18bc75e5f729c5 " ) ) , " Bloom f ilter doesn't contain just-inserted object (3)! " ) ;
CDataStream stream ( SER_NETWORK , PROTOCOL_VERSION ) ;
CDataStream stream ( SER_NETWORK , PROTOCOL_VERSION ) ;
stream < < filter ;
stream < < filter ;