mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-30 00:56:44 +01:00
tweak asserts
This commit is contained in:
parent
9e237c3871
commit
3afb4cbb8c
@ -44,7 +44,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""..\pcre-7.4";"c:\Program Files\boost\boost_1_35_0";"c:\program files\java\jdk\include";"c:\program files\java\jdk\include\win32""
|
||||
PreprocessorDefinitions="_RECSTORE;WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;HAVE_CONFIG_H;PCRE_STATIC"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
|
@ -8,27 +8,27 @@
|
||||
* test drop
|
||||
*/
|
||||
db.getCollection( "test_db" ).drop();
|
||||
assert(db.getCollection( "test_db" ).find().length() == 0);
|
||||
assert(db.getCollection( "test_db" ).find().length() == 0,1);
|
||||
|
||||
db.getCollection( "test_db" ).save({a:1});
|
||||
assert(db.getCollection( "test_db" ).find().length() == 1);
|
||||
assert(db.getCollection( "test_db" ).find().length() == 1,2);
|
||||
|
||||
db.getCollection( "test_db" ).drop();
|
||||
assert(db.getCollection( "test_db" ).find().length() == 0);
|
||||
assert(db.getCollection( "test_db" ).find().length() == 0,3);
|
||||
|
||||
/*
|
||||
* test count
|
||||
*/
|
||||
|
||||
assert(db.getCollection( "test_db" ).count() == 0);
|
||||
assert(db.getCollection( "test_db" ).count() == 0,4);
|
||||
db.getCollection( "test_db" ).save({a:1});
|
||||
assert(db.getCollection( "test_db" ).count() == 1);
|
||||
assert(db.getCollection( "test_db" ).count() == 1,5);
|
||||
for (i = 0; i < 100; i++) {
|
||||
db.getCollection( "test_db" ).save({a:1});
|
||||
}
|
||||
assert(db.getCollection( "test_db" ).count() == 101);
|
||||
assert(db.getCollection( "test_db" ).count() == 101,6);
|
||||
db.getCollection( "test_db" ).drop();
|
||||
assert(db.getCollection( "test_db" ).count() == 0);
|
||||
assert(db.getCollection( "test_db" ).count() == 0,7);
|
||||
|
||||
/*
|
||||
* test clean (not sure... just be sure it doen't blow up, I guess
|
||||
@ -41,26 +41,30 @@ assert(db.getCollection( "test_db" ).count() == 0);
|
||||
*/
|
||||
|
||||
db.getCollection( "test_db" ).drop();
|
||||
assert(db.getCollection( "test_db" ).count() == 0);
|
||||
assert(db.getCollection( "test_db" ).count() == 0,8);
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
db.getCollection( "test_db" ).save({a:1});
|
||||
}
|
||||
|
||||
var v = db.getCollection( "test_db" ).validate();
|
||||
assert (v.ns == "test.test_db");
|
||||
assert (v.ok == 1);
|
||||
if( v.ns != "test.test_db" ) {
|
||||
print("Error: wrong ns name");
|
||||
print(tojson(v));
|
||||
}
|
||||
assert (v.ns == "test.test_db",9);
|
||||
assert (v.ok == 1,10);
|
||||
|
||||
assert(v.result.toString().match(/nrecords\?:(\d+)/)[1] == 100);
|
||||
assert(v.result.toString().match(/nrecords\?:(\d+)/)[1] == 100,11);
|
||||
|
||||
/*
|
||||
* test deleteIndex, deleteIndexes
|
||||
*/
|
||||
|
||||
db.getCollection( "test_db" ).drop();
|
||||
assert(db.getCollection( "test_db" ).count() == 0);
|
||||
assert(db.getCollection( "test_db" ).count() == 0,12);
|
||||
db.getCollection( "test_db" ).dropIndexes();
|
||||
assert(db.getCollection( "test_db" ).getIndexes().length() == 0);
|
||||
assert(db.getCollection( "test_db" ).getIndexes().length() == 0,13);
|
||||
|
||||
db.getCollection( "test_db" ).save({a:10});
|
||||
db.getCollection( "test_db" ).ensureIndex({a:1});
|
||||
|
Loading…
Reference in New Issue
Block a user