summaryrefslogtreecommitdiff
path: root/jstests/core/nan.js
diff options
context:
space:
mode:
authorclang-format-7.0.1 <adam.martin@10gen.com>2019-07-26 18:42:24 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2019-07-26 18:42:24 -0400
commitc1a45ebbb0530e3d0201321d725527f1eb83ffce (patch)
treef523079dc5ded3052eefbdcaae424b7502df5b25 /jstests/core/nan.js
parentc9599d8610c3da0b7c3da65667aff821063cf5b9 (diff)
downloadmongo-c1a45ebbb0530e3d0201321d725527f1eb83ffce.tar.gz
Apply formatting per `clang-format-7.0.1`
Diffstat (limited to 'jstests/core/nan.js')
-rw-r--r--jstests/core/nan.js110
1 files changed, 55 insertions, 55 deletions
diff --git a/jstests/core/nan.js b/jstests/core/nan.js
index 1b34a53e64d..4cca00c4b66 100644
--- a/jstests/core/nan.js
+++ b/jstests/core/nan.js
@@ -2,59 +2,59 @@
* Tests basic NaN handling. Note that WiredTiger indexes handle -NaN and NaN differently.
*/
(function() {
- "use strict";
-
- const coll = db.jstests_nan;
- coll.drop();
-
- assert.writeOK(coll.insert({_id: 0, a: -Infinity}));
- assert.writeOK(coll.insert({_id: 1, a: -3}));
- assert.writeOK(coll.insert({_id: 2, a: 0}));
- assert.writeOK(coll.insert({_id: 3, a: 3}));
- assert.writeOK(coll.insert({_id: 4, a: Infinity}));
- assert.writeOK(coll.insert({_id: 5, a: NaN}));
- assert.writeOK(coll.insert({_id: 6, a: -NaN}));
- assert.writeOK(coll.insert({_id: 7, a: undefined}));
- assert.writeOK(coll.insert({_id: 8, a: null}));
- assert.writeOK(coll.insert({_id: 9, a: []}));
- assert.writeOK(coll.insert({_id: 10, a: {b: 1}}));
- assert.writeOK(coll.insert({_id: 11, a: {b: 1}}));
-
- /**
- * Ensures correct results for EQ, LT, LTE, GT, and GTE cases.
- */
- var testNaNComparisons = function() {
- // EQ
- let cursor = coll.find({a: NaN}).sort({_id: 1});
- assert.eq(5, cursor.next()["_id"]);
- assert.eq(6, cursor.next()["_id"]);
- assert(!cursor.hasNext());
-
- // LT
- cursor = coll.find({a: {$lt: NaN}});
- assert(!cursor.hasNext());
-
- // LTE
- cursor = coll.find({a: {$lte: NaN}}).sort({_id: 1});
- assert.eq(5, cursor.next()["_id"]);
- assert.eq(6, cursor.next()["_id"]);
- assert(!cursor.hasNext());
-
- // GT
- cursor = coll.find({a: {$gt: NaN}});
- assert(!cursor.hasNext());
-
- // GTE
- cursor = coll.find({a: {$gte: NaN}}).sort({_id: 1});
- assert.eq(5, cursor.next()["_id"]);
- assert.eq(6, cursor.next()["_id"]);
- assert(!cursor.hasNext());
- };
-
- // Unindexed.
- testNaNComparisons();
-
- // Indexed.
- assert.commandWorked(coll.createIndex({a: 1}));
- testNaNComparisons();
+"use strict";
+
+const coll = db.jstests_nan;
+coll.drop();
+
+assert.writeOK(coll.insert({_id: 0, a: -Infinity}));
+assert.writeOK(coll.insert({_id: 1, a: -3}));
+assert.writeOK(coll.insert({_id: 2, a: 0}));
+assert.writeOK(coll.insert({_id: 3, a: 3}));
+assert.writeOK(coll.insert({_id: 4, a: Infinity}));
+assert.writeOK(coll.insert({_id: 5, a: NaN}));
+assert.writeOK(coll.insert({_id: 6, a: -NaN}));
+assert.writeOK(coll.insert({_id: 7, a: undefined}));
+assert.writeOK(coll.insert({_id: 8, a: null}));
+assert.writeOK(coll.insert({_id: 9, a: []}));
+assert.writeOK(coll.insert({_id: 10, a: {b: 1}}));
+assert.writeOK(coll.insert({_id: 11, a: {b: 1}}));
+
+/**
+ * Ensures correct results for EQ, LT, LTE, GT, and GTE cases.
+ */
+var testNaNComparisons = function() {
+ // EQ
+ let cursor = coll.find({a: NaN}).sort({_id: 1});
+ assert.eq(5, cursor.next()["_id"]);
+ assert.eq(6, cursor.next()["_id"]);
+ assert(!cursor.hasNext());
+
+ // LT
+ cursor = coll.find({a: {$lt: NaN}});
+ assert(!cursor.hasNext());
+
+ // LTE
+ cursor = coll.find({a: {$lte: NaN}}).sort({_id: 1});
+ assert.eq(5, cursor.next()["_id"]);
+ assert.eq(6, cursor.next()["_id"]);
+ assert(!cursor.hasNext());
+
+ // GT
+ cursor = coll.find({a: {$gt: NaN}});
+ assert(!cursor.hasNext());
+
+ // GTE
+ cursor = coll.find({a: {$gte: NaN}}).sort({_id: 1});
+ assert.eq(5, cursor.next()["_id"]);
+ assert.eq(6, cursor.next()["_id"]);
+ assert(!cursor.hasNext());
+};
+
+// Unindexed.
+testNaNComparisons();
+
+// Indexed.
+assert.commandWorked(coll.createIndex({a: 1}));
+testNaNComparisons();
}());