54 std::cout <<
"\nTesting CEAngle:\n";
74 test_double(test1.
Rad(), 0.0, __func__, __LINE__);
78 test_double(test2.Rad(),
base_.
Rad(), __func__, __LINE__);
82 test_double(test3.Rad(),
base_.
Rad(), __func__, __LINE__);
85 double angle_test = M_PI;
88 test_double(test4, angle_test, __func__, __LINE__);
93 test_double(test5,
base_, __func__, __LINE__);
109 double angle_rad = M_PI_2;
111 test_double(test_ang, angle_rad, __func__, __LINE__);
114 double angle_deg = 180.0;
115 std::string angle_deg_str =
"180.0";
117 test_double(test_ang, M_PI, __func__, __LINE__);
121 std::string angle_hms_str1 =
"3:0:0";
122 std::string angle_hms_str2 =
"6 0 0";
123 std::string angle_hms_str3 =
"9.0.0";
125 test_double(test_ang, M_PI_2/2.0, __func__, __LINE__);
127 test_double(test_ang, M_PI_2, __func__, __LINE__);
129 test_double(test_ang, 1.5 * M_PI_2, __func__, __LINE__);
132 std::string angle_dms_str1 =
"45:0:0";
134 test_double(test_ang, M_PI_2/2.0, __func__, __LINE__);
139 test(
false, __func__, __LINE__);
141 test(
true, __func__, __LINE__);
147 test(
false, __func__, __LINE__);
149 test(
true, __func__, __LINE__);
155 test(
false, __func__, __LINE__);
157 test(
true, __func__, __LINE__);
176 test_double(
CEAngle::Deg(180), angle, __func__, __LINE__);
178 test_double(
CEAngle::Rad(angle), angle, __func__, __LINE__);
180 test_double(
CEAngle::Hms(
"12:00:00"), angle, __func__, __LINE__);
181 test_double(
CEAngle::Hms(
"12 00 00"), angle, __func__, __LINE__);
182 test_double(
CEAngle::Hms(
"12.00.00",
'.'), angle, __func__, __LINE__);
184 test_double(
CEAngle::Hms({12.0, 0.0, 0.0, 0.0}), angle, __func__, __LINE__);
186 test_double(
CEAngle::Dms(
"180:00:00"), angle, __func__, __LINE__);
187 test_double(
CEAngle::Dms(
"180 00 00"), angle, __func__, __LINE__);
188 test_double(
CEAngle::Dms(
"180'00'00",
'\''), angle, __func__, __LINE__);
190 test_double(
CEAngle::Dms({180, 0, 0, 0.0}), angle, __func__, __LINE__);
194 double test_deg = 315.25;
195 CEAngle test_ang(test_deg * DD2R);
198 test_double(test_ang.
Deg(), test_deg, __func__, __LINE__);
201 test_double(test_ang.
Rad(), test_deg*DD2R, __func__, __LINE__);
204 std::string hms_str = test_ang.
HmsStr(
'\'');
205 hms_str = std::string(hms_str.begin(), hms_str.begin()+11);
206 test_string(hms_str,
"21'01'00.00", __func__, __LINE__);
209 test_vect(test_ang.
HmsVect(), {21, 1, 0, 0}, __func__, __LINE__);
212 std::string dms_str = test_ang.
DmsStr(
'"');
213 dms_str = std::string(dms_str.begin(), dms_str.begin()+12);
214 test_string(dms_str,
"315\"15\"00.00", __func__, __LINE__);
217 test_vect(test_ang.
DmsVect(), {315, 15, 0, 0}, __func__, __LINE__);
220 test_double(test_ang, test_deg*DD2R, __func__, __LINE__);
221 const CEAngle test_ang2(test_ang);
223 test_double(test_ang2, test_deg*DD2R, __func__, __LINE__);
232 test(
false,
"HMS bad hours exception", __func__, __LINE__);
234 test(
true,
"HMS bad hours exception", __func__, __LINE__);
239 test(
false,
"HMS bad minutes exception", __func__, __LINE__);
241 test(
true,
"HMS bad minutes exception", __func__, __LINE__);
246 test(
false,
"HMS bad seconds exception", __func__, __LINE__);
248 test(
true,
"HMS bad seconds exception", __func__, __LINE__);
254 test(
false,
"DMS bad degrees exception", __func__, __LINE__);
256 test(
true,
"DMS bad degrees exception", __func__, __LINE__);
261 test(
false,
"DMS bad arcmins exception", __func__, __LINE__);
263 test(
true,
"DMS bad arcmins exception", __func__, __LINE__);
268 test(
false,
"DMS bad arcsecs exception", __func__, __LINE__);
270 test(
true,
"DMS bad arcsecs exception", __func__, __LINE__);
280 int main(
int argc,
char** argv)