diff options
author | Anne Lim <anne.lim@mongodb.com> | 2017-07-26 13:33:22 -0400 |
---|---|---|
committer | Anne Lim <anne.lim@mongodb.com> | 2017-08-04 09:27:40 -0400 |
commit | 6ac711a04e3aeff10ae551074812c862aa89e906 (patch) | |
tree | 93f53fcb7321ad7c823f4407b5a2cf396b126f78 /src/mongo/db/matcher/expression_serialization_test.cpp | |
parent | 41221453c7bfb54ac35b3390887d9a9ae45013de (diff) | |
download | mongo-6ac711a04e3aeff10ae551074812c862aa89e906.tar.gz |
SERVER-30175: Extend the JSON Schema parser to handle multipleOf keyword
Diffstat (limited to 'src/mongo/db/matcher/expression_serialization_test.cpp')
-rw-r--r-- | src/mongo/db/matcher/expression_serialization_test.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/db/matcher/expression_serialization_test.cpp b/src/mongo/db/matcher/expression_serialization_test.cpp index 6e6b85bb259..428bf0a291f 100644 --- a/src/mongo/db/matcher/expression_serialization_test.cpp +++ b/src/mongo/db/matcher/expression_serialization_test.cpp @@ -1073,5 +1073,23 @@ TEST(SerializeInternalSchema, ExpressionInternalSchemaMaxPropertiesSerializesCor ASSERT_BSONOBJ_EQ(*reserialized.getQuery(), serialize(reserialized.getMatchExpression())); } +TEST(SerializeInternalSchema, ExpressionInternalSchemaFmodSerializesCorrectly) { + Matcher original( + fromjson("{a: {$_internalSchemaFmod: [NumberDecimal('2.3'), NumberDecimal('1.1')]}}"), + ExtensionsCallbackNoop(), + kSimpleCollator); + Matcher reserialized( + serialize(original.getMatchExpression()), ExtensionsCallbackNoop(), kSimpleCollator); + + ASSERT_BSONOBJ_EQ( + *reserialized.getQuery(), + fromjson("{a: {$_internalSchemaFmod: [NumberDecimal('2.3'), NumberDecimal('1.1')]}}")); + ASSERT_BSONOBJ_EQ(*reserialized.getQuery(), serialize(reserialized.getMatchExpression())); + BSONObj obj = fromjson("{a: NumberDecimal('1.1')}"); + ASSERT_EQ(original.matches(obj), reserialized.matches(obj)); + obj = fromjson("{a: NumberDecimal('2.3')}"); + ASSERT_EQ(original.matches(obj), reserialized.matches(obj)); +} + } // namespace } // namespace mongo |