Skip to content
Snippets Groups Projects
Unverified Commit f8c81124 authored by AustinSanders's avatar AustinSanders Committed by GitHub
Browse files

Initial constants unit gtest (#4081)

* Initial constants unit gtest

* removed old test files
parent 58415b93
No related branches found
No related tags found
No related merge requests found
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
#include <iostream>
#include <iomanip>
#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;
}
#include "Constants.h"
#include <gtest/gtest.h>
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);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment