MCPcopy Create free account
hub / github.com/comaps/comaps / UNIT_TEST

Function UNIT_TEST

libs/coding/coding_tests/point_coding_tests.cpp:41–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39} // namespace
40
41UNIT_TEST(PointDToPointU_Epsilons)
42{
43 m2::PointD const arrPt[] = {{-180, -180}, {-180, 180}, {180, 180}, {180, -180}};
44 m2::PointD const arrD[] = {{1, 1}, {1, -1}, {-1, -1}, {-1, 1}};
45 size_t const count = ARRAY_SIZE(arrPt);
46
47 double eps = 1.0;
48 while (true)
49 {
50 size_t i = 0;
51 for (; i < count; ++i)
52 {
53 m2::PointU p0 = PointDToPointU(arrPt[i].x, arrPt[i].y, kCoordBits);
54 m2::PointU p1 = PointDToPointU(arrPt[i].x + arrD[i].x * eps, arrPt[i].y + arrD[i].y * eps, kCoordBits);
55
56 if (p0 != p1)
57 break;
58 }
59 if (i == count)
60 break;
61
62 eps *= 0.1;
63 }
64
65 LOG(LINFO, ("Epsilon (relative error) =", eps));
66
67 for (size_t i = 0; i < count; ++i)
68 {
69 m2::PointU const p1 = PointDToPointU(arrPt[i].x, arrPt[i].y, kCoordBits);
70 m2::PointU const p2(p1.x + arrD[i].x, p1.y + arrD[i].y);
71 m2::PointD const p3 = PointUToPointD(p2, kCoordBits);
72
73 LOG(LINFO, ("Dx =", p3.x - arrPt[i].x, "Dy =", p3.y - arrPt[i].y));
74 }
75}
76
77UNIT_TEST(PointDToPointU_WithLimitRect)
78{

Callers

nothing calls this directly

Calls 14

PointDToPointUFunction · 0.85
PointUToPointDFunction · 0.85
GetCoordBitsFunction · 0.85
TESTFunction · 0.85
CheckEqualPointsFunction · 0.85
Int64ToPointObsoleteFunction · 0.85
PointToInt64ObsoleteFunction · 0.85
PointUToUint64ObsoleteFunction · 0.85
Uint64ToPointUObsoleteFunction · 0.85
minXMethod · 0.80
maxXMethod · 0.80
minYMethod · 0.80

Tested by

no test coverage detected