summaryrefslogtreecommitdiff
path: root/dbtests
diff options
context:
space:
mode:
authorAlberto Lerner <alerner@10gen.com>2010-07-22 13:48:43 -0400
committerAlberto Lerner <alerner@10gen.com>2010-07-22 13:48:43 -0400
commitf9c5b67d117ce2d3383f678d9c1d406e6ae0046f (patch)
tree95e1afcbc4b88077314cd4c2044992d59213da58 /dbtests
parentb0d3fa02f3c62dc13c5501edfaa82029cf19b84c (diff)
downloadmongo-f9c5b67d117ce2d3383f678d9c1d406e6ae0046f.tar.gz
SERVER-1278 Expose cursor buffer remains to js testing
Diffstat (limited to 'dbtests')
-rw-r--r--dbtests/clienttests.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/dbtests/clienttests.cpp b/dbtests/clienttests.cpp
index 7b151376dbf..58287e90bde 100644
--- a/dbtests/clienttests.cpp
+++ b/dbtests/clienttests.cpp
@@ -119,12 +119,17 @@ namespace ClientTests {
for( int i = 0; i < 10; ++i )
db.insert( ns(), BSON( "i" << i ) );
auto_ptr< DBClientCursor > c = db.query( ns(), Query().sort( BSON( "i" << 1 ) ) );
+
BSONObj o = c->next();
ASSERT( c->more() );
+ ASSERT_EQUALS( 9 , c->objsLeftInBatch() );
ASSERT( c->moreInCurrentBatch() );
+
c->putBack( o );
ASSERT( c->more() );
+ ASSERT_EQUALS( 10, c->objsLeftInBatch() );
ASSERT( c->moreInCurrentBatch() );
+
o = c->next();
BSONObj o2 = c->next();
BSONObj o3 = c->next();
@@ -136,9 +141,12 @@ namespace ClientTests {
ASSERT_EQUALS( i, o[ "i" ].number() );
}
ASSERT( !c->more() );
+ ASSERT_EQUALS( 0, c->objsLeftInBatch() );
ASSERT( !c->moreInCurrentBatch() );
+
c->putBack( o );
ASSERT( c->more() );
+ ASSERT_EQUALS( 1, c->objsLeftInBatch() );
ASSERT( c->moreInCurrentBatch() );
ASSERT_EQUALS( 1, c->itcount() );
}