~evarlast/ubuntu/utopic/mongodb/upstart-workaround-debian-bug-718702

« back to all changes in this revision

Viewing changes to jstests/geo_borders.js

  • Committer: Package Import Robot
  • Author(s): James Page, James Page, Robie Basak
  • Date: 2013-05-29 17:44:42 UTC
  • mfrom: (44.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130529174442-z0a4qmoww4y0t458
Tags: 1:2.4.3-1ubuntu1
[ James Page ]
* Merge from Debian unstable, remaining changes:
  - Enable SSL support:
    + d/control: Add libssl-dev to BD's.
    + d/rules: Enabled --ssl option.
    + d/mongodb.conf: Add example SSL configuration options.
  - d/mongodb-server.mongodb.upstart: Add upstart configuration.
  - d/rules: Don't strip binaries during scons build for Ubuntu.
  - d/control: Add armhf to target archs.
  - d/p/SConscript.client.patch: fixup install of client libraries.
  - d/p/0010-install-libs-to-usr-lib-not-usr-lib64-Closes-588557.patch:
    Install libraries to lib not lib64.
* Dropped changes:
  - d/p/arm-support.patch: Included in Debian.
  - d/p/double-alignment.patch: Included in Debian.
  - d/rules,control: Debian also builds with avaliable system libraries
    now.
* Fix FTBFS due to gcc and boost upgrades in saucy:
  - d/p/0008-ignore-unused-local-typedefs.patch: Add -Wno-unused-typedefs
    to unbreak building with g++-4.8.
  - d/p/0009-boost-1.53.patch: Fixup signed/unsigned casting issue.

[ Robie Basak ]
* d/p/0011-Use-a-signed-char-to-store-BSONType-enumerations.patch: Fixup
  build failure on ARM due to missing signed'ness of char cast.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
numItems = 0;
11
11
 
12
12
for ( var x = min; x <= max; x += step ) {
13
 
        for ( var y = min; y <= max; y += step ) {
14
 
                t.insert( { loc : { x : x, y : y } } )
15
 
                numItems++;
16
 
        }
 
13
    for ( var y = min; y <= max; y += step ) {
 
14
        t.insert( { loc : { x : x, y : y } } )
 
15
        numItems++;
 
16
    }
17
17
}
18
18
 
19
19
overallMin = -1
33
33
 
34
34
// If the bounds are bigger than the box itself, just clip at the borders
35
35
assert.eq( numItems, t.find(
36
 
                { loc : { $within : { $box : [
37
 
                                [ overallMin - 2 * epsilon, overallMin - 2 * epsilon ],
38
 
                                [ overallMax + 2 * epsilon, overallMax + 2 * epsilon ] ] } } } ).count() );
 
36
        { loc : { $within : { $box : [
 
37
                [ overallMin - 2 * epsilon, overallMin - 2 * epsilon ],
 
38
                [ overallMax + 2 * epsilon, overallMax + 2 * epsilon ] ] } } } ).count() );
39
39
 
40
40
// Check this works also for bounds where only a single dimension is off-bounds
41
41
assert.eq( numItems - 5, t.find(
42
 
                { loc : { $within : { $box : [
43
 
                                [ overallMin - 2 * epsilon, overallMin - 0.5 * epsilon ],
44
 
                                [ overallMax - epsilon, overallMax - epsilon ] ] } } } ).count() );
45
 
 
46
 
// Make sure we can get at least close to the bounds of the index
47
 
assert.eq( numItems, t.find(
48
 
                { loc : { $within : { $box : [
49
 
                                [ overallMin - epsilon / 2, overallMin - epsilon / 2 ],
50
 
                                [ overallMax + epsilon / 2, overallMax + epsilon / 2 ] ] } } } ).count() );
51
 
 
52
 
// Make sure we can get at least close to the bounds of the index
53
 
assert.eq( numItems, t.find(
54
 
                { loc : { $within : { $box : [
55
 
                                [ overallMax + epsilon / 2, overallMax + epsilon / 2 ],
56
 
                                [ overallMin - epsilon / 2, overallMin - epsilon / 2 ] ] } } } ).count() );
 
42
        { loc : { $within : { $box : [
 
43
                [ overallMin - 2 * epsilon, overallMin - 0.5 * epsilon ],
 
44
                [ overallMax - epsilon, overallMax - epsilon ] ] } } } ).count() );
 
45
 
 
46
// Make sure we can get at least close to the bounds of the index
 
47
assert.eq( numItems, t.find(
 
48
        { loc : { $within : { $box : [
 
49
                [ overallMin - epsilon / 2, overallMin - epsilon / 2 ],
 
50
                [ overallMax + epsilon / 2, overallMax + epsilon / 2 ] ] } } } ).count() );
 
