Skip to content

Commit

Permalink
Fix incorrect default value of points validity.
Browse files Browse the repository at this point in the history
A default constructed point is an invalid one.
  • Loading branch information
vahancho committed Jun 13, 2019
1 parent f964bf6 commit 1842806
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/point.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Point::Point()
:
m_latitude(0.0),
m_longitude(0.0),
m_isValid(true)
m_isValid(false)
{}

Point::Point(const Latitude &latitude, const Longitude &longitude)
Expand Down
12 changes: 12 additions & 0 deletions test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ static void reportTime(std::chrono::time_point<std::chrono::high_resolution_cloc

int main()
{
{
Point p{};
p.isValid() ? ++s_failed : ++s_passed;
verifyDouble(0.0, p.latitude().degrees(), LOCATION);
verifyDouble(0.0, p.longitude().degrees(), LOCATION);
}
{
spherical::Point p{};
p.isValid() ? ++s_failed : ++s_passed;
verifyDouble(0.0, p.latitude().degrees(), LOCATION);
verifyDouble(0.0, p.longitude().degrees(), LOCATION);
}
{
spherical::Point p1{ 52.205, 0.119 };
spherical::Point p2{ 48.857, 2.351 };
Expand Down

0 comments on commit 1842806

Please sign in to comment.