00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <stdio.h>
00038 #include <stdlib.h>
00039 #include <string.h>
00040 #include "Basic.h"
00041 #include "time_conversion.h"
00042 #include "test_geodesy.h"
00043 #include "test_time_conversion.h"
00044 #include "test_novatel.h"
00045 #include "test_yuma.h"
00046 #include "test_ionosphere.h"
00047 #include "test_rinex.h"
00048
00049
00050
00051 int AddTests();
00052
00053
00054 static void print_system_time(void);
00055
00056 int main(int argc, char* argv[])
00057 {
00058 CU_BasicRunMode mode = CU_BRM_VERBOSE;
00059 CU_ErrorAction error_action = CUEA_IGNORE;
00060 int i;
00061
00062 setvbuf(stdout, NULL, _IONBF, 0);
00063
00064 for (i=1 ; i<argc ; i++)
00065 {
00066 if (!strcmp("-i", argv[i]))
00067 {
00068 error_action = CUEA_IGNORE;
00069 }
00070 else if (!strcmp("-f", argv[i]))
00071 {
00072 error_action = CUEA_FAIL;
00073 }
00074 else if (!strcmp("-A", argv[i]))
00075 {
00076 error_action = CUEA_ABORT;
00077 }
00078 else if (!strcmp("-s", argv[i]))
00079 {
00080 mode = CU_BRM_SILENT;
00081 }
00082 else if (!strcmp("-n", argv[i]))
00083 {
00084 mode = CU_BRM_NORMAL;
00085 }
00086 else if (!strcmp("-v", argv[i]))
00087 {
00088 mode = CU_BRM_VERBOSE;
00089 }
00090
00091
00092
00093
00094
00095
00096
00097 else
00098 {
00099 printf("\nUsage: eGNSS_Test [options]\n\n"
00100 "Options: -i ignore framework errors [default].\n"
00101 " -f fail on framework error.\n"
00102 " -A abort on framework error.\n\n"
00103 " -s silent mode - no output to screen.\n"
00104 " -n normal mode - standard output to screen.\n"
00105 " -v verbose mode - max output to screen [default].\n\n"
00106
00107 " -h print this message and exit.\n\n");
00108 return 0;
00109 }
00110 }
00111
00112
00113 print_system_time();
00114
00115 if (CU_initialize_registry())
00116 {
00117 printf("\nInitialization of Test Registry failed.");
00118 }
00119 else
00120 {
00121 if( AddTests() == CUE_SUCCESS )
00122 {
00123 CU_basic_set_mode(mode);
00124 CU_set_error_action(error_action);
00125 printf("\nTests completed with return value %d.\n", CU_basic_run_tests());
00126 }
00127 CU_cleanup_registry();
00128 }
00129
00130 return 0;
00131 }
00132
00133
00134
00135
00136
00137
00138 int AddTests()
00139 {
00140 CU_pSuite pSuite = NULL;
00141
00142
00143
00144
00145 pSuite = CU_add_suite("GEODESY", init_suite_GEODESY, clean_suite_GEODESY);
00146 if (NULL == pSuite)
00147 return CU_get_error();
00148
00149
00150 if( CU_add_test(pSuite, "GEODESY_GetReferenceEllipseParameters()", test_GEODESY_GetReferenceEllipseParameters) == NULL )
00151 return CU_get_error();
00152 if( CU_add_test(pSuite, "test_GEODESY_ConvertCoordinates()", test_GEODESY_ConvertCoordinates) == NULL )
00153 return CU_get_error();
00154 if( CU_add_test(pSuite, "GEODESY_ComputeNorthingEastingVertical()", test_GEODESY_ComputeNorthingEastingVertical) == NULL )
00155 return CU_get_error();
00156 if( CU_add_test(pSuite, "GEODESY_ComputePositionDifference()", test_GEODESY_ComputePositionDifference) == NULL )
00157 return CU_get_error();
00158 if( CU_add_test(pSuite, "GEODESY_ComputeMeridianRadiusOfCurvature()", test_GEODESY_ComputeMeridianRadiusOfCurvature) == NULL )
00159 return CU_get_error();
00160 if( CU_add_test(pSuite, "GEODESY_ComputePrimeVerticalRadiusOfCurvature()", test_GEODESY_ComputePrimeVerticalRadiusOfCurvature) == NULL )
00161 return CU_get_error();
00162 if( CU_add_test(pSuite, "GEODESY_ComputeMeridianArcBetweenTwoLatitudes()", test_GEODESY_ComputeMeridianArcBetweenTwoLatitudes) == NULL )
00163 return CU_get_error();
00164 if( CU_add_test(pSuite, "GEODESY_ComputeParallelArcBetweenTwoLongitudes()", test_GEODESY_ComputeParallelArcBetweenTwoLongitudes) == NULL )
00165 return CU_get_error();
00166 if( CU_add_test(pSuite, "GEODESY_RotateVectorFromLocalGeodeticFrameToEarthFixedFrame()", test_GEODESY_RotateVectorFromLocalGeodeticFrameToEarthFixedFrame) == NULL )
00167 return CU_get_error();
00168 if( CU_add_test(pSuite, "GEODESY_RotateVectorFromEarthFixedFrameToLocalGeodeticFrame()", test_GEODESY_RotateVectorFromEarthFixedFrameToLocalGeodeticFrame) == NULL )
00169 return CU_get_error();
00170 if( CU_add_test(pSuite, "GEODESY_ComputeAzimuthAndElevationAnglesBetweenToPointsInTheEarthFixedFrame()", test_GEODESY_ComputeAzimuthAndElevationAnglesBetweenToPointsInTheEarthFixedFrame) == NULL )
00171 return CU_get_error();
00172
00173
00174
00175
00176
00177 pSuite = CU_add_suite("TIMECONV", init_suite_GEODESY, clean_suite_GEODESY);
00178 if (NULL == pSuite)
00179 return CU_get_error();
00180
00181
00182 if( CU_add_test(pSuite, "TIMECONV_GetJulianDateFromGPSTime()", test_TIMECONV_GetJulianDateFromGPSTime) == NULL )
00183 return CU_get_error();
00184 if( CU_add_test(pSuite, "TIMECONV_GetJulianDateFromUTCTime()", test_TIMECONV_GetJulianDateFromUTCTime) == NULL )
00185 return CU_get_error();
00186 if( CU_add_test(pSuite, "TIMECONV_GetGPSTimeFromJulianDate()", test_TIMECONV_GetGPSTimeFromJulianDate) == NULL )
00187 return CU_get_error();
00188 if( CU_add_test(pSuite, "TIMECONV_GetUTCTimeFromJulianDate()", test_TIMECONV_GetUTCTimeFromJulianDate) == NULL )
00189 return CU_get_error();
00190 if( CU_add_test(pSuite, "TIMECONV_GetGPSTimeFromUTCTime()", test_TIMECONV_GetGPSTimeFromUTCTime) == NULL )
00191 return CU_get_error();
00192 if( CU_add_test(pSuite, "TIMECONV_GetUTCTimeFromGPSTime()", test_TIMECONV_GetUTCTimeFromGPSTime) == NULL )
00193 return CU_get_error();
00194 if( CU_add_test(pSuite, "TIMECONV_DetermineUTCOffset()", test_TIMECONV_DetermineUTCOffset) == NULL )
00195 return CU_get_error();
00196 if( CU_add_test(pSuite, "TIMECONV_GetNumberOfDaysInMonth()", test_TIMECONV_GetNumberOfDaysInMonth) == NULL )
00197 return CU_get_error();
00198 if( CU_add_test(pSuite, "TIMECONV_IsALeapYear()", test_TIMECONV_IsALeapYear) == NULL )
00199 return CU_get_error();
00200 if( CU_add_test(pSuite, "TIMECONV_GetDayOfYear()", test_TIMECONV_GetDayOfYear) == NULL )
00201 return CU_get_error();
00202 if( CU_add_test(pSuite, "TIMECONV_GetGPSTimeFromYearAndDayOfYear()", test_TIMECONV_GetGPSTimeFromYearAndDayOfYear) == NULL )
00203 return CU_get_error();
00204
00205
00206 pSuite = CU_add_suite("NOVATELOEM4", init_suite_GEODESY, clean_suite_GEODESY);
00207 if (NULL == pSuite)
00208 return CU_get_error();
00209
00210
00211 if( CU_add_test(pSuite, "NOVATELOEM4_FindNextMessageInFile()", test_NOVATELOEM4_FindNextMessageInFile) == NULL )
00212 return CU_get_error();
00213 if( CU_add_test(pSuite, "NOVATELOEM4_DecodeRANGEB()", test_NOVATELOEM4_DecodeRANGEB) == NULL )
00214 return CU_get_error();
00215 if( CU_add_test(pSuite, "NOVATELOEM4_DecodeRANGECMPB()", test_NOVATELOEM4_DecodeRANGECMPB) == NULL )
00216 return CU_get_error();
00217 if( CU_add_test(pSuite, "NOVATELOEM4_DecodeRAWEPHEMB()", test_NOVATELOEM4_DecodeRAWEPHEMB) == NULL )
00218 return CU_get_error();
00219
00220
00221
00222
00223 pSuite = CU_add_suite("YUMA", init_suite_YUMA, clean_suite_YUMA);
00224 if (NULL == pSuite)
00225 return CU_get_error();
00226
00227
00228 if( CU_add_test(pSuite, "YUMA_ReadAlmanacDataFromFile()", test_YUMA_ReadAlmanacDataFromFile) == NULL )
00229 return CU_get_error();
00230 if( CU_add_test(pSuite, "YUMA_WriteAlmanacDataToFile()", test_YUMA_WriteAlmanacDataToFile) == NULL )
00231 return CU_get_error();
00232 if( CU_add_test(pSuite, "YUMA_WriteSingleAlmanacElementToBuffer()", test_YUMA_WriteSingleAlmanacElementToBuffer) == NULL )
00233 return CU_get_error();
00234
00235
00236 pSuite = CU_add_suite("IONOSPHERE", init_suite_YUMA, clean_suite_YUMA);
00237 if (NULL == pSuite)
00238 return CU_get_error();
00239
00240
00241 if( CU_add_test(pSuite, "IONOSPHERE_GetL1KlobucharCorrection()", test_IONOSPHERE_GetL1KlobucharCorrection) == NULL )
00242 return CU_get_error();
00243
00244
00245 pSuite = CU_add_suite("RINEX", init_suite_RINEX, clean_suite_RINEX);
00246 if (NULL == pSuite)
00247 return CU_get_error();
00248
00249
00250 if( CU_add_test(pSuite, "RINEX_GetHeader()", test_RINEX_GetHeader) == NULL )
00251 return CU_get_error();
00252 if( CU_add_test(pSuite, "RINEX_DecodeHeader_ObservationFile()", test_RINEX_DecodeHeader_ObservationFile) == NULL )
00253 return CU_get_error();
00254 if( CU_add_test(pSuite, "RINEX_GetNextObservationSet()", test_RINEX_GetNextObservationSet) == NULL )
00255 return CU_get_error();
00256 if( CU_add_test(pSuite, "RINEX_DecodeGPSNavigationFile()", test_RINEX_DecodeGPSNavigationFile) == NULL )
00257 return CU_get_error();
00258 if( CU_add_test(pSuite, "RINEX_GetKlobucharIonoParametersFromNavFile()", test_RINEX_GetKlobucharIonoParametersFromNavFile) == NULL )
00259 return CU_get_error();
00260
00261 return CUE_SUCCESS;
00262 }
00263
00264
00265
00266 void print_system_time(void)
00267 {
00268 BOOL result;
00269 unsigned short utc_year;
00270 unsigned char utc_month;
00271 unsigned char utc_day;
00272 unsigned char utc_hour;
00273 unsigned char utc_minute;
00274 float utc_seconds;
00275 unsigned char utc_offset;
00276 double julian_date;
00277 unsigned short gps_week;
00278 double gps_tow;
00279
00280 result = TIMECONV_GetSystemTime(
00281 &utc_year,
00282 &utc_month,
00283 &utc_day,
00284 &utc_hour,
00285 &utc_minute,
00286 &utc_seconds,
00287 &utc_offset,
00288 &julian_date,
00289 &gps_week,
00290 &gps_tow
00291 );
00292
00293 if( result == 0 )
00294 return;
00295
00296 printf( "\nDate YYYY-MM-DD, Time HH:MM:SS, of test (UTC).\n");
00297 printf( " %4d-%02d-%02d, %02d:%02d:%02.0f\n",
00298 utc_year,
00299 utc_month,
00300 utc_day,
00301 utc_hour,
00302 utc_minute,
00303 utc_seconds );
00304 return;
00305 }