~ubuntu-branches/ubuntu/trusty/mongodb/trusty-proposed

« back to all changes in this revision

Viewing changes to dbtests/sharding.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Antonin Kral
  • Date: 2010-01-29 19:48:45 UTC
  • Revision ID: james.westby@ubuntu.com-20100129194845-8wbmkf626fwcavc9
Tags: upstream-1.3.1
ImportĀ upstreamĀ versionĀ 1.3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// sharding.cpp : some unit tests for sharding internals
 
2
 
 
3
/**
 
4
 *    Copyright (C) 2009 10gen Inc.
 
5
 *
 
6
 *    This program is free software: you can redistribute it and/or  modify
 
7
 *    it under the terms of the GNU Affero General Public License, version 3,
 
8
 *    as published by the Free Software Foundation.
 
9
 *
 
10
 *    This program is distributed in the hope that it will be useful,
 
11
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *    GNU Affero General Public License for more details.
 
14
 *
 
15
 *    You should have received a copy of the GNU Affero General Public License
 
16
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#include "stdafx.h"
 
20
 
 
21
#include "dbtests.h"
 
22
 
 
23
#include "../client/parallel.h"
 
24
 
 
25
namespace ShardingTests {
 
26
 
 
27
    namespace serverandquerytests {
 
28
        class test1 {
 
29
        public:
 
30
            void run(){
 
31
                ServerAndQuery a( "foo:1" , BSON( "a" << GT << 0 << LTE << 100 ) );
 
32
                ServerAndQuery b( "foo:1" , BSON( "a" << GT << 200 << LTE << 1000 ) );
 
33
                
 
34
                ASSERT( a < b );
 
35
                ASSERT( ! ( b < a ) );
 
36
 
 
37
                set<ServerAndQuery> s;
 
38
                s.insert( a );
 
39
                s.insert( b );
 
40
                
 
41
                ASSERT_EQUALS( (unsigned int)2 , s.size() );
 
42
            }
 
43
        };
 
44
    }
 
45
 
 
46
    class All : public Suite {
 
47
    public:
 
48
        All() : Suite( "sharding" ){
 
49
        }
 
50
 
 
51
        void setupTests(){
 
52
            add< serverandquerytests::test1 >();
 
53
        }
 
54
    } myall;
 
55
        
 
56
}