diff options
author | David Bradford <david.bradford@mongodb.com> | 2018-02-27 09:20:42 -0500 |
---|---|---|
committer | David Bradford <david.bradford@mongodb.com> | 2018-02-27 09:20:42 -0500 |
commit | fad221315a58ce07d4ec6d252ad676a86e885658 (patch) | |
tree | ccd109d9b71fd62d17d8a783ffcefcc2637c0c9a /jstests/noPassthrough/shell_assertions.js | |
parent | 494bc5fa73352687f4b0a39f4b8338fc9e258cc0 (diff) | |
download | mongo-fad221315a58ce07d4ec6d252ad676a86e885658.tar.gz |
SERVER-21941: Improve handling of timestamps in assert comparison functions
Diffstat (limited to 'jstests/noPassthrough/shell_assertions.js')
-rw-r--r-- | jstests/noPassthrough/shell_assertions.js | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/jstests/noPassthrough/shell_assertions.js b/jstests/noPassthrough/shell_assertions.js index 75a0a7ee47e..8915d087a3e 100644 --- a/jstests/noPassthrough/shell_assertions.js +++ b/jstests/noPassthrough/shell_assertions.js @@ -430,6 +430,24 @@ }); }); + tests.push(function ltPassesWhenLessThanWithTimestamps() { + assert.doesNotThrow(() => { + assert.lt(Timestamp(3, 0), Timestamp(10, 0)); + }); + }); + + tests.push(function ltFailsWhenNotLessThanWithTimestamps() { + assert.throws(() => { + assert.lt(Timestamp(0, 10), Timestamp(0, 3)); + }); + }); + + tests.push(function ltFailsWhenEqualWithTimestamps() { + assert.throws(() => { + assert.lt(Timestamp(5, 0), Timestamp(5, 0)); + }); + }); + /* assert.gt tests */ tests.push(function gtPassesWhenGreaterThan() { @@ -490,6 +508,24 @@ }); }); + tests.push(function gtePassesWhenGreaterThanWithTimestamps() { + assert.doesNotThrow(() => { + assert.gte(Timestamp(0, 10), Timestamp(0, 3)); + }); + }); + + tests.push(function gteFailsWhenNotGreaterThanWithTimestamps() { + assert.throws(() => { + assert.gte(Timestamp(0, 3), Timestamp(0, 10)); + }); + }); + + tests.push(function gtePassesWhenEqualWIthTimestamps() { + assert.doesNotThrow(() => { + assert.gte(Timestamp(5, 0), Timestamp(5, 0)); + }); + }); + /* assert.betweenIn tests */ tests.push(function betweenInPassWhenNumberIsBetween() { |