Changeset 4059 for trunk/psLib/test/astronomy/tst_psTime_04.c
- Timestamp:
- May 31, 2005, 12:02:28 PM (21 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/astronomy/tst_psTime_04.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psTime_04.c
r3682 r4059 13 13 * 14 14 * @author Ross Harman, MHPCC 15 * @author Eric Van Alst, MHPCC 15 16 * 16 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $17 * @date $Date: 2005-0 4-07 20:27:41$17 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 18 * @date $Date: 2005-05-31 22:02:25 $ 18 19 * 19 20 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 25 26 #include "psTest.h" 26 27 28 static psS32 testTimeInit1(void); 29 static psS32 testTimeInit2(void); 30 static psS32 testTimeInit3(void); 31 static psS32 testTimeInit4(void); 32 static psS32 testTimeInit5(void); 33 static psS32 testTimeInit6(void); 27 34 28 int main(int argc, char* argv[]) 35 testDescription tests[] = { 36 {testTimeInit1,000,"p_psTimeInit",0,false}, 37 {testTimeInit2,000,"p_psTimeInit",0,false}, 38 {testTimeInit3,000,"p_psTimeInit",0,false}, 39 {testTimeInit4,000,"p_psTimeInit",0,false}, 40 {testTimeInit5,000,"p_psTimeInit",0,false}, 41 {testTimeInit6,000,"p_psTimeInit",0,false}, 42 {NULL} 43 }; 44 45 psS32 main(psS32 argc, char* argv[]) 29 46 { 30 // Test A - Initialize time 31 printPositiveTestHeader(stdout, "psTime", "Test A - Initialize time"); 32 psLibInit(true, "psTime.config"); 33 psLibFinalize(); 34 printFooter(stdout, "psTime", "Test A - Initialize time", true); 35 36 37 // Test B - Attempt to open non-existant time config file 38 printNegativeTestHeader(stdout,"psTime", "Test B - Attempt to open non-existant time config file", 39 "Failed to open file 'zzz'. Check if it exists and it has the proper permissions.", 0); 40 psLibInit(true, "zzz"); 41 printFooter(stdout, "psTime", "Test B - Attempt to open non-existant time config file", true); 42 43 44 // Test C - Attempt to open non-existant time data files 45 printNegativeTestHeader(stdout,"psTime", "Test C - Attempt to open non-existant time data files", 46 "Failed to open file 'zzz'. Check if it exists and it has the proper permissions.", 0); 47 psLibInit(true, "test.psTime.config1"); 48 psLibFinalize(); 49 printFooter(stdout, "psTime", "Test C - Attempt to open non-existant time data files", true); 50 51 52 // Test D - Attempt to read incorrect number of files 53 printNegativeTestHeader(stdout,"psTime", "Test D - Attempt to read incorrect number of files", 54 "Incorrect number of table files entered. Found: 3. Expected: 4.", 0); 55 psLibInit(true, "test.psTime.config2"); 56 psLibFinalize(); 57 printFooter(stdout, "psTime", "Test D - Attempt to read incorrect number of files", true); 58 59 60 // Test E - Attempt to read incorrect number of from values 61 printNegativeTestHeader(stdout,"psTime", "Test E - Attempt to read incorrect number of from values", 62 "Incorrect vector size. Size: 3, Expected 4.", 0); 63 psLibInit(true, "test.psTime.config3"); 64 psLibFinalize(); 65 printFooter(stdout, "psTime", "Test E - Attempt to read incorrect number of from values", true); 66 67 68 // Test F - Attempt to read data file with typo in number 69 printNegativeTestHeader(stdout,"psTime", "Test F - Attempt to read data file with typo in number", 70 "Unable to parse string, number on line 16.", 0); 71 psLibInit(true, "test.psTime.config4"); 72 psLibFinalize(); 73 printFooter(stdout, "psTime", "Test F - Attempt to read data file with typo in number", true); 74 75 76 // Test G - Free data 77 printPositiveTestHeader(stdout, "psTime", "Test G - Free data"); 78 psLibFinalize(); 79 if( psMemCheckLeaks(0, NULL, stdout,false) != 0 ) { 80 psError(PS_ERR_UNKNOWN,true,"Memory leak detected."); 81 return 10; 47 if(!runTestSuite(stderr,"psTime",tests,argc,argv)) { 48 return 1; 82 49 } 83 psMemCheckCorruption(0);84 int nBad = psMemCheckCorruption(0);85 if(nBad) {86 printf("ERROR: Found %d bad memory blocks\n", nBad);87 }88 printFooter(stdout, "psTime", "Test G - Free data", true);89 50 90 51 return 0; 91 52 } 92 53 54 psS32 testTimeInit1(void) 55 { 56 // Test A - Initialize time 57 psLibInit(true, "psTime.config"); 58 psLibFinalize(); 59 60 return 0; 61 } 62 63 psS32 testTimeInit2(void) 64 { 65 // Test B - Attempt to open non-existant time config file 66 psLibInit(true, "zzz"); 67 68 return 0; 69 } 70 71 psS32 testTimeInit3(void) 72 { 73 // Test C - Attempt to open non-existant time data files 74 psLibInit(true, "test.psTime.config1"); 75 psLibFinalize(); 76 77 return 0; 78 } 79 80 psS32 testTimeInit4(void) 81 { 82 // Test D - Attempt to read incorrect number of files 83 psLibInit(true, "test.psTime.config2"); 84 psLibFinalize(); 85 86 return 0; 87 } 88 89 psS32 testTimeInit5(void) 90 { 91 // Test E - Attempt to read incorrect number of from values 92 psLibInit(true, "test.psTime.config3"); 93 psLibFinalize(); 94 95 return 0; 96 } 97 98 psS32 testTimeInit6(void) 99 { 100 // Test F - Attempt to read data file with typo in number 101 psLibInit(true, "test.psTime.config4"); 102 psLibFinalize(); 103 104 return 0; 105 } 106
Note:
See TracChangeset
for help on using the changeset viewer.
