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

57 lines
1.5 KiB
C++
Raw Normal View History

2010-01-14 16:37:03 +01:00
// sharding.cpp : some unit tests for sharding internals
/**
* Copyright (C) 2009 10gen Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
2010-04-27 21:33:27 +02:00
#include "pch.h"
2010-01-14 16:37:03 +01:00
#include "dbtests.h"
#include "../client/parallel.h"
namespace ShardingTests {
namespace serverandquerytests {
class test1 {
public:
2011-01-04 06:40:41 +01:00
void run() {
2010-01-14 16:37:03 +01:00
ServerAndQuery a( "foo:1" , BSON( "a" << GT << 0 << LTE << 100 ) );
ServerAndQuery b( "foo:1" , BSON( "a" << GT << 200 << LTE << 1000 ) );
2011-01-04 06:40:41 +01:00
2010-01-14 16:37:03 +01:00
ASSERT( a < b );
ASSERT( ! ( b < a ) );
set<ServerAndQuery> s;
s.insert( a );
s.insert( b );
2011-01-04 06:40:41 +01:00
2010-01-14 16:42:55 +01:00
ASSERT_EQUALS( (unsigned int)2 , s.size() );
2010-01-14 16:37:03 +01:00
}
};
}
class All : public Suite {
public:
2011-01-04 06:40:41 +01:00
All() : Suite( "sharding" ) {
2010-01-14 16:37:03 +01:00
}
2011-01-04 06:40:41 +01:00
void setupTests() {
2010-01-14 16:37:03 +01:00
add< serverandquerytests::test1 >();
}
} myall;
2011-01-04 06:40:41 +01:00
2010-01-14 16:37:03 +01:00
}