diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-06-24 14:03:35 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-06-24 14:03:35 -0400 |
commit | ea32d7806cd9b9948354e6be1f397b37db3f434f (patch) | |
tree | 6bf9a56b879072e9cc574494e493f40d0fdca4a4 /dbtests | |
parent | d4570964455bbd57c52f753fbe6a0a0828022991 (diff) | |
download | mongo-ea32d7806cd9b9948354e6be1f397b37db3f434f.tar.gz |
fix $in with NumberInt, NumberDouble SERVER-113
Diffstat (limited to 'dbtests')
-rw-r--r-- | dbtests/matchertests.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/dbtests/matchertests.cpp b/dbtests/matchertests.cpp index cb416f5346f..78e387f6f15 100644 --- a/dbtests/matchertests.cpp +++ b/dbtests/matchertests.cpp @@ -63,7 +63,39 @@ namespace MatcherTests { ASSERT( m.matches( b.done() ) ); } }; + + class MixedNumericIN { + public: + void run(){ + BSONObj query = fromjson( "{ a : { $in : [4,6] } }" ); + ASSERT_EQUALS( 4 , query["a"].embeddedObject()["$in"].embeddedObject()["0"].number() ); + ASSERT_EQUALS( NumberDouble , query["a"].embeddedObject()["$in"].embeddedObject()["0"].type() ); + + JSMatcher m( query ); + + { + BSONObjBuilder b; + b.append( "a" , 4.0 ); + ASSERT( m.matches( b.done() ) ); + } + + { + BSONObjBuilder b; + b.append( "a" , 5 ); + ASSERT( ! m.matches( b.done() ) ); + } + + { + BSONObjBuilder b; + b.append( "a" , 4 ); + ASSERT( m.matches( b.done() ) ); + } + + } + }; + + class Size { public: void run() { @@ -75,6 +107,7 @@ namespace MatcherTests { } }; + class All : public Suite { public: All() { @@ -82,6 +115,7 @@ namespace MatcherTests { add< DoubleEqual >(); add< MixedNumericEqual >(); add< MixedNumericGt >(); + add< MixedNumericIN >(); add< Size >(); } }; |