couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject [04/50] couchdb commit: updated refs/heads/master to e8e03b6
Date Wed, 16 Dec 2015 21:15:05 GMT
JS test: update reduce.js for 2.0


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/8cae10f1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/8cae10f1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/8cae10f1

Branch: refs/heads/master
Commit: 8cae10f1b56b673a4953d9d213003ca7e1b9479b
Parents: 29870fe
Author: Jan Lehnardt <jan@apache.org>
Authored: Wed Dec 16 20:49:31 2015 +0100
Committer: Jan Lehnardt <jan@apache.org>
Committed: Wed Dec 16 20:49:31 2015 +0100

----------------------------------------------------------------------
 test/javascript/tests/reduce.js | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/8cae10f1/test/javascript/tests/reduce.js
----------------------------------------------------------------------
diff --git a/test/javascript/tests/reduce.js b/test/javascript/tests/reduce.js
index 36e5cb7..9c373e4 100644
--- a/test/javascript/tests/reduce.js
+++ b/test/javascript/tests/reduce.js
@@ -11,8 +11,8 @@
 // the License.
 
 couchTests.reduce = function(debug) {
-  var db = new CouchDB("test_suite_db", {"X-Couch-Full-Commit":"false"});
-  db.deleteDb();
+  var db_name = get_random_db_name();
+  var db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
   db.createDb();
   if (debug) debugger;
   var numDocs = 500;
@@ -48,6 +48,8 @@ couchTests.reduce = function(debug) {
   }
 
   db.deleteDb();
+  db_name = get_random_db_name();
+  db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
   db.createDb();
 
   for(var i=1; i <= 5; i++) {
@@ -67,7 +69,8 @@ couchTests.reduce = function(debug) {
       docs.push({keys:["d", "b"]});
       docs.push({keys:["d", "c"]});
       db.bulkSave(docs);
-      T(db.info().doc_count == ((i - 1) * 10 * 11) + ((j + 1) * 11));
+      var total_docs = ((i - 1) * 10 * 11) + ((j + 1) * 11);
+      TEquals(total_docs, db.info().doc_count, "doc count should match");
     }
 
     map = function (doc) { emit(doc.keys, 1); };
@@ -118,11 +121,11 @@ couchTests.reduce = function(debug) {
   }
 
   // now test out more complex reductions that need to use the combine option.
-
   db.deleteDb();
+  db_name = get_random_db_name();
+  db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
   db.createDb();
 
-
   var map = function (doc) { emit(doc.val, doc.val); };
   var reduceCombine = function (keys, values, rereduce) {
       // This computes the standard deviation of the mapped results
@@ -204,6 +207,8 @@ couchTests.reduce = function(debug) {
     }
 
     db.deleteDb();
+    db_name = get_random_db_name();
+    db = new CouchDB(db_name, {"X-Couch-Full-Commit":"false"});
     db.createDb();
 
     for (var i = 0; i < 1123; i++) {
@@ -411,4 +416,6 @@ couchTests.reduce = function(debug) {
 
   testReducePagination();
 
+  // cleanup
+  db.deleteDb();
 };


Mime
View raw message