51
 
 
52
// Make sure we can get at least close to the bounds of the index
 
53
assert.eq( numItems, t.find(
 
54
        { loc : { $within : { $box : [
 
55
                [ overallMax + epsilon / 2, overallMax + epsilon / 2 ],
 
56
                [ overallMin - epsilon / 2, overallMin - epsilon / 2 ] ] } } } ).count() );
57
57
 
58
58
// Check that swapping min/max has good behavior
59
59
assert.eq( numItems, t.find(
60
 
                { loc : { $within : { $box : [
61
 
                                [ overallMax + epsilon / 2, overallMax + epsilon / 2 ],
62
 
                                [ overallMin - epsilon / 2, overallMin - epsilon / 2 ] ] } } } ).count() );
 
60
        { loc : { $within : { $box : [
 
61
                [ overallMax + epsilon / 2, overallMax + epsilon / 2 ],
 
62
                [ overallMin - epsilon / 2, overallMin - epsilon / 2 ] ] } } } ).count() );
63
63
 
64
64
assert.eq( numItems, t.find(
65
 
                { loc : { $within : { $box : [
66
 
                                [ overallMax + epsilon / 2, overallMin - epsilon / 2 ],
67
 
                                [ overallMin - epsilon / 2, overallMax + epsilon / 2 ] ] } } } ).count() );
 
65
        { loc : { $within : { $box : [
 
66
                [ overallMax + epsilon / 2, overallMin - epsilon / 2 ],
 
67
                [ overallMin - epsilon / 2, overallMax + epsilon / 2 ] ] } } } ).count() );
68
68
 
69
69
// **************
70
70
// Circle tests
96
96
// Make sure we get correct corner point when center is on bounds
97
97
// NOTE: Only valid points on MIN bounds
98
98
cornerPt = t
99
 
                .findOne( { loc : { $within : { $center : [ onBoundsNeg, Math.sqrt( 2 * epsilon * epsilon ) + ( step / 2 ) ] } } } );
 
99
        .findOne( { loc : { $within : { $center : [ onBoundsNeg, Math.sqrt( 2 * epsilon * epsilon ) + ( step / 2 ) ] } } } );
100
100
assert.eq( cornerPt.loc.y, overallMin )
101
101
 
102
102
// Make sure we can't get corner point when center is over bounds
103
103
try {
104
 
        t.findOne( { loc : { $within : { $center : [ offBounds, Math.sqrt( 8 * epsilon * epsilon ) + ( step / 2 ) ] } } } );
105
 
        assert( false )
 
104
    t.findOne( { loc : { $within : { $center : [ offBounds, Math.sqrt( 8 * epsilon * epsilon ) + ( step / 2 ) ] } } } );
 
105
    assert( false )
106
106
} catch (e) {
107
107
}
108
108
 
109
109
// Make sure we can't get corner point when center is on max bounds
110
110
try {
111
 
        t.findOne( { loc : { $within : { $center : [ onBounds, Math.sqrt( 8 * epsilon * epsilon ) + ( step / 2 ) ] } } } );
112
 
        assert( false )
 
111
    t.findOne( { loc : { $within : { $center : [ onBounds, Math.sqrt( 8 * epsilon * epsilon ) + ( step / 2 ) ] } } } );
 
112
    assert( false )
113
113
} catch (e) {
114
114
}
115
115
 
125
125
 
126
126
// Make sure we can't get all nearby points to point over boundary
127
127
try {
128
 
        t.findOne( { loc : { $near : offBounds } } )
129
 
        assert( false )
 
128
    t.findOne( { loc : { $near : offBounds } } )
 
129
    assert( false )
130
130
} catch (e) {
131
131
}
132
132
// Make sure we can't get all nearby points to point on max boundary
133
133
try {
134
 
        t.findOne( { loc : { $near : onBoundsNeg } } )
135
 
        assert( false )
 
134
    t.findOne( { loc : { $near : onBoundsNeg } } )
 
135
    assert( false )
136
136
} catch (e) {
137
137
}
138
138
 
151
151
 
152
152
// Make sure we can't get all nearby points to point over boundary
153
153
try {
154
 
        db.runCommand( { geoNear : "borders", near : offBounds } ).results.length
155
 
        assert( false )
 
154
    db.runCommand( { geoNear : "borders", near : offBounds } ).results.length
 
155
    assert( false )
156
156
} catch (e) {
157
157
}
158
158
 
159
159
// Make sure we can't get all nearby points to point on max boundary
160
160
try {
161
 
        db.runCommand( { geoNear : "borders", near : onBounds } ).results.length
162
 
        assert( false )
 
161
    db.runCommand( { geoNear : "borders", near : onBounds } ).results.length
 
162
    assert( false )
163
163
} catch (e) {
164
164
}
165
165