📄 ppf_genref_valid.c
字号:
#include <stdio.h>#include <math.h>#include <string.h>#include <ppf_genref.h>/* This version number is the SCCS version number valid only for internal configuration and control. *//* The oficial version number can be found in the History box below. */static char PPF_GENREF_VALID_C [] = "@(#)ppf_genref_valid.c 1.13 00/04/13";/***************************************************************************************** * * Copyright : DEIMOS Space S.L. * Project : REMASE * * Test level : VALIDATION * * Module : ppf_genref_valid.c * Purpose : It runs validation tests of PPF_GENREF * * History +------------------------------------------------------------------------+ * | Version | Date | Name | Change | * |---------|----------|--------------|------------------------------------| * | 2.1 | 05/12/97 | GMV, S.A. | First release | * | 2.2 | 18/05/98 | GMV, S.A. | Second release | * | 2.3 | 13/10/98 | GMV, S.A. | Third release | * | 2.4 | 25/05/99 | GMV, S.A. | Fourth release | * | 2.5 | 14/04/00 | GMV, S.A. | Fifth release | * | 2.6 | 22/06/01 | GMV, S.A. | Sixth release | * | 2.7 | 31/07/01 | GMV, S.A. | Seventh release | * | 2.8 | 22/10/01 | DEIMOS Space | Eigth release | * | 3.0 | 18/01/02 | DEIMOS Space | Ninth release | * | 3.1 | 25/11/02 | DEIMOS Space | Tenth release | * | 3.2 | 26/05/03 | DEIMOS Space | Eleventh release | * | 3.3 | 13/12/04 | DEIMOS Space | Twelfth release | * | 3.3.1 | 15/02/05 | DEIMOS Space | Thirteenth release | * | 3.4 | 17/05/05 | DEIMOS Space | Forteenth release | * +------------------------------------------------------------------------+ * ****************************************************************************************/#define MAX_LENGTH 256/* Macro definition *//* ---------------- */#define MAX_CONDITION 1000 /* Maximum number of checks per test case */#define START_VALIDATION int main(int argc, char *argv[]){ \ double di,th,ta,tb,sinta,costa,sintb,costb; \ double di_l,di_r,th_l,th_r; \ int i,j; \ int checks; \ PL_Boolean condition[MAX_CONDITION]; \ PL_Boolean result;#define START_CHECK(msg) printf(" *** %s\n",msg); \ checks = 0;#define END_CHECK result = PL_TRUE; \ for (i = 0 ; i < checks ; i++) \ { \ if (condition[i] == PL_FALSE) \ { \ result = PL_FALSE; \ break; \ } \ } \ if (result == PL_TRUE) \ { \ printf(" *** RESULT = PASS ***\n\n"); \ } \ else \ { \ printf(" *** RESULT = FAIL ***\n\n"); \ }#define CHECK_STATUS(msg,stat) if (stat < PG_OK ) { \ condition[checks] = PL_FALSE; \ printf(" ...\t%s (PL_FALSE)\n",msg); \ }else{ \ condition[checks] = PL_TRUE; \ printf(" ...\t%s (PL_TRUE)\n",msg); \ } \ checks++; #define CHECK_PAR(msg,p,p0,dp) if((di=fabs(p-p0)) <= (th=dp)){ \ condition[checks] = PL_TRUE; \ printf(" ...\t%s (PL_TRUE)\n",msg); \ }else{ \ condition[checks] = PL_FALSE; \ printf(" ...\t%s (PL_FALSE)\n",msg); \ } \ printf("\t\t Threshold : %g\n",th); \ printf("\t\t Difference : %g\n",di); \ checks++;#define CHECK_VEC(msg,v,v0,im,iM,dp) for(i=im;i<=iM;++i){ \ CHECK_PAR(msg,v[i],v0[i],dp); \ }#define END_VALIDATION return(0); \ }typedef enum{PL_FALSE = 0, /* False variable */PL_TRUE = 1 /* True variable */} PL_Boolean;/* Validation for PPF_POINTING *//* --------------------------- */START_VALIDATION/* Local variables definition *//* -------------------------- */ long status; /* Main status flag */ long local_status; long n_msg, n; /* Number of error messages */ long func_id; /* CFI function ID */ char msg[PG_MAX_COD][PG_MAX_STR]; /* Error messages vector */ long code[PG_MAX_COD]; /* Error codes vector */ long k;/* pg_genoef variables *//* ------------------- */ long start_orbit, stop_orbit, ierr_genoef_t[10]; char osf_name[MAX_LENGTH], oef_name[MAX_LENGTH];/* pg_genswath variables *//* --------------------- */ long req_orbit; long rep_cycl, cycl_length; long ierr_genswath_t[36]; char sdf_name[MAX_LENGTH], stf_name[MAX_LENGTH];/***************************************************************************************** * * --------- * Test case * --------- * * Test number : VT-1 * ****************************************************************************************/START_CHECK("Check that GENOEF status is OK")/* Calling pg_genoef *//* ------------------- */ start_orbit=0; stop_orbit=279; strcpy(osf_name, "../example/data/MPS_ORB_SCTEMM19970829_093100_00000000_00000000_19970101_000000_20991231_000000.N1"); strcpy(oef_name,""); n = 0; sprintf(msg[n++], "\n\nPG_GENOEF\n"); pg_print_msg(&n, msg); local_status = pg_genoef(osf_name, &start_orbit, &stop_orbit, oef_name, ierr_genoef_t); CHECK_STATUS("genoef status", local_status) if (local_status != PG_OK) { func_id = PG_GENOEF_ID; pg_vector_msg(&func_id, ierr_genoef_t, &n, msg); pg_print_msg(&n, msg); }END_CHECK/***************************************************************************************** * * --------- * Test case * --------- * * Test number : VT-2 * ****************************************************************************************/START_CHECK("Check that GENSWATH status is OK")/* Calling pg_genswath *//* -------------------- */ req_orbit=0; rep_cycl=35; cycl_length=501; strcpy(osf_name, "../example/data/MPL_ORB_SCTRGT19970515_120000_00000000_00000000_19950101_000000_20100101_000000.N1"); strcpy(sdf_name,"../example/data/SDF_MERIS.1200pts.N1"); strcpy(stf_name,""); n = 0; sprintf(msg[n++], "\n\nPG_GENSWATH\n"); pg_print_msg(&n, msg); local_status = pg_genswath(osf_name, &req_orbit, sdf_name, stf_name, &rep_cycl, &cycl_length, ierr_genswath_t); CHECK_STATUS("genswath status", local_status) if (status != PG_OK) { func_id = PG_GENSWATH_ID; pg_vector_msg(&func_id, ierr_genswath_t, &n, msg); pg_print_msg(&n, msg); }END_CHECKEND_VALIDATION
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -