diff options
Diffstat (limited to 'dbtests/jsontests.cpp')
-rw-r--r-- | dbtests/jsontests.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/dbtests/jsontests.cpp b/dbtests/jsontests.cpp index c671d2bc8dc..3575c3d8e41 100644 --- a/dbtests/jsontests.cpp +++ b/dbtests/jsontests.cpp @@ -950,7 +950,7 @@ namespace JsonTests { } }; - class EmbeddedDates : public Base { + class EmbeddedDatesBase : public Base { public: virtual void run(){ @@ -971,11 +971,24 @@ namespace JsonTests { b.append( "time.valid" , e.obj() ); return b.obj(); } + virtual string json() const = 0; + }; + struct EmbeddedDatesFormat1 : EmbeddedDatesBase { string json() const { return "{ \"time.valid\" : { $gt : { \"$date\" : 1257829200000 } , $lt : { \"$date\" : 1257829200100 } } }"; } }; + struct EmbeddedDatesFormat2 : EmbeddedDatesBase { + string json() const { + return "{ \"time.valid\" : { $gt : Date(1257829200000) , $lt : Date( 1257829200100 ) } }"; + } + }; + struct EmbeddedDatesFormat3 : EmbeddedDatesBase { + string json() const { + return "{ \"time.valid\" : { $gt : new Date(1257829200000) , $lt : new Date( 1257829200100 ) } }"; + } + }; } // namespace FromJsonTests @@ -1058,7 +1071,9 @@ namespace JsonTests { add< FromJsonTests::ObjectId2 >(); add< FromJsonTests::NumericTypes >(); add< FromJsonTests::NegativeNumericTypes >(); - add< FromJsonTests::EmbeddedDates >(); + add< FromJsonTests::EmbeddedDatesFormat1 >(); + add< FromJsonTests::EmbeddedDatesFormat2 >(); + add< FromJsonTests::EmbeddedDatesFormat3 >(); } } myall; |