You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2015/12/16 20:51:57 UTC
[02/50] couchdb commit: updated
refs/heads/2876-js-tests-merged-squashed to f44e15f
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/2876-js-tests-merged-squashed
Commit: 8cae10f1b56b673a4953d9d213003ca7e1b9479b
Parents: 29870fe
Author: Jan Lehnardt <ja...@apache.org>
Authored: Wed Dec 16 20:49:31 2015 +0100
Committer: Jan Lehnardt <ja...@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();
};