summaryrefslogtreecommitdiff
path: root/dbtests/matchertests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'dbtests/matchertests.cpp')
-rw-r--r--dbtests/matchertests.cpp34
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 >();
}
};