0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00
This commit is contained in:
Kristina Chodorow 2010-08-26 16:30:10 -04:00
parent 18daedd25c
commit 47114280a4

View File

@ -362,6 +362,34 @@ namespace BasicTests {
ASSERT_EQUALS( -1 , lexNumCmp( "b." , "b.|" ) ); ASSERT_EQUALS( -1 , lexNumCmp( "b." , "b.|" ) );
ASSERT_EQUALS( -1 , lexNumCmp( "b.0e" , (string("b.") + (char)255).c_str() ) ); ASSERT_EQUALS( -1 , lexNumCmp( "b.0e" , (string("b.") + (char)255).c_str() ) );
ASSERT_EQUALS( -1 , lexNumCmp( "b." , "b.0e" ) ); ASSERT_EQUALS( -1 , lexNumCmp( "b." , "b.0e" ) );
ASSERT_EQUALS( 0, lexNumCmp( "238947219478347782934718234", "238947219478347782934718234"));
ASSERT_EQUALS( 0, lexNumCmp( "000238947219478347782934718234", "238947219478347782934718234"));
ASSERT_EQUALS( 1, lexNumCmp( "000238947219478347782934718235", "238947219478347782934718234"));
ASSERT_EQUALS( -1, lexNumCmp( "238947219478347782934718234", "238947219478347782934718234.1"));
ASSERT_EQUALS( 0, lexNumCmp( "238", "000238"));
ASSERT_EQUALS( 0, lexNumCmp( "002384", "0002384"));
ASSERT_EQUALS( 0, lexNumCmp( "00002384", "0002384"));
ASSERT_EQUALS( 0, lexNumCmp( "0", "0"));
ASSERT_EQUALS( 0, lexNumCmp( "0000", "0"));
ASSERT_EQUALS( 0, lexNumCmp( "0", "000"));
ASSERT_EQUALS( -1, lexNumCmp( "0000", "0.0"));
ASSERT_EQUALS( 1, lexNumCmp( "2380", "238"));
ASSERT_EQUALS( 1, lexNumCmp( "2385", "2384"));
ASSERT_EQUALS( 1, lexNumCmp( "2385", "02384"));
ASSERT_EQUALS( 1, lexNumCmp( "2385", "002384"));
ASSERT_EQUALS( -1, lexNumCmp( "123.234.4567", "00238"));
ASSERT_EQUALS( 0, lexNumCmp( "123.234", "00123.234"));
ASSERT_EQUALS( 0, lexNumCmp( "a.123.b", "a.00123.b"));
ASSERT_EQUALS( 1, lexNumCmp( "a.123.b", "a.b.00123.b"));
ASSERT_EQUALS( -1, lexNumCmp( "a.00.0", "a.0.1"));
ASSERT_EQUALS( 0, lexNumCmp( "01.003.02", "1.3.2"));
ASSERT_EQUALS( -1, lexNumCmp( "1.3.2", "10.300.20"));
ASSERT_EQUALS( 0, lexNumCmp( "10.300.20", "000000000000010.0000300.000000020"));
ASSERT_EQUALS( 0, lexNumCmp( "0000a", "0a"));
ASSERT_EQUALS( -1, lexNumCmp( "a", "0a"));
ASSERT_EQUALS( -1, lexNumCmp( "000a", "001a"));
ASSERT_EQUALS( 0, lexNumCmp( "010a", "0010a"));
} }
}; };