diff options
author | Antonin Kral <a.kral@bobek.cz> | 2010-08-11 12:38:57 +0200 |
---|---|---|
committer | Antonin Kral <a.kral@bobek.cz> | 2010-08-11 12:38:57 +0200 |
commit | 7645618fd3914cb8a20561625913c20d49504a49 (patch) | |
tree | 8370f846f58f6d71165b7a0e2eda04648584ec76 /client/examples/clientTest.cpp | |
parent | 68c73c3c7608b4c87f07440dc3232801720b1168 (diff) | |
download | mongodb-7645618fd3914cb8a20561625913c20d49504a49.tar.gz |
Imported Upstream version 1.6.0
Diffstat (limited to 'client/examples/clientTest.cpp')
-rw-r--r-- | client/examples/clientTest.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/client/examples/clientTest.cpp b/client/examples/clientTest.cpp index bbb82f6..83a556a 100644 --- a/client/examples/clientTest.cpp +++ b/client/examples/clientTest.cpp @@ -137,10 +137,14 @@ int main( int argc, const char **argv ) { assert( conn.getLastError() == "" ); // nonexistent index test - assert( conn.findOne(ns, Query("{name:\"eliot\"}").hint("{foo:1}")).hasElement("$err") ); - assert( conn.getLastError() == "bad hint" ); - conn.resetError(); - assert( conn.getLastError() == "" ); + bool asserted = false; + try { + conn.findOne(ns, Query("{name:\"eliot\"}").hint("{foo:1}")); + } + catch ( ... ){ + asserted = true; + } + assert( asserted ); //existing index assert( conn.findOne(ns, Query("{name:'eliot'}").hint("{name:1}")).hasElement("name") ); @@ -176,8 +180,9 @@ int main( int argc, const char **argv ) { } BSONObj found = conn.findOne( tsns , mongo::BSONObj() ); + cout << "old: " << out << "\nnew: " << found << endl; assert( ( oldTime < found["ts"].timestampTime() ) || - ( oldInc + 1 == found["ts"].timestampInc() ) ); + ( oldTime == found["ts"].timestampTime() && oldInc < found["ts"].timestampInc() ) ); } @@ -185,9 +190,9 @@ int main( int argc, const char **argv ) { assert( conn.getLastError().empty() ); BufBuilder b; - b.append( (int)0 ); // reserved - b.append( (int)-1 ); // invalid # of cursors triggers exception - b.append( (int)-1 ); // bogus cursor id + b.appendNum( (int)0 ); // reserved + b.appendNum( (int)-1 ); // invalid # of cursors triggers exception + b.appendNum( (int)-1 ); // bogus cursor id Message m; m.setData( dbKillCursors, b.buf(), b.len() ); |