Skip to content

Commit

Permalink
Added LatitudeTest using Gtest (#3160)
Browse files Browse the repository at this point in the history
* Added gtest for ID and split TestUtilities into a cpp and h file to fix duplicate symbol error when building.

* Created LatitudeTests.
  • Loading branch information
kaitlyndlee authored and jessemapel committed Mar 26, 2019
1 parent 3a64628 commit d3b4d2e
Show file tree
Hide file tree
Showing 5 changed files with 451 additions and 3 deletions.
6 changes: 4 additions & 2 deletions isis/src/base/objs/Angle/Angle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ namespace Isis {
IString msg = "Cannot compare a invalid angles with the < operator";
throw IException(IException::Programmer, msg, _FILEINFO_);
}

// != comparison allows for angles that are considered equal to be treated
// as being equal. == operator override uses qFuzzyCompare().
return (angle(Radians) < angle2.angle(Radians)) && *this != angle2;
}

Expand All @@ -242,7 +243,8 @@ namespace Isis {
IString msg = "Cannot compare a invalid angles with the > operator";
throw IException(IException::Programmer, msg, _FILEINFO_);
}

// != comparison allows for angles that are considered equal to be treated
// as being equal. == operator override uses qFuzzyCompare().
return (angle(Radians) > angle2.angle(Radians)) && *this != angle2;
}

Expand Down
2 changes: 2 additions & 0 deletions isis/src/base/objs/Angle/Angle.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ namespace Isis {
* method in the SpecialPixel header. References #1659.
* @history 2017-07-03 Makayla Shepherd - Updated documentation. References #4807.
* @history 2018-11-13 Kristin Berry - Made protected methods public as part of testing refactor.
* @history 2019-03-11 Kaitlyn Lee - Added comments to > and < operators to clarify why
* the != comparison was needed.
*/
class Angle {

Expand Down
5 changes: 4 additions & 1 deletion isis/src/base/objs/Latitude/Latitude.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,10 @@ namespace Isis {
throw IException(IException::Programmer, msg, _FILEINFO_);
}

if (IsSpecial(latitude)) {
// Since the Angle constructor handles special pixels, we will never get to this line of code
// when passing in a special pixel.
// Left this here just in case the functionality in Angle changes.
if (IsSpecial(latitude)) {
QString msg = "Invalid planetographic latitudes are not currently "
"supported";
throw IException(IException::Programmer, msg, _FILEINFO_);
Expand Down
2 changes: 2 additions & 0 deletions isis/src/base/objs/Latitude/Latitude.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ namespace Isis {
* instead of the Isis::toString(double) method.
* @history 2017-04-10 Jesse Mapel - Added an accessor and mutator for ErrorChecking member.
* Fixes #4766.
* @history 2019-03-11 Kaitlyn Lee - Added comment in SetPlanetographic() about passing in
* special pixels.
*/
class Latitude : public Angle {
public:
Expand Down
Loading

0 comments on commit d3b4d2e

Please sign in to comment.