diff options
Diffstat (limited to 'indexlib/tests')
-rw-r--r-- | indexlib/tests/ifile-test.cpp | 72 | ||||
-rw-r--r-- | indexlib/tests/leafdatavector-test.cpp | 38 | ||||
-rw-r--r-- | indexlib/tests/match-test.cpp | 50 | ||||
-rw-r--r-- | indexlib/tests/mempool-test.cpp | 2 | ||||
-rw-r--r-- | indexlib/tests/memvector-test.cpp | 108 | ||||
-rw-r--r-- | indexlib/tests/stringarray-test.cpp | 42 | ||||
-rw-r--r-- | indexlib/tests/stringset-test.cpp | 62 | ||||
-rw-r--r-- | indexlib/tests/testdriver.cpp | 6 | ||||
-rw-r--r-- | indexlib/tests/tokenizer-test.cpp | 12 |
9 files changed, 196 insertions, 196 deletions
diff --git a/indexlib/tests/ifile-test.cpp b/indexlib/tests/ifile-test.cpp index 9b9f92832..955098663 100644 --- a/indexlib/tests/ifile-test.cpp +++ b/indexlib/tests/ifile-test.cpp @@ -37,17 +37,17 @@ void simple() { cleanup(); ifile ifi( fname ); ifi.add( "this", "doc" ); - BOOST_CHECK_EQUAL( ifi.search( "this" )->list().size(), 1u ); - BOOST_CHECK_EQUAL( ifi.search( "this" )->list()[ 0 ], 0 ); - BOOST_CHECK_EQUAL( ifi.lookup_docname( ifi.search( "this" )->list()[ 0 ] ), "doc" ); + BOOST_CHECK_ETQUAL( ifi.search( "this" )->list().size(), 1u ); + BOOST_CHECK_ETQUAL( ifi.search( "this" )->list()[ 0 ], 0 ); + BOOST_CHECK_ETQUAL( ifi.lookup_docname( ifi.search( "this" )->list()[ 0 ] ), "doc" ); ifi.add( "that", "doc2" ); - BOOST_CHECK_EQUAL( ifi.search( "this" )->list().size(), 1u ); - BOOST_CHECK_EQUAL( ifi.search( "this" )->list()[ 0 ], 0 ); - BOOST_CHECK_EQUAL( ifi.lookup_docname( ifi.search( "this" )->list()[ 0 ] ), "doc" ); + BOOST_CHECK_ETQUAL( ifi.search( "this" )->list().size(), 1u ); + BOOST_CHECK_ETQUAL( ifi.search( "this" )->list()[ 0 ], 0 ); + BOOST_CHECK_ETQUAL( ifi.lookup_docname( ifi.search( "this" )->list()[ 0 ] ), "doc" ); - BOOST_CHECK_EQUAL( ifi.search( "that" )->list().size(), 1u ); - BOOST_CHECK_EQUAL( ifi.search( "that" )->list()[ 0 ], 1 ); - BOOST_CHECK_EQUAL( ifi.lookup_docname( ifi.search( "that" )->list()[ 0 ] ), "doc2" ); + BOOST_CHECK_ETQUAL( ifi.search( "that" )->list().size(), 1u ); + BOOST_CHECK_ETQUAL( ifi.search( "that" )->list()[ 0 ], 1 ); + BOOST_CHECK_ETQUAL( ifi.lookup_docname( ifi.search( "that" )->list()[ 0 ] ), "doc2" ); } void ndocs() { @@ -55,16 +55,16 @@ void ndocs() { ifile ifi( fname ); ifi.add( "one", "one" ); ifi.add( "one", "two" ); - BOOST_CHECK_EQUAL( ifi.ndocs(), 2 ); + BOOST_CHECK_ETQUAL( ifi.ndocs(), 2 ); ifi.add( "one", "three" ); ifi.add( "one", "four" ); - BOOST_CHECK_EQUAL( ifi.ndocs(), 4 ); - BOOST_CHECK_EQUAL( ifi.lookup_docname( 0 ), std::string( "one" ) ); - BOOST_CHECK_EQUAL( ifi.lookup_docname( 1 ), std::string( "two" ) ); - BOOST_CHECK_EQUAL( ifi.lookup_docname( 2 ), std::string( "three" ) ); - BOOST_CHECK_EQUAL( ifi.lookup_docname( 3 ), std::string( "four" ) ); + BOOST_CHECK_ETQUAL( ifi.ndocs(), 4 ); + BOOST_CHECK_ETQUAL( ifi.lookup_docname( 0 ), std::string( "one" ) ); + BOOST_CHECK_ETQUAL( ifi.lookup_docname( 1 ), std::string( "two" ) ); + BOOST_CHECK_ETQUAL( ifi.lookup_docname( 2 ), std::string( "three" ) ); + BOOST_CHECK_ETQUAL( ifi.lookup_docname( 3 ), std::string( "four" ) ); } void space() { @@ -72,7 +72,7 @@ void space() { ifile ifi( fname ); ifi.add( "one two three", "doc" ); - BOOST_CHECK_EQUAL( ifi.search( "two" )->list().size(), 1 ); + BOOST_CHECK_ETQUAL( ifi.search( "two" )->list().size(), 1 ); } void numbers() { @@ -80,10 +80,10 @@ void numbers() { ifile ifi( fname ); ifi.add( "one 123 123456789 four444 five", "doc" ); - BOOST_CHECK_EQUAL( ifi.search( "123" )->list().size(), 1 ); - BOOST_CHECK_EQUAL( ifi.search( "123456789" )->list().size(), 1 ); - BOOST_CHECK_EQUAL( ifi.search( "four444" )->list().size(), 1 ); - BOOST_CHECK_EQUAL( ifi.search( "five" )->list().size(), 1 ); + BOOST_CHECK_ETQUAL( ifi.search( "123" )->list().size(), 1 ); + BOOST_CHECK_ETQUAL( ifi.search( "123456789" )->list().size(), 1 ); + BOOST_CHECK_ETQUAL( ifi.search( "four444" )->list().size(), 1 ); + BOOST_CHECK_ETQUAL( ifi.search( "five" )->list().size(), 1 ); } void partial() { @@ -91,17 +91,17 @@ void partial() { ifile ifi( fname ); ifi.add( "longword", "doc_0" ); - BOOST_CHECK_EQUAL( ifi.search( "l" )->list().size(), 1u ); - BOOST_CHECK_EQUAL( ifi.search( "long" )->list().size(), 1u ); - BOOST_CHECK_EQUAL( ifi.search( "longword" )->list().size(), 1u ); + BOOST_CHECK_ETQUAL( ifi.search( "l" )->list().size(), 1u ); + BOOST_CHECK_ETQUAL( ifi.search( "long" )->list().size(), 1u ); + BOOST_CHECK_ETQUAL( ifi.search( "longword" )->list().size(), 1u ); - BOOST_CHECK_EQUAL( ifi.search( "longword" )->list().size(), 1u ); + BOOST_CHECK_ETQUAL( ifi.search( "longword" )->list().size(), 1u ); ifi.add( "longnord", "doc_1" ); - BOOST_CHECK_EQUAL( ifi.search( "l" )->list().size(), 2u ); - BOOST_CHECK_EQUAL( ifi.search( "long" )->list().size(), 2u ); - BOOST_CHECK_EQUAL( ifi.search( "longw" )->list().size(), 1u ); - BOOST_CHECK_EQUAL( ifi.search( "longn" )->list().size(), 1u ); + BOOST_CHECK_ETQUAL( ifi.search( "l" )->list().size(), 2u ); + BOOST_CHECK_ETQUAL( ifi.search( "long" )->list().size(), 2u ); + BOOST_CHECK_ETQUAL( ifi.search( "longw" )->list().size(), 1u ); + BOOST_CHECK_ETQUAL( ifi.search( "longn" )->list().size(), 1u ); } void several() { @@ -115,15 +115,15 @@ void several() { ifi.add( "else something", "5" ); ifi.add( "else four", "6" ); - BOOST_CHECK_EQUAL( count_results( ifi, "one" ), 1u ); - BOOST_CHECK_EQUAL( count_results( ifi, "one two three four" ), 1u ); - BOOST_CHECK_EQUAL( count_results( ifi, "two three four" ), 2u ); + BOOST_CHECK_ETQUAL( count_results( ifi, "one" ), 1u ); + BOOST_CHECK_ETQUAL( count_results( ifi, "one two three four" ), 1u ); + BOOST_CHECK_ETQUAL( count_results( ifi, "two three four" ), 2u ); - BOOST_CHECK_EQUAL( count_results( ifi, "one two" ), 1u ); - BOOST_CHECK_EQUAL( count_results( ifi, "one" ), 1u ); + BOOST_CHECK_ETQUAL( count_results( ifi, "one two" ), 1u ); + BOOST_CHECK_ETQUAL( count_results( ifi, "one" ), 1u ); - BOOST_CHECK_EQUAL( count_results( ifi, "something else" ), 2u ); - BOOST_CHECK_EQUAL( count_results( ifi, "something two" ), 2u ); + BOOST_CHECK_ETQUAL( count_results( ifi, "something else" ), 2u ); + BOOST_CHECK_ETQUAL( count_results( ifi, "something two" ), 2u ); } void remove_doc() { @@ -137,7 +137,7 @@ void remove_doc() { BOOST_CHECK( check_results( ifi, "one", "0", NULL ) ); BOOST_CHECK( check_results( ifi, "two", "0", NULL ) ); BOOST_CHECK( check_results( ifi, "three", "0", "2", NULL ) ); - BOOST_CHECK_EQUAL( count_results( ifi, "four" ), 0u ); + BOOST_CHECK_ETQUAL( count_results( ifi, "four" ), 0u ); } test_suite* get_suite() { diff --git a/indexlib/tests/leafdatavector-test.cpp b/indexlib/tests/leafdatavector-test.cpp index 8763327e6..565717f83 100644 --- a/indexlib/tests/leafdatavector-test.cpp +++ b/indexlib/tests/leafdatavector-test.cpp @@ -14,10 +14,10 @@ void simple() { cleanup(); leafdatavector f( fname ); f.add( 0, 1 ); - BOOST_CHECK_EQUAL( f.get( 0 ).size(), 1u ); - BOOST_CHECK_EQUAL( f.get( 0 )[ 0 ], 1u ); + BOOST_CHECK_ETQUAL( f.get( 0 ).size(), 1u ); + BOOST_CHECK_ETQUAL( f.get( 0 )[ 0 ], 1u ); f.add( 0, 2 ); - BOOST_CHECK_EQUAL( f.get( 0 ).size(), 2u ); + BOOST_CHECK_ETQUAL( f.get( 0 ).size(), 2u ); } void persistent() { @@ -28,7 +28,7 @@ void persistent() { } { leafdatavector f( fname ); - BOOST_CHECK_EQUAL( f.get( 0 )[ 0 ], 1u ); + BOOST_CHECK_ETQUAL( f.get( 0 )[ 0 ], 1u ); } } @@ -48,15 +48,15 @@ void complicated() { f.add( 0, 5 ); f.add( 0, 9 ); - BOOST_CHECK_EQUAL( f.get( 0 ).size(), 6u ); - BOOST_CHECK_EQUAL( f.get( 1 ).size(), 3u ); - BOOST_CHECK_EQUAL( f.get( 2 ).size(), 2u ); + BOOST_CHECK_ETQUAL( f.get( 0 ).size(), 6u ); + BOOST_CHECK_ETQUAL( f.get( 1 ).size(), 3u ); + BOOST_CHECK_ETQUAL( f.get( 2 ).size(), 2u ); std::vector<unsigned> one = f.get( 1 ); std::sort( one.begin(), one.end() ); - BOOST_CHECK_EQUAL( one.size(), 3u ); - BOOST_CHECK_EQUAL( one[ 0 ], 3u ); - BOOST_CHECK_EQUAL( one[ 1 ], 5u ); - BOOST_CHECK_EQUAL( one[ 2 ], 8u ); + BOOST_CHECK_ETQUAL( one.size(), 3u ); + BOOST_CHECK_ETQUAL( one[ 0 ], 3u ); + BOOST_CHECK_ETQUAL( one[ 1 ], 5u ); + BOOST_CHECK_ETQUAL( one[ 2 ], 8u ); } void unique() { @@ -67,15 +67,15 @@ void unique() { f.add( 0, 1 ); f.add( 0, 1 ); - BOOST_CHECK_EQUAL( f.get( 0 ).size(), 1u ); + BOOST_CHECK_ETQUAL( f.get( 0 ).size(), 1u ); f.add( 0, 4 ); - BOOST_CHECK_EQUAL( f.get( 0 ).size(), 2u ); + BOOST_CHECK_ETQUAL( f.get( 0 ).size(), 2u ); f.add( 0, 1 ); f.add( 0, 4 ); - BOOST_CHECK_EQUAL( f.get( 0 ).size(), 2u ); + BOOST_CHECK_ETQUAL( f.get( 0 ).size(), 2u ); } @@ -93,7 +93,7 @@ void large() { } for ( std::map<uint,uint>::const_iterator first = counts.begin(), past = counts.end(); first != past; ++first ) { - BOOST_CHECK_EQUAL( first->second, f.get( first->first ).size() ); + BOOST_CHECK_ETQUAL( first->second, f.get( first->first ).size() ); } } @@ -106,10 +106,10 @@ void one_zero() { f.add( 0, 1 ); f.add( 0, 3 ); - BOOST_CHECK_EQUAL( f.get( 0 ).size(), 3u ); - BOOST_CHECK_EQUAL( f.get( 0 )[ 0 ], 0u ); - BOOST_CHECK_EQUAL( f.get( 0 )[ 1 ], 1u ); - BOOST_CHECK_EQUAL( f.get( 0 )[ 2 ], 3u ); + BOOST_CHECK_ETQUAL( f.get( 0 ).size(), 3u ); + BOOST_CHECK_ETQUAL( f.get( 0 )[ 0 ], 0u ); + BOOST_CHECK_ETQUAL( f.get( 0 )[ 1 ], 1u ); + BOOST_CHECK_ETQUAL( f.get( 0 )[ 2 ], 3u ); } diff --git a/indexlib/tests/match-test.cpp b/indexlib/tests/match-test.cpp index 16b8a8e95..a1a3930fa 100644 --- a/indexlib/tests/match-test.cpp +++ b/indexlib/tests/match-test.cpp @@ -11,15 +11,15 @@ void cleanup() { void simple() { cleanup(); Match m( "pat" ); - BOOST_CHECK_EQUAL( m.process( "not here" ), false ); - BOOST_CHECK_EQUAL( m.process( "p a t" ), false ); - BOOST_CHECK_EQUAL( m.process( "pa t" ), false ); + BOOST_CHECK_ETQUAL( m.process( "not here" ), false ); + BOOST_CHECK_ETQUAL( m.process( "p a t" ), false ); + BOOST_CHECK_ETQUAL( m.process( "pa t" ), false ); - BOOST_CHECK_EQUAL( m.process( "pat" ), true ); - BOOST_CHECK_EQUAL( m.process( "pattern" ), true ); - BOOST_CHECK_EQUAL( m.process( " pat " ), true ); - BOOST_CHECK_EQUAL( m.process( "zpat patx ipato " ), true ); + BOOST_CHECK_ETQUAL( m.process( "pat" ), true ); + BOOST_CHECK_ETQUAL( m.process( "pattern" ), true ); + BOOST_CHECK_ETQUAL( m.process( " pat " ), true ); + BOOST_CHECK_ETQUAL( m.process( "zpat patx ipato " ), true ); } void empty() { @@ -40,28 +40,28 @@ void string() { cleanup(); Match m( std::string( "pat" ) ); - BOOST_CHECK_EQUAL( m.process( std::string( "not here" ) ), false ); - BOOST_CHECK_EQUAL( m.process( std::string( "here pattern" ) ), true ); + BOOST_CHECK_ETQUAL( m.process( std::string( "not here" ) ), false ); + BOOST_CHECK_ETQUAL( m.process( std::string( "here pattern" ) ), true ); } void casesensitive() { cleanup(); Match m( std::string( "pat" ), ~Match::caseinsensitive ); - BOOST_CHECK_EQUAL( m.process( std::string( "PAT" ) ), false ); - BOOST_CHECK_EQUAL( m.process( std::string( "aPATa" ) ), false ); - BOOST_CHECK_EQUAL( m.process( std::string( "pAt" ) ), false ); - BOOST_CHECK_EQUAL( m.process( std::string( "pattern" ) ), true ); + BOOST_CHECK_ETQUAL( m.process( std::string( "PAT" ) ), false ); + BOOST_CHECK_ETQUAL( m.process( std::string( "aPATa" ) ), false ); + BOOST_CHECK_ETQUAL( m.process( std::string( "pAt" ) ), false ); + BOOST_CHECK_ETQUAL( m.process( std::string( "pattern" ) ), true ); } void caseinsensitive() { cleanup(); Match m( std::string( "pat" ), Match::caseinsensitive ); - BOOST_CHECK_EQUAL( m.process( std::string( "PAT" ) ), true ); - BOOST_CHECK_EQUAL( m.process( std::string( "aPATa" ) ), true ); - BOOST_CHECK_EQUAL( m.process( std::string( "pAt" ) ), true ); - BOOST_CHECK_EQUAL( m.process( std::string( "pattern" ) ), true ); + BOOST_CHECK_ETQUAL( m.process( std::string( "PAT" ) ), true ); + BOOST_CHECK_ETQUAL( m.process( std::string( "aPATa" ) ), true ); + BOOST_CHECK_ETQUAL( m.process( std::string( "pAt" ) ), true ); + BOOST_CHECK_ETQUAL( m.process( std::string( "pattern" ) ), true ); } @@ -69,16 +69,16 @@ void verylarge() { cleanup(); Match m( std::string( "pat0123456789012345678901234567890" ) ); - BOOST_CHECK_EQUAL( m.process( std::string( "pat0123456789012345678901234567890" ) ), true ); - BOOST_CHECK_EQUAL( m.process( std::string( "xxxxxxpat0123456789012345678901234567890" ) ), true ); - BOOST_CHECK_EQUAL( m.process( std::string( "xxxxxxpat0123456789012345678901234567890xxxxxxxx" ) ), true ); - BOOST_CHECK_EQUAL( m.process( std::string( "xxxxxxpat01234x6789012345678901234567890xxxxxxxx" ) ), false ); - BOOST_CHECK_EQUAL( m.process( std::string( "xxxxxxpat01234x678901234567890123456789xxxxxxxxx" ) ), false ); + BOOST_CHECK_ETQUAL( m.process( std::string( "pat0123456789012345678901234567890" ) ), true ); + BOOST_CHECK_ETQUAL( m.process( std::string( "xxxxxxpat0123456789012345678901234567890" ) ), true ); + BOOST_CHECK_ETQUAL( m.process( std::string( "xxxxxxpat0123456789012345678901234567890xxxxxxxx" ) ), true ); + BOOST_CHECK_ETQUAL( m.process( std::string( "xxxxxxpat01234x6789012345678901234567890xxxxxxxx" ) ), false ); + BOOST_CHECK_ETQUAL( m.process( std::string( "xxxxxxpat01234x678901234567890123456789xxxxxxxxx" ) ), false ); m = Match( std::string( "12345678901234567890123456789012" ) ); - BOOST_CHECK_EQUAL( m.process( std::string( "xxxxxxpat012345678901234567890123456789012xxxxxxxxx" ) ), true ); - BOOST_CHECK_EQUAL( m.process( std::string( "xxxxxxpat012345678901234567890123456789012" ) ), true ); - BOOST_CHECK_EQUAL( m.process( std::string( "xxxxxxpat01234x678901234567890123456789xxxxxxxxx" ) ), false ); + BOOST_CHECK_ETQUAL( m.process( std::string( "xxxxxxpat012345678901234567890123456789012xxxxxxxxx" ) ), true ); + BOOST_CHECK_ETQUAL( m.process( std::string( "xxxxxxpat012345678901234567890123456789012" ) ), true ); + BOOST_CHECK_ETQUAL( m.process( std::string( "xxxxxxpat01234x678901234567890123456789xxxxxxxxx" ) ), false ); } diff --git a/indexlib/tests/mempool-test.cpp b/indexlib/tests/mempool-test.cpp index a0895243c..d0c4ba299 100644 --- a/indexlib/tests/mempool-test.cpp +++ b/indexlib/tests/mempool-test.cpp @@ -28,7 +28,7 @@ void deallocate() { pointers.push_back( pool.allocate( 16 ) ); leafdata::init( pointers.back() ); } - BOOST_CHECK_EQUAL( size, pool.size() ); + BOOST_CHECK_ETQUAL( size, pool.size() ); } void large() { diff --git a/indexlib/tests/memvector-test.cpp b/indexlib/tests/memvector-test.cpp index 60023a4d1..648d8e469 100644 --- a/indexlib/tests/memvector-test.cpp +++ b/indexlib/tests/memvector-test.cpp @@ -19,7 +19,7 @@ void test_size() { test.push_back( 2 ); test.push_back( 3 ); test.push_back( 4 ); - BOOST_CHECK_EQUAL( test.size(), 4u ); + BOOST_CHECK_ETQUAL( test.size(), 4u ); } template <typename T> @@ -30,7 +30,7 @@ void test_put_recover() { test.push_back( T( i*13 + i*i*45 + 23 ) ); } for ( int i = 0; i != 20; ++i ) { - BOOST_CHECK_EQUAL( test[ i ], T( i*13 + i*i*45 + 23 ) ); + BOOST_CHECK_ETQUAL( test[ i ], T( i*13 + i*i*45 + 23 ) ); } } @@ -39,7 +39,7 @@ void resize() { memvector<uint32_t> test( fname ); test.push_back( 1 ); test.resize( 50 ); - BOOST_CHECK_EQUAL( test.size(), 50u ); + BOOST_CHECK_ETQUAL( test.size(), 50u ); } @@ -55,9 +55,9 @@ void test_persistent() { } { memvector<uint32_t> test( fname ); - BOOST_CHECK_EQUAL( test.size(), 5u ); + BOOST_CHECK_ETQUAL( test.size(), 5u ); for ( unsigned i = 0; i != test.size(); ++i ) - BOOST_CHECK_EQUAL( test[ i ], i + 1 ); + BOOST_CHECK_ETQUAL( test[ i ], i + 1 ); } } @@ -71,12 +71,12 @@ void test_insert() { test.insert( test.begin() + 2, 13 ); - BOOST_CHECK_EQUAL( test.size(), 5u ); - BOOST_CHECK_EQUAL( test[ 0 ], 12u ); - BOOST_CHECK_EQUAL( test[ 1 ], 12u ); - BOOST_CHECK_EQUAL( test[ 2 ], 13u ); - BOOST_CHECK_EQUAL( test[ 3 ], 12u ); - BOOST_CHECK_EQUAL( test[ 4 ], 12u ); + BOOST_CHECK_ETQUAL( test.size(), 5u ); + BOOST_CHECK_ETQUAL( test[ 0 ], 12u ); + BOOST_CHECK_ETQUAL( test[ 1 ], 12u ); + BOOST_CHECK_ETQUAL( test[ 2 ], 13u ); + BOOST_CHECK_ETQUAL( test[ 3 ], 12u ); + BOOST_CHECK_ETQUAL( test[ 4 ], 12u ); } void test_iterator() { @@ -85,38 +85,38 @@ void test_iterator() { test.push_back( 1 ); test.push_back( 2 ); - BOOST_CHECK_EQUAL( test[ 0 ], 1u ); - BOOST_CHECK_EQUAL( test[ 1 ], 2u ); + BOOST_CHECK_ETQUAL( test[ 0 ], 1u ); + BOOST_CHECK_ETQUAL( test[ 1 ], 2u ); - BOOST_CHECK_EQUAL( *test.begin(), 1u ); - BOOST_CHECK_EQUAL( *( test.begin() + 1 ), 2u ); + BOOST_CHECK_ETQUAL( *test.begin(), 1u ); + BOOST_CHECK_ETQUAL( *( test.begin() + 1 ), 2u ); memvector<unsigned>::iterator iter = test.begin(); - BOOST_CHECK_EQUAL( *iter, 1u ); + BOOST_CHECK_ETQUAL( *iter, 1u ); BOOST_CHECK( test.begin() == iter ); *iter= 3; - BOOST_CHECK_EQUAL( test[ 0 ], 3u ); - BOOST_CHECK_EQUAL( *iter, 3u ); - BOOST_CHECK_EQUAL( *test.begin(), 3u ); + BOOST_CHECK_ETQUAL( test[ 0 ], 3u ); + BOOST_CHECK_ETQUAL( *iter, 3u ); + BOOST_CHECK_ETQUAL( *test.begin(), 3u ); ++iter; - BOOST_CHECK_EQUAL( *iter, 2u ); + BOOST_CHECK_ETQUAL( *iter, 2u ); *iter = 5; - BOOST_CHECK_EQUAL( *iter, 5u ); - BOOST_CHECK_EQUAL( test[ 1 ], 5u ); + BOOST_CHECK_ETQUAL( *iter, 5u ); + BOOST_CHECK_ETQUAL( test[ 1 ], 5u ); - BOOST_CHECK_EQUAL( std::distance( test.begin(), test.end() ) , test.size() ); + BOOST_CHECK_ETQUAL( std::distance( test.begin(), test.end() ) , test.size() ); test.push_back( 5 ); - BOOST_CHECK_EQUAL( std::distance( test.begin(), test.end() ) , test.size() ); + BOOST_CHECK_ETQUAL( std::distance( test.begin(), test.end() ) , test.size() ); test.push_back( 5 ); - BOOST_CHECK_EQUAL( std::distance( test.begin(), test.end() ) , test.size() ); + BOOST_CHECK_ETQUAL( std::distance( test.begin(), test.end() ) , test.size() ); } void test_iteration() { @@ -133,15 +133,15 @@ void test_iteration() { BOOST_CHECK( iter == test.begin() ); BOOST_CHECK( iter != test.end() ); - BOOST_CHECK_EQUAL( *iter, 1u ); + BOOST_CHECK_ETQUAL( *iter, 1u ); ++iter; - BOOST_CHECK_EQUAL( *iter, 2u ); + BOOST_CHECK_ETQUAL( *iter, 2u ); iter += 2; - BOOST_CHECK_EQUAL( *iter, 3u ); + BOOST_CHECK_ETQUAL( *iter, 3u ); *iter = 7; - BOOST_CHECK_EQUAL( *iter, 7u ); + BOOST_CHECK_ETQUAL( *iter, 7u ); --iter; - BOOST_CHECK_EQUAL( *iter, 5u ); + BOOST_CHECK_ETQUAL( *iter, 5u ); BOOST_CHECK( iter != test.end() ); iter += 2; BOOST_CHECK( iter == test.end() ); @@ -160,20 +160,20 @@ void test_sort() { test.push_back( 3 ); - BOOST_CHECK_EQUAL( *std::min_element( test.begin(), test.end() ), 0 ); + BOOST_CHECK_ETQUAL( *std::min_element( test.begin(), test.end() ), 0 ); BOOST_CHECK( std::min_element( test.begin(), test.end() ) == test.begin() + 1 ); - BOOST_CHECK_EQUAL( *std::max_element( test.begin(), test.end() ), 14 ); + BOOST_CHECK_ETQUAL( *std::max_element( test.begin(), test.end() ), 14 ); BOOST_CHECK( std::max_element( test.begin(), test.end() ) == test.begin() + 2 ); std::sort( test.begin(), test.end() ); - BOOST_CHECK_EQUAL( test[ 0 ], 0 ); - BOOST_CHECK_EQUAL( test[ 1 ], 3 ); - BOOST_CHECK_EQUAL( test[ 2 ], 4 ); - BOOST_CHECK_EQUAL( test[ 3 ], 5 ); - BOOST_CHECK_EQUAL( test[ 4 ], 8 ); - BOOST_CHECK_EQUAL( test[ 5 ], 10 ); - BOOST_CHECK_EQUAL( test[ 6 ], 12 ); - BOOST_CHECK_EQUAL( test[ 7 ], 14 ); + BOOST_CHECK_ETQUAL( test[ 0 ], 0 ); + BOOST_CHECK_ETQUAL( test[ 1 ], 3 ); + BOOST_CHECK_ETQUAL( test[ 2 ], 4 ); + BOOST_CHECK_ETQUAL( test[ 3 ], 5 ); + BOOST_CHECK_ETQUAL( test[ 4 ], 8 ); + BOOST_CHECK_ETQUAL( test[ 5 ], 10 ); + BOOST_CHECK_ETQUAL( test[ 6 ], 12 ); + BOOST_CHECK_ETQUAL( test[ 7 ], 14 ); } void remove() { @@ -181,11 +181,11 @@ void remove() { cleanup(); memvector<unsigned> test( fname ); test.push_back( 1 ); - BOOST_CHECK_EQUAL( test.size(), 1 ); + BOOST_CHECK_ETQUAL( test.size(), 1 ); } memvector<unsigned>::remove( fname ); memvector<unsigned> test( fname ); - BOOST_CHECK_EQUAL( test.size(), 0 ); + BOOST_CHECK_ETQUAL( test.size(), 0 ); } void assign() { @@ -193,7 +193,7 @@ void assign() { memvector<uint32_t> test( fname ); test.push_back( 2 ); test[ 0 ] = 3; - BOOST_CHECK_EQUAL( test[ 0 ], 3u ); + BOOST_CHECK_ETQUAL( test[ 0 ], 3u ); } void erase() { @@ -205,20 +205,20 @@ void erase() { test.push_back( 16 ); test.push_back( 32 ); - BOOST_CHECK_EQUAL( test.size(), 5u ); + BOOST_CHECK_ETQUAL( test.size(), 5u ); test.erase( test.begin() + 1 ); - BOOST_CHECK_EQUAL( test[ 0 ], 2u ); - BOOST_CHECK_EQUAL( test[ 1 ], 8u ); - BOOST_CHECK_EQUAL( test[ 2 ], 16u ); - BOOST_CHECK_EQUAL( test[ 3 ], 32u ); - BOOST_CHECK_EQUAL( test.size(), 4u ); + BOOST_CHECK_ETQUAL( test[ 0 ], 2u ); + BOOST_CHECK_ETQUAL( test[ 1 ], 8u ); + BOOST_CHECK_ETQUAL( test[ 2 ], 16u ); + BOOST_CHECK_ETQUAL( test[ 3 ], 32u ); + BOOST_CHECK_ETQUAL( test.size(), 4u ); test.erase( test.begin() + 3 ); - BOOST_CHECK_EQUAL( test[ 0 ], 2u ); - BOOST_CHECK_EQUAL( test[ 1 ], 8u ); - BOOST_CHECK_EQUAL( test[ 2 ], 16u ); - BOOST_CHECK_EQUAL( test.size(), 3u ); + BOOST_CHECK_ETQUAL( test[ 0 ], 2u ); + BOOST_CHECK_ETQUAL( test[ 1 ], 8u ); + BOOST_CHECK_ETQUAL( test[ 2 ], 16u ); + BOOST_CHECK_ETQUAL( test.size(), 3u ); } @@ -234,7 +234,7 @@ void clear() { test.clear(); - BOOST_CHECK_EQUAL( test.size(), 0u ); + BOOST_CHECK_ETQUAL( test.size(), 0u ); } test_suite* get_suite() { diff --git a/indexlib/tests/stringarray-test.cpp b/indexlib/tests/stringarray-test.cpp index d0f5ecefa..110b82c9a 100644 --- a/indexlib/tests/stringarray-test.cpp +++ b/indexlib/tests/stringarray-test.cpp @@ -17,21 +17,21 @@ void test_size() { test.add( "one" ); test.add( "one" ); test.add( "one" ); - //BOOST_CHECK_EQUAL( test.size(), 4 ); + //BOOST_CHECK_ETQUAL( test.size(), 4 ); cleanup(); } void test_put_recover() { stringarray test( fname ); - BOOST_CHECK_EQUAL( test.add( "one" ), 0 ); - BOOST_CHECK_EQUAL( test.add( "two" ), 1 ); - BOOST_CHECK_EQUAL( test.add( "three" ), 2 ); - BOOST_CHECK_EQUAL( test.add( "four" ), 3 ); + BOOST_CHECK_ETQUAL( test.add( "one" ), 0 ); + BOOST_CHECK_ETQUAL( test.add( "two" ), 1 ); + BOOST_CHECK_ETQUAL( test.add( "three" ), 2 ); + BOOST_CHECK_ETQUAL( test.add( "four" ), 3 ); - BOOST_CHECK_EQUAL( test.get( 0 ), "one" ); - BOOST_CHECK_EQUAL( test.get( 1 ), "two" ); - BOOST_CHECK_EQUAL( test.get( 2 ), "three" ); - BOOST_CHECK_EQUAL( test.get( 3 ), "four" ); + BOOST_CHECK_ETQUAL( test.get( 0 ), "one" ); + BOOST_CHECK_ETQUAL( test.get( 1 ), "two" ); + BOOST_CHECK_ETQUAL( test.get( 2 ), "three" ); + BOOST_CHECK_ETQUAL( test.get( 3 ), "four" ); cleanup(); } @@ -39,19 +39,19 @@ void test_put_recover() { void test_persistent() { { stringarray test( fname ); - BOOST_CHECK_EQUAL( test.add( "one" ), 0 ); - BOOST_CHECK_EQUAL( test.add( "two" ), 1 ); - BOOST_CHECK_EQUAL( test.add( "three" ), 2 ); - BOOST_CHECK_EQUAL( test.add( "four" ), 3 ); + BOOST_CHECK_ETQUAL( test.add( "one" ), 0 ); + BOOST_CHECK_ETQUAL( test.add( "two" ), 1 ); + BOOST_CHECK_ETQUAL( test.add( "three" ), 2 ); + BOOST_CHECK_ETQUAL( test.add( "four" ), 3 ); } { stringarray test( fname ); - //BOOST_CHECK_EQUAL( test.size(), 4 ); - BOOST_CHECK_EQUAL( test.get( 0 ), "one" ); - BOOST_CHECK_EQUAL( test.get( 1 ), "two" ); - BOOST_CHECK_EQUAL( test.get( 2 ), "three" ); - BOOST_CHECK_EQUAL( test.get( 3 ), "four" ); + //BOOST_CHECK_ETQUAL( test.size(), 4 ); + BOOST_CHECK_ETQUAL( test.get( 0 ), "one" ); + BOOST_CHECK_ETQUAL( test.get( 1 ), "two" ); + BOOST_CHECK_ETQUAL( test.get( 2 ), "three" ); + BOOST_CHECK_ETQUAL( test.get( 3 ), "four" ); } cleanup(); @@ -83,9 +83,9 @@ void erase() { test.add( "four" ); test.erase( 1 ); - BOOST_CHECK_EQUAL( test.get( 0 ), "one" ); - BOOST_CHECK_EQUAL( test.get( 1 ), "three" ); - BOOST_CHECK_EQUAL( test.size(), 3u ); + BOOST_CHECK_ETQUAL( test.get( 0 ), "one" ); + BOOST_CHECK_ETQUAL( test.get( 1 ), "three" ); + BOOST_CHECK_ETQUAL( test.size(), 3u ); cleanup(); } diff --git a/indexlib/tests/stringset-test.cpp b/indexlib/tests/stringset-test.cpp index 56d326950..8aed86150 100644 --- a/indexlib/tests/stringset-test.cpp +++ b/indexlib/tests/stringset-test.cpp @@ -56,11 +56,11 @@ void iterator() { stringset::const_iterator iter = set.begin(); - BOOST_CHECK_EQUAL( std::string( "string" ), *iter ); - BOOST_CHECK_EQUAL( set.begin(), iter ); + BOOST_CHECK_ETQUAL( std::string( "string" ), *iter ); + BOOST_CHECK_ETQUAL( set.begin(), iter ); BOOST_CHECK( !( set.end() == iter ) ); ++iter; - BOOST_CHECK_EQUAL( set.end(), iter ); + BOOST_CHECK_ETQUAL( set.end(), iter ); } void order() { @@ -73,49 +73,49 @@ void order() { stringset::const_iterator iter = set.begin(); - BOOST_CHECK_EQUAL( *iter, std::string( "one" ) ); + BOOST_CHECK_ETQUAL( *iter, std::string( "one" ) ); ++iter; - BOOST_CHECK_EQUAL( *iter, std::string( "two" ) ); + BOOST_CHECK_ETQUAL( *iter, std::string( "two" ) ); ++iter; - BOOST_CHECK_EQUAL( *iter, std::string( "wlast" ) ); + BOOST_CHECK_ETQUAL( *iter, std::string( "wlast" ) ); ++iter; - BOOST_CHECK_EQUAL( iter, set.end() ); + BOOST_CHECK_ETQUAL( iter, set.end() ); } void order_of() { cleanup(); stringset set( fname ); set.add( "one" ); - BOOST_CHECK_EQUAL( set.order_of( "one" ), 0 ); - BOOST_CHECK_EQUAL( set.order_of( "two" ), unsigned( -1 ) ); + BOOST_CHECK_ETQUAL( set.order_of( "one" ), 0 ); + BOOST_CHECK_ETQUAL( set.order_of( "two" ), unsigned( -1 ) ); set.add( "two" ); - BOOST_CHECK_EQUAL( set.order_of( "two" ), 1 ); + BOOST_CHECK_ETQUAL( set.order_of( "two" ), 1 ); set.add( "before" ); - BOOST_CHECK_EQUAL( set.order_of( "two" ), 2 ); - BOOST_CHECK_EQUAL( set.order_of( "one" ), 1 ); - BOOST_CHECK_EQUAL( set.order_of( "before" ), 0 ); + BOOST_CHECK_ETQUAL( set.order_of( "two" ), 2 ); + BOOST_CHECK_ETQUAL( set.order_of( "one" ), 1 ); + BOOST_CHECK_ETQUAL( set.order_of( "before" ), 0 ); } void id_of() { cleanup(); stringset set( fname ); set.add( "one" ); - BOOST_CHECK_EQUAL( set.id_of( "one" ), 0 ); - BOOST_CHECK_EQUAL( set.id_of( "two" ), unsigned( -1 ) ); + BOOST_CHECK_ETQUAL( set.id_of( "one" ), 0 ); + BOOST_CHECK_ETQUAL( set.id_of( "two" ), unsigned( -1 ) ); set.add( "two" ); - BOOST_CHECK_EQUAL( set.id_of( "two" ), 1 ); + BOOST_CHECK_ETQUAL( set.id_of( "two" ), 1 ); set.add( "before" ); - BOOST_CHECK_EQUAL( set.id_of( "two" ), 1 ); - BOOST_CHECK_EQUAL( set.id_of( "one" ), 0 ); - BOOST_CHECK_EQUAL( set.id_of( "before" ), 2 ); + BOOST_CHECK_ETQUAL( set.id_of( "two" ), 1 ); + BOOST_CHECK_ETQUAL( set.id_of( "one" ), 0 ); + BOOST_CHECK_ETQUAL( set.id_of( "before" ), 2 ); } void add_return() { cleanup(); stringset set( fname ); - BOOST_CHECK_EQUAL( set.add( "one" ), 0 ); - BOOST_CHECK_EQUAL( set.add( "two" ), 1 ); - BOOST_CHECK_EQUAL( set.add( "before" ), 2 ); + BOOST_CHECK_ETQUAL( set.add( "one" ), 0 ); + BOOST_CHECK_ETQUAL( set.add( "two" ), 1 ); + BOOST_CHECK_ETQUAL( set.add( "before" ), 2 ); } void lower() { @@ -127,8 +127,8 @@ void lower() { set.add( "abc" ); set.add( "acc" ); - BOOST_CHECK_EQUAL( std::string( *set.lower_bound( "ab" ) ), "aba" ); - BOOST_CHECK_EQUAL( std::string( *set.lower_bound( "abz" ) ), "acc" ); + BOOST_CHECK_ETQUAL( std::string( *set.lower_bound( "ab" ) ), "aba" ); + BOOST_CHECK_ETQUAL( std::string( *set.lower_bound( "abz" ) ), "acc" ); } void lower_upper() { @@ -146,19 +146,19 @@ void lower_upper() { limits = set.upper_lower( "ab" ); - BOOST_CHECK_EQUAL( std::distance( upper, lower ), 2u ); - BOOST_CHECK_EQUAL( std::string( *upper ), "aba" ); + BOOST_CHECK_ETQUAL( std::distance( upper, lower ), 2u ); + BOOST_CHECK_ETQUAL( std::string( *upper ), "aba" ); ++upper; - BOOST_CHECK_EQUAL( std::string( *upper ), "abc" ); + BOOST_CHECK_ETQUAL( std::string( *upper ), "abc" ); ++upper; BOOST_CHECK( upper == lower ); limits = set.upper_lower( "abc" ); - BOOST_CHECK_EQUAL( std::distance( upper, lower ), 1u ); - BOOST_CHECK_EQUAL( std::string( *upper ), "abc" ); + BOOST_CHECK_ETQUAL( std::distance( upper, lower ), 1u ); + BOOST_CHECK_ETQUAL( std::string( *upper ), "abc" ); limits = set.upper_lower( "abz" ); - BOOST_CHECK_EQUAL( std::distance( upper, lower ), 0u ); + BOOST_CHECK_ETQUAL( std::distance( upper, lower ), 0u ); } void clear() { @@ -171,7 +171,7 @@ void clear() { set.add( "three" ); set.clear(); - BOOST_CHECK_EQUAL( set.size(), 0u ); + BOOST_CHECK_ETQUAL( set.size(), 0u ); } test_suite* get_suite() { diff --git a/indexlib/tests/testdriver.cpp b/indexlib/tests/testdriver.cpp index db11e0366..2548fd465 100644 --- a/indexlib/tests/testdriver.cpp +++ b/indexlib/tests/testdriver.cpp @@ -18,11 +18,11 @@ * * In addition, as a special exception, the copyright holders give * permission to link the code of this program with any edition of - * the Qt library by Trolltech AS, Norway (or with modified versions - * of Qt that use the same license as Qt), and distribute linked + * the TQt library by Trolltech AS, Norway (or with modified versions + * of TQt that use the same license as TQt), and distribute linked * combinations including the two. You must obey the GNU General * Public License in all respects for all of the code used other than - * Qt. If you modify this file, you may extend this exception to + * TQt. If you modify this file, you may extend this exception to * your version of the file, but you are not obligated to do so. If * you do not wish to do so, delete this exception statement from * your version. diff --git a/indexlib/tests/tokenizer-test.cpp b/indexlib/tests/tokenizer-test.cpp index 372859d90..b5b10f399 100644 --- a/indexlib/tests/tokenizer-test.cpp +++ b/indexlib/tests/tokenizer-test.cpp @@ -19,9 +19,9 @@ void simple() { expected.push_back( "AAACE" ); std::sort( tokens.begin(), tokens.end() ); std::sort( expected.begin(), expected.end() ); - BOOST_CHECK_EQUAL( expected.size(), tokens.size() ); + BOOST_CHECK_ETQUAL( expected.size(), tokens.size() ); for ( int i = 0; i < expected.size() && i < tokens.size(); ++i ) { - BOOST_CHECK_EQUAL( expected[ i ], tokens[ i ] ); + BOOST_CHECK_ETQUAL( expected[ i ], tokens[ i ] ); } } @@ -35,9 +35,9 @@ void with_newlines() { expected.push_back( "THREE" ); std::sort( tokens.begin(), tokens.end() ); std::sort( expected.begin(), expected.end() ); - BOOST_CHECK_EQUAL( expected.size(), tokens.size() ); + BOOST_CHECK_ETQUAL( expected.size(), tokens.size() ); for ( int i = 0; i < expected.size() && i < tokens.size(); ++i ) { - BOOST_CHECK_EQUAL( expected.at( i ), tokens.at( i ) ); + BOOST_CHECK_ETQUAL( expected.at( i ), tokens.at( i ) ); } } @@ -52,9 +52,9 @@ void with_numbers() { expected.push_back( "FOUR" ); std::sort( tokens.begin(), tokens.end() ); std::sort( expected.begin(), expected.end() ); - BOOST_CHECK_EQUAL( expected.size(), tokens.size() ); + BOOST_CHECK_ETQUAL( expected.size(), tokens.size() ); for ( int i = 0; i < expected.size() && i < tokens.size(); ++i ) { - BOOST_CHECK_EQUAL( expected.at( i ), tokens.at( i ) ); + BOOST_CHECK_ETQUAL( expected.at( i ), tokens.at( i ) ); } } |