diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:17:50 -0500 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:18:14 -0500 |
commit | 4ae691e8edc87d0e3cfb633bb91c328426be007b (patch) | |
tree | 52079a593f54382ca13a2e741633eab1b6271893 /jstests/core/minmax_edge.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/core/minmax_edge.js')
-rw-r--r-- | jstests/core/minmax_edge.js | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/jstests/core/minmax_edge.js b/jstests/core/minmax_edge.js index a22367cc2a9..abd39724a80 100644 --- a/jstests/core/minmax_edge.js +++ b/jstests/core/minmax_edge.js @@ -10,15 +10,15 @@ var t = db.minmax_edge; * Results is the cursor toArray, expectedIds is a list of _ids */ function verifyResultIds(results, expectedIds) { - //check they are the same length + // check they are the same length assert.eq(results.length, expectedIds.length); - function compare(a,b) { - if (a._id < b._id) - return -1; - if (a._id > b._id) - return 1; - return 0; + function compare(a, b) { + if (a._id < b._id) + return -1; + if (a._id > b._id) + return 1; + return 0; } results.sort(compare); @@ -62,22 +62,22 @@ reset(t); assert.commandWorked(t.ensureIndex({a: 1})); verifyMin({a: Infinity}, []); -verifyMax({a: Infinity}, [0,1,2,3,4,5,6,7,8]); +verifyMax({a: Infinity}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); -verifyMin({a: -Infinity}, [0,1,2,3,4,5,6,7,8]); +verifyMin({a: -Infinity}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyMax({a: -Infinity}, []); // NaN < all ints. -verifyMin({a: NaN}, [0,1,2,3,4,5,6,7,8]); +verifyMin({a: NaN}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyMax({a: NaN}, []); // {a: 1} > all ints. verifyMin({a: {a: 1}}, []); -verifyMax({a: {a: 1}}, [0,1,2,3,4,5,6,7,8]); +verifyMax({a: {a: 1}}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); // 'a' > all ints. verifyMin({a: 'a'}, []); -verifyMax({a: 'a'}, [0,1,2,3,4,5,6,7,8]); +verifyMax({a: 'a'}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyResultIds(t.find().min({a: 4}).max({a: 4}).toArray(), []); @@ -86,64 +86,64 @@ reset(t); assert.commandWorked(t.ensureIndex({a: 1, b: -1})); // Same as single-key index assertions, with b field present. -verifyMin({a: NaN, b: 1}, [0,1,2,3,4,5,6,7,8]); +verifyMin({a: NaN, b: 1}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyMax({a: NaN, b: 1}, []); verifyMin({a: Infinity, b: 1}, []); -verifyMax({a: Infinity, b: 1}, [0,1,2,3,4,5,6,7,8]); +verifyMax({a: Infinity, b: 1}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); -verifyMin({a: -Infinity, b: 1}, [0,1,2,3,4,5,6,7,8]); +verifyMin({a: -Infinity, b: 1}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyMax({a: -Infinity, b: 1}, []); verifyMin({a: {a: 1}, b: 1}, []); -verifyMax({a: {a: 1}, b: 1}, [0,1,2,3,4,5,6,7,8]); +verifyMax({a: {a: 1}, b: 1}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyMin({a: 'a', b: 1}, []); -verifyMax({a: 'a', b: 1}, [0,1,2,3,4,5,6,7,8]); +verifyMax({a: 'a', b: 1}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyResultIds(t.find().min({a: 4, b: 1}).max({a: 4, b: 1}).toArray(), []); // Edge cases on b values -verifyMin({a: 1, b: Infinity}, [0,1,2,3,4,5,6,7,8]); -verifyMin({a: 2, b: Infinity}, [3,4,5,6,7,8]); -verifyMin({a: 3, b: Infinity}, [6,7,8]); +verifyMin({a: 1, b: Infinity}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); +verifyMin({a: 2, b: Infinity}, [3, 4, 5, 6, 7, 8]); +verifyMin({a: 3, b: Infinity}, [6, 7, 8]); verifyMax({a: 1, b: Infinity}, []); -verifyMax({a: 2, b: Infinity}, [0,1,2]); -verifyMax({a: 3, b: Infinity}, [0,1,2,3,4,5]); +verifyMax({a: 2, b: Infinity}, [0, 1, 2]); +verifyMax({a: 3, b: Infinity}, [0, 1, 2, 3, 4, 5]); -verifyMin({a: 1, b: -Infinity}, [3,4,5,6,7,8]); -verifyMin({a: 2, b: -Infinity}, [6,7,8]); +verifyMin({a: 1, b: -Infinity}, [3, 4, 5, 6, 7, 8]); +verifyMin({a: 2, b: -Infinity}, [6, 7, 8]); verifyMin({a: 3, b: -Infinity}, []); -verifyMax({a: 1, b: -Infinity}, [0,1,2]); -verifyMax({a: 2, b: -Infinity}, [0,1,2,3,4,5]); -verifyMax({a: 3, b: -Infinity}, [0,1,2,3,4,5,6,7,8]); +verifyMax({a: 1, b: -Infinity}, [0, 1, 2]); +verifyMax({a: 2, b: -Infinity}, [0, 1, 2, 3, 4, 5]); +verifyMax({a: 3, b: -Infinity}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); -verifyMin({a: 2, b: NaN}, [6,7,8]); -verifyMax({a: 2, b: NaN}, [0,1,2,3,4,5]); +verifyMin({a: 2, b: NaN}, [6, 7, 8]); +verifyMax({a: 2, b: NaN}, [0, 1, 2, 3, 4, 5]); -verifyMin({a: 2, b: {b: 1}}, [3,4,5,6,7,8]); -verifyMax({a: 2, b: {b: 1}}, [0,1,2]); +verifyMin({a: 2, b: {b: 1}}, [3, 4, 5, 6, 7, 8]); +verifyMax({a: 2, b: {b: 1}}, [0, 1, 2]); -verifyMin({a: 2, b: 'b'}, [3,4,5,6,7,8]); -verifyMax({a: 2, b: 'b'}, [0,1,2]); +verifyMin({a: 2, b: 'b'}, [3, 4, 5, 6, 7, 8]); +verifyMax({a: 2, b: 'b'}, [0, 1, 2]); // Test descending index. reset(t); t.ensureIndex({a: -1}); verifyMin({a: NaN}, []); -verifyMax({a: NaN}, [0,1,2,3,4,5,6,7,8]); +verifyMax({a: NaN}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); -verifyMin({a: Infinity}, [0,1,2,3,4,5,6,7,8]); +verifyMin({a: Infinity}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyMax({a: Infinity}, []); verifyMin({a: -Infinity}, []); -verifyMax({a: -Infinity}, [0,1,2,3,4,5,6,7,8]); +verifyMax({a: -Infinity}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); -verifyMin({a: {a: 1}}, [0,1,2,3,4,5,6,7,8]); +verifyMin({a: {a: 1}}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyMax({a: {a: 1}}, []); -verifyMin({a: 'a'}, [0,1,2,3,4,5,6,7,8]); +verifyMin({a: 'a'}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyMax({a: 'a'}, []); verifyResultIds(t.find().min({a: 4}).max({a: 4}).toArray(), []); @@ -154,43 +154,43 @@ t.ensureIndex({a: -1, b: -1}); // Same as single-key index assertions, with b field present. verifyMin({a: NaN, b: 1}, []); -verifyMax({a: NaN, b: 1}, [0,1,2,3,4,5,6,7,8]); +verifyMax({a: NaN, b: 1}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); -verifyMin({a: Infinity, b: 1}, [0,1,2,3,4,5,6,7,8]); +verifyMin({a: Infinity, b: 1}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyMax({a: Infinity, b: 1}, []); verifyMin({a: -Infinity, b: 1}, []); -verifyMax({a: -Infinity, b: 1}, [0,1,2,3,4,5,6,7,8]); +verifyMax({a: -Infinity, b: 1}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); -verifyMin({a: {a: 1}, b: 1}, [0,1,2,3,4,5,6,7,8]); +verifyMin({a: {a: 1}, b: 1}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyMax({a: {a: 1}, b: 1}, []); -verifyMin({a: 'a', b: 1}, [0,1,2,3,4,5,6,7,8]); +verifyMin({a: 'a', b: 1}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); verifyMax({a: 'a', b: 1}, []); // Edge cases on b values. -verifyMin({a: 1, b: Infinity}, [0,1,2]); -verifyMin({a: 2, b: Infinity}, [0,1,2,3,4,5]); -verifyMin({a: 3, b: Infinity}, [0,1,2,3,4,5,6,7,8]); -verifyMax({a: 1, b: Infinity}, [3,4,5,6,7,8]); -verifyMax({a: 2, b: Infinity}, [6,7,8]); +verifyMin({a: 1, b: Infinity}, [0, 1, 2]); +verifyMin({a: 2, b: Infinity}, [0, 1, 2, 3, 4, 5]); +verifyMin({a: 3, b: Infinity}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); +verifyMax({a: 1, b: Infinity}, [3, 4, 5, 6, 7, 8]); +verifyMax({a: 2, b: Infinity}, [6, 7, 8]); verifyMax({a: 3, b: Infinity}, []); verifyMin({a: 1, b: -Infinity}, []); -verifyMin({a: 2, b: -Infinity}, [0,1,2]); -verifyMin({a: 3, b: -Infinity}, [0,1,2,3,4,5]); -verifyMax({a: 1, b: -Infinity}, [0,1,2,3,4,5,6,7,8]); -verifyMax({a: 2, b: -Infinity}, [3,4,5,6,7,8]); -verifyMax({a: 3, b: -Infinity}, [6,7,8]); +verifyMin({a: 2, b: -Infinity}, [0, 1, 2]); +verifyMin({a: 3, b: -Infinity}, [0, 1, 2, 3, 4, 5]); +verifyMax({a: 1, b: -Infinity}, [0, 1, 2, 3, 4, 5, 6, 7, 8]); +verifyMax({a: 2, b: -Infinity}, [3, 4, 5, 6, 7, 8]); +verifyMax({a: 3, b: -Infinity}, [6, 7, 8]); -verifyMin({a: 2, b: NaN}, [0,1,2]); -verifyMax({a: 2, b: NaN}, [3,4,5,6,7,8]); +verifyMin({a: 2, b: NaN}, [0, 1, 2]); +verifyMax({a: 2, b: NaN}, [3, 4, 5, 6, 7, 8]); -verifyMin({a: 2, b: {b: 1}}, [3,4,5,6,7,8]); -verifyMax({a: 2, b: {b: 1}}, [0,1,2]); +verifyMin({a: 2, b: {b: 1}}, [3, 4, 5, 6, 7, 8]); +verifyMax({a: 2, b: {b: 1}}, [0, 1, 2]); -verifyMin({a: 2, b: 'b'}, [3,4,5,6,7,8]); -verifyMax({a: 2, b: 'b'}, [0,1,2]); +verifyMin({a: 2, b: 'b'}, [3, 4, 5, 6, 7, 8]); +verifyMax({a: 2, b: 'b'}, [0, 1, 2]); // Now a couple cases with an extra compound index. t.drop(); @@ -205,27 +205,27 @@ t.insert({_id: 5, a: 2, b: 'b', c: 2}); t.insert({_id: 6, a: 2, b: 'a', c: 1}); t.insert({_id: 7, a: 2, b: 'a', c: 2}); -verifyMin({a: 1, b: 'a', c: 1}, [2,3,4,5,6,7]); +verifyMin({a: 1, b: 'a', c: 1}, [2, 3, 4, 5, 6, 7]); verifyMin({a: 2, b: 'a', c: 2}, [7]); -verifyMax({a: 1, b: 'a', c: 1}, [0,1]); -verifyMax({a: 2, b: 'a', c: 2}, [0,1,2,3,4,5,6]); +verifyMax({a: 1, b: 'a', c: 1}, [0, 1]); +verifyMax({a: 2, b: 'a', c: 2}, [0, 1, 2, 3, 4, 5, 6]); verifyMin({a: Infinity, b: 'a', c: 2}, []); -verifyMax({a: Infinity, b: 'a', c: 2}, [0,1,2,3,4,5,6,7]); +verifyMax({a: Infinity, b: 'a', c: 2}, [0, 1, 2, 3, 4, 5, 6, 7]); -verifyMin({a: -Infinity, b: 'a', c: 2}, [0,1,2,3,4,5,6,7]); +verifyMin({a: -Infinity, b: 'a', c: 2}, [0, 1, 2, 3, 4, 5, 6, 7]); verifyMax({a: -Infinity, b: 'a', c: 2}, []); // 'a' > Infinity, actually. -verifyMin({a: 1, b: Infinity, c: 2}, [4,5,6,7]); -verifyMax({a: 1, b: Infinity, c: 2}, [0,1,2,3]); +verifyMin({a: 1, b: Infinity, c: 2}, [4, 5, 6, 7]); +verifyMax({a: 1, b: Infinity, c: 2}, [0, 1, 2, 3]); // Also, 'a' > -Infinity. -verifyMin({a: 1, b: -Infinity, c: 2}, [4,5,6,7]); -verifyMax({a: 1, b: -Infinity, c: 2}, [0,1,2,3]); +verifyMin({a: 1, b: -Infinity, c: 2}, [4, 5, 6, 7]); +verifyMax({a: 1, b: -Infinity, c: 2}, [0, 1, 2, 3]); -verifyMin({a: 1, b: 'a', c: Infinity}, [4,5,6,7]); -verifyMax({a: 1, b: 'a', c: Infinity}, [0,1,2,3]); +verifyMin({a: 1, b: 'a', c: Infinity}, [4, 5, 6, 7]); +verifyMax({a: 1, b: 'a', c: Infinity}, [0, 1, 2, 3]); -verifyMin({a: 1, b: 'a', c: -Infinity}, [2,3,4,5,6,7]); -verifyMax({a: 1, b: 'a', c: -Infinity}, [0,1]); +verifyMin({a: 1, b: 'a', c: -Infinity}, [2, 3, 4, 5, 6, 7]); +verifyMax({a: 1, b: 'a', c: -Infinity}, [0, 1]); |