diff --git a/isis/src/base/objs/Constants/Constants.truth b/isis/src/base/objs/Constants/Constants.truth deleted file mode 100644 index 3863b8da0fbd5aec463653bb592c83f45b2b80f1..0000000000000000000000000000000000000000 --- a/isis/src/base/objs/Constants/Constants.truth +++ /dev/null @@ -1,11 +0,0 @@ -Unit test for IsisConstants - -3.141592653589793 -1.570796326794897 -2.718281828459045 -0.0174532925199433 -57.29577951308232 -PI/2 radians is 90 degrees -180 degrees is 3.141592653589793 radians - -8 diff --git a/isis/src/base/objs/Constants/unitTest.cpp b/isis/src/base/objs/Constants/unitTest.cpp deleted file mode 100644 index ee6d494f38326b8158ba9f3495c116e18383b097..0000000000000000000000000000000000000000 --- a/isis/src/base/objs/Constants/unitTest.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#include -#include -#include "Constants.h" -#include "Preference.h" - -using namespace std; - -int main(int argc, char *argv[]) { - Isis::Preference::Preferences(true); - - cout << "Unit test for IsisConstants" << endl; - - cout << setprecision(16) << setw(17) << endl; - cout << Isis::PI << endl; - cout << Isis::HALFPI << endl; - cout << Isis::E << endl; - cout << Isis::DEG2RAD << endl; - cout << Isis::RAD2DEG << endl; - cout << "PI/2 radians is " << Isis::HALFPI *Isis::RAD2DEG << " degrees" << endl; - cout << "180 degrees is " << 180 * Isis::DEG2RAD << " radians" << endl << endl; - - cout << sizeof(Isis::BigInt) << endl; - -} - - - - - - diff --git a/isis/tests/ConstantsTests.cpp b/isis/tests/ConstantsTests.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e5df71944acb9e3b8e10f6ba5c970a7fb94db55b --- /dev/null +++ b/isis/tests/ConstantsTests.cpp @@ -0,0 +1,29 @@ +#include "Constants.h" +#include + +TEST (ConstantsTests, TestPi){ + ASSERT_NEAR(Isis::PI, 3.141592653589793, .000000000000001); +} + + +TEST (ConstantsTests, TestHalfPi){ + ASSERT_NEAR(Isis::PI/2, 1.570796326794897, .000000000000001); +} + +TEST (ConstantsTests, TestE){ + ASSERT_NEAR(Isis::E, 2.718281828459045, .000000000000001); +} + +TEST (ConstantsTests, TestDeg2Rad){ + ASSERT_NEAR(Isis::DEG2RAD, 0.0174532925199433, .000000000000001); + ASSERT_EQ(Isis::DEG2RAD * 180, Isis::PI); +} + +TEST (ConstantsTests, TestRad2Deg){ + ASSERT_NEAR(Isis::RAD2DEG, 57.29577951308232, .000000000000001); + ASSERT_EQ(Isis::RAD2DEG * Isis::PI/2, 90); +} + +TEST (ConstantsTests, TestBigInt){ + ASSERT_EQ(sizeof(Isis::BigInt), 8); +}