summaryrefslogtreecommitdiff
path: root/s
diff options
context:
space:
mode:
authorAlberto Lerner <alerner@10gen.com>2010-06-06 10:50:39 -0400
committerAlberto Lerner <alerner@10gen.com>2010-06-06 10:50:39 -0400
commit0aa608baa6ce30d2d507b8756de661fa038623d3 (patch)
treecfb5e1ff1def36590328c360c08899e490bb179c /s
parenta3e03d7fe8900f6ea328b3c878e89bad068bc438 (diff)
downloadmongo-0aa608baa6ce30d2d507b8756de661fa038623d3.tar.gz
Move unittest to the usual place (addresses previous Win64 break)
Diffstat (limited to 's')
-rw-r--r--s/balancer_policy.cpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/s/balancer_policy.cpp b/s/balancer_policy.cpp
index 3d44298286b..f7781437b68 100644
--- a/s/balancer_policy.cpp
+++ b/s/balancer_policy.cpp
@@ -17,8 +17,10 @@
*/
#include "pch.h"
-#include "../client/dbclient.h"
+
#include "config.h"
+#include "../client/dbclient.h"
+#include "../util/unittest.h"
#include "balancer_policy.h"
@@ -102,4 +104,26 @@ namespace mongo {
return false;
}
+ class PolicyObjUnitTest : public UnitTest {
+ public:
+ void maxSizeForShard(){
+ BSONObj shard0 = BSON( "maxSize" << 0LL << "currSize" << 0LL );
+ BSONObj shard1 = BSON( "maxSize" << 100LL << "currSize" << 80LL );
+ BSONObj shard2 = BSON( "maxSize" << 100LL << "currSize" << 110LL );
+ map< string, BSONObj > shardLimitsMap;
+ shardLimitsMap["shard0"] = shard0;
+ shardLimitsMap["shard1"] = shard1;
+ shardLimitsMap["shard2"] = shard2;
+
+ assert( BalancerPolicy::isReceiver( "shard0", shardLimitsMap ) );
+ assert( BalancerPolicy::isReceiver( "shard1", shardLimitsMap ) );
+ assert( ! BalancerPolicy::isReceiver( "shard2", shardLimitsMap ) );
+ }
+
+ void run(){
+ maxSizeForShard();
+ log(1) << "policyObjUnitTest passed" << endl;
+ }
+ } policyObjUnitTest;
+
} // namespace mongo