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

« back to all changes in this revision

Viewing changes to src/third_party/s2/s2pointregion_test.cc

  • 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:
 
1
// Copyright 2005 Google Inc. All Rights Reserved.
 
2
 
 
3
#include "s2pointregion.h"
 
4
 
 
5
#include "testing/base/public/gunit.h"
 
6
#include "util/coding/coder.h"
 
7
#include "s2cap.h"
 
8
#include "s2cell.h"
 
9
#include "s2latlngrect.h"
 
10
 
 
11
namespace {
 
12
 
 
13
TEST(S2PointRegionTest, Basic) {
 
14
  S2Point p(1, 0, 0);
 
15
  S2PointRegion r0(p);
 
16
  EXPECT_EQ(r0.point(), p);
 
17
  EXPECT_TRUE(r0.Contains(p));
 
18
  EXPECT_TRUE(r0.VirtualContainsPoint(p));
 
19
  EXPECT_TRUE(r0.VirtualContainsPoint(r0.point()));
 
20
  EXPECT_FALSE(r0.VirtualContainsPoint(S2Point(1, 0, 1)));
 
21
  scoped_ptr<S2PointRegion> r0_clone(r0.Clone());
 
22
  EXPECT_EQ(r0_clone->point(), r0.point());
 
23
  EXPECT_EQ(r0.GetCapBound(), S2Cap::FromAxisHeight(p, 0));
 
24
  S2LatLng ll(p);
 
25
  EXPECT_EQ(r0.GetRectBound(), S2LatLngRect(ll, ll));
 
26
 
 
27
  // The leaf cell containing a point is still much larger than the point.
 
28
  S2Cell cell(p);
 
29
  EXPECT_FALSE(r0.Contains(cell));
 
30
  EXPECT_TRUE(r0.MayIntersect(cell));
 
31
}
 
32
 
 
33
TEST(S2PointRegionTest, EncodeAndDecode) {
 
34
  S2Point p(.6, .8, 0);
 
35
  S2PointRegion r(p);
 
36
 
 
37
  Encoder encoder;
 
38
  r.Encode(&encoder);
 
39
 
 
40
  Decoder decoder(encoder.base(), encoder.length());
 
41
  S2PointRegion decoded_r(S2Point(1, 0, 0));
 
42
  decoded_r.Decode(&decoder);
 
43
  S2Point decoded_p = decoded_r.point();
 
44
 
 
45
  EXPECT_EQ(0.6, decoded_p[0]);
 
46
  EXPECT_EQ(0.8, decoded_p[1]);
 
47
  EXPECT_EQ(0.0, decoded_p[2]);
 
48
}
 
49
 
 
50
}  // namespace