0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 00:56:44 +01:00

Add SIZE label

This commit is contained in:
Aaron 2009-03-27 13:31:13 -04:00
parent 790b17c6a6
commit 8cd20d5ebb
3 changed files with 12 additions and 1 deletions

View File

@ -1174,5 +1174,6 @@ namespace mongo {
Labeler::Label LT( "$lt" ); Labeler::Label LT( "$lt" );
Labeler::Label LTE( "$lte" ); Labeler::Label LTE( "$lte" );
Labeler::Label NE( "$ne" ); Labeler::Label NE( "$ne" );
Labeler::Label SIZE( "$size" );
} // namespace mongo } // namespace mongo

View File

@ -781,6 +781,7 @@ namespace mongo {
extern Labeler::Label LT; extern Labeler::Label LT;
extern Labeler::Label LTE; extern Labeler::Label LTE;
extern Labeler::Label NE; extern Labeler::Label NE;
extern Labeler::Label SIZE;
class BSONObjBuilderValueStream : public boost::noncopyable { class BSONObjBuilderValueStream : public boost::noncopyable {
public: public:

View File

@ -556,6 +556,15 @@ namespace JsobjTests {
} }
}; };
class LabelSize : public LabelBase {
BSONObj expected() {
return BSON( "a" << BSON( "$size" << 4 ) );
}
BSONObj actual() {
return BSON( "a" << SIZE << 4 );
}
};
class LabelMulti : public LabelBase { class LabelMulti : public LabelBase {
BSONObj expected() { BSONObj expected() {
return BSON( "z" << "q" return BSON( "z" << "q"
@ -591,7 +600,6 @@ namespace JsobjTests {
b2.done(); b2.done();
b1.append( "f", 10.0 ); b1.append( "f", 10.0 );
BSONObj ret = b1.done(); BSONObj ret = b1.done();
out() << "ret: " << ret << endl;
ASSERT( ret.valid() ); ASSERT( ret.valid() );
ASSERT( ret.woCompare( fromjson( "{a:'bcd',foo:{ggg:44},f:10}" ) ) == 0 ); ASSERT( ret.woCompare( fromjson( "{a:'bcd',foo:{ggg:44},f:10}" ) ) == 0 );
} }
@ -651,6 +659,7 @@ namespace JsobjTests {
add< ValueStreamTests::LabelShares >(); add< ValueStreamTests::LabelShares >();
add< ValueStreamTests::LabelDouble >(); add< ValueStreamTests::LabelDouble >();
add< ValueStreamTests::LabelDoubleShares >(); add< ValueStreamTests::LabelDoubleShares >();
add< ValueStreamTests::LabelSize >();
add< ValueStreamTests::LabelMulti >(); add< ValueStreamTests::LabelMulti >();
add< ValueStreamTests::Unallowed >(); add< ValueStreamTests::Unallowed >();
add< SubObjectBuilder >(); add< SubObjectBuilder >();