Changeset 1445
- Timestamp:
- Aug 9, 2004, 3:39:37 PM (22 years ago)
- Location:
- trunk/psLib/test
- Files:
-
- 2 edited
-
astronomy/tst_psMetadata_05.c (modified) (4 diffs)
-
collections/tst_psMetadata_05.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/astronomy/tst_psMetadata_05.c
r1444 r1445 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-10 01: 14:46$13 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-10 01:39:37 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 59 59 int main( int argc, char* argv[] ) 60 60 { 61 long data; 61 62 psMetadataItem *item1 = NULL; 62 63 psMetadataItem *item2 = NULL; … … 131 132 printf("ERROR: Couldn't open file for writing\n"); 132 133 } 133 psMetadataItemPrint(fd, " Item value:%ld", item2);134 psMetadataItemPrint(fd, "%ld", item2); 134 135 printFooter(stdout, "psMetadata", "Test F - Write metadata item to file", true); 135 136 137 // Test F - Attempt to use null metadata with setIterator 138 printNegativeTestHeader(stdout,"psMetadata", "Test F - Attempt to use null metadata with setIterator", 136 fclose(fd); 137 fd = fopen("./tst_psMetadata05_OUT", "r"); 138 if(fd == NULL) { 139 printf("ERROR: Couldn't open file for reading\n"); 140 } 141 fscanf(fd, "%ld", &data); 142 fclose(fd); 143 if(data != 55) { 144 printf("ERROR: Data in file is not as expected. Value: %ld. Should be: 55.\n", data); 145 } 146 147 148 // Test G - Attempt to use null metadata with setIterator 149 printNegativeTestHeader(stdout,"psMetadata", "Test G - Attempt to use null metadata with setIterator", 139 150 "Null metadata collection not allowed", 0); 140 151 psMetadataSetIterator(NULL, 0); 141 printFooter(stdout, "psMetadata", "Test F- Attempt to use null metadata with setIterator", true);142 143 144 // Test G- Attempt to use null metadata with getNext145 printNegativeTestHeader(stdout,"psMetadata", "Test G- Attempt to use null metadata with getNext",152 printFooter(stdout, "psMetadata", "Test G - Attempt to use null metadata with setIterator", true); 153 154 155 // Test H - Attempt to use null metadata with getNext 156 printNegativeTestHeader(stdout,"psMetadata", "Test H - Attempt to use null metadata with getNext", 146 157 "Null metadata collection not allowed", 0); 147 158 psMetadataGetNext(NULL, "myItem2", 0); 148 printFooter(stdout, "psMetadata", "Test G- Attempt to use null metadata with getNext", true);149 150 151 // Test H- Attempt to use null metadata with getPrevious152 printNegativeTestHeader(stdout,"psMetadata", "Test H- Attempt to use null metadata with getPrevious",159 printFooter(stdout, "psMetadata", "Test H - Attempt to use null metadata with getNext", true); 160 161 162 // Test I - Attempt to use null metadata with getPrevious 163 printNegativeTestHeader(stdout,"psMetadata", "Test I - Attempt to use null metadata with getPrevious", 153 164 "Null metadata collection not allowed", 0); 154 165 psMetadataGetPrevious(NULL, "myItem2", 0); 155 printFooter(stdout, "psMetadata", "Test H- Attempt to use null metadata with getPrevious", true);156 157 158 // Test I- Attempt to use null file with itemPrint159 printNegativeTestHeader(stdout,"psMetadata", "Test I- Attempt to use null file with itemPrint",166 printFooter(stdout, "psMetadata", "Test I - Attempt to use null metadata with getPrevious", true); 167 168 169 // Test J - Attempt to use null file with itemPrint 170 printNegativeTestHeader(stdout,"psMetadata", "Test J - Attempt to use null file with itemPrint", 160 171 "Null file descriptor not allowed", 0); 161 172 psMetadataItemPrint(NULL, "Item value: %ld", item2); 162 printFooter(stdout, "psMetadata", "Test I- Attempt to use null file with itemPrint", true);163 164 165 // Test J- Attempt to use null format with itemPrint166 printNegativeTestHeader(stdout,"psMetadata", "Test J- Attempt to use null format with itemPrint",173 printFooter(stdout, "psMetadata", "Test J - Attempt to use null file with itemPrint", true); 174 175 176 // Test K - Attempt to use null format with itemPrint 177 printNegativeTestHeader(stdout,"psMetadata", "Test K - Attempt to use null format with itemPrint", 167 178 "Null format not allowed", 0); 168 179 psMetadataItemPrint(fd, NULL, item2); 169 printFooter(stdout, "psMetadata", "Test J- Attempt to use null format with itemPrint", true);170 171 172 // Test K- Attempt to use null item with itemPrint173 printNegativeTestHeader(stdout,"psMetadata", "Test K- Attempt to use null item with itemPrint",180 printFooter(stdout, "psMetadata", "Test K - Attempt to use null format with itemPrint", true); 181 182 183 // Test L - Attempt to use null item with itemPrint 184 printNegativeTestHeader(stdout,"psMetadata", "Test L - Attempt to use null item with itemPrint", 174 185 "Null metadata not allowed", 0); 175 186 psMetadataItemPrint(fd, "Item value: %ld", NULL); 176 printFooter(stdout, "psMetadata", "Test K- Attempt to use null item with itemPrint", true);177 178 179 // Test L- Free psMetadata180 printPositiveTestHeader(stdout, "psMetadata", "Test I- Free psMetadata");187 printFooter(stdout, "psMetadata", "Test L - Attempt to use null item with itemPrint", true); 188 189 190 // Test M - Free psMetadata 191 printPositiveTestHeader(stdout, "psMetadata", "Test M - Free psMetadata"); 181 192 psFree(metadata); 182 193 psFree(item1); … … 190 201 printf("ERROR: Found %d bad memory blocks\n", nBad); 191 202 } 192 printFooter(stdout, "psMetadata", "Test L- Free psMetadata", true);203 printFooter(stdout, "psMetadata", "Test M - Free psMetadata", true); 193 204 194 205 -
trunk/psLib/test/collections/tst_psMetadata_05.c
r1444 r1445 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-10 01: 14:46$13 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-10 01:39:37 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 59 59 int main( int argc, char* argv[] ) 60 60 { 61 long data; 61 62 psMetadataItem *item1 = NULL; 62 63 psMetadataItem *item2 = NULL; … … 131 132 printf("ERROR: Couldn't open file for writing\n"); 132 133 } 133 psMetadataItemPrint(fd, " Item value:%ld", item2);134 psMetadataItemPrint(fd, "%ld", item2); 134 135 printFooter(stdout, "psMetadata", "Test F - Write metadata item to file", true); 135 136 137 // Test F - Attempt to use null metadata with setIterator 138 printNegativeTestHeader(stdout,"psMetadata", "Test F - Attempt to use null metadata with setIterator", 136 fclose(fd); 137 fd = fopen("./tst_psMetadata05_OUT", "r"); 138 if(fd == NULL) { 139 printf("ERROR: Couldn't open file for reading\n"); 140 } 141 fscanf(fd, "%ld", &data); 142 fclose(fd); 143 if(data != 55) { 144 printf("ERROR: Data in file is not as expected. Value: %ld. Should be: 55.\n", data); 145 } 146 147 148 // Test G - Attempt to use null metadata with setIterator 149 printNegativeTestHeader(stdout,"psMetadata", "Test G - Attempt to use null metadata with setIterator", 139 150 "Null metadata collection not allowed", 0); 140 151 psMetadataSetIterator(NULL, 0); 141 printFooter(stdout, "psMetadata", "Test F- Attempt to use null metadata with setIterator", true);142 143 144 // Test G- Attempt to use null metadata with getNext145 printNegativeTestHeader(stdout,"psMetadata", "Test G- Attempt to use null metadata with getNext",152 printFooter(stdout, "psMetadata", "Test G - Attempt to use null metadata with setIterator", true); 153 154 155 // Test H - Attempt to use null metadata with getNext 156 printNegativeTestHeader(stdout,"psMetadata", "Test H - Attempt to use null metadata with getNext", 146 157 "Null metadata collection not allowed", 0); 147 158 psMetadataGetNext(NULL, "myItem2", 0); 148 printFooter(stdout, "psMetadata", "Test G- Attempt to use null metadata with getNext", true);149 150 151 // Test H- Attempt to use null metadata with getPrevious152 printNegativeTestHeader(stdout,"psMetadata", "Test H- Attempt to use null metadata with getPrevious",159 printFooter(stdout, "psMetadata", "Test H - Attempt to use null metadata with getNext", true); 160 161 162 // Test I - Attempt to use null metadata with getPrevious 163 printNegativeTestHeader(stdout,"psMetadata", "Test I - Attempt to use null metadata with getPrevious", 153 164 "Null metadata collection not allowed", 0); 154 165 psMetadataGetPrevious(NULL, "myItem2", 0); 155 printFooter(stdout, "psMetadata", "Test H- Attempt to use null metadata with getPrevious", true);156 157 158 // Test I- Attempt to use null file with itemPrint159 printNegativeTestHeader(stdout,"psMetadata", "Test I- Attempt to use null file with itemPrint",166 printFooter(stdout, "psMetadata", "Test I - Attempt to use null metadata with getPrevious", true); 167 168 169 // Test J - Attempt to use null file with itemPrint 170 printNegativeTestHeader(stdout,"psMetadata", "Test J - Attempt to use null file with itemPrint", 160 171 "Null file descriptor not allowed", 0); 161 172 psMetadataItemPrint(NULL, "Item value: %ld", item2); 162 printFooter(stdout, "psMetadata", "Test I- Attempt to use null file with itemPrint", true);163 164 165 // Test J- Attempt to use null format with itemPrint166 printNegativeTestHeader(stdout,"psMetadata", "Test J- Attempt to use null format with itemPrint",173 printFooter(stdout, "psMetadata", "Test J - Attempt to use null file with itemPrint", true); 174 175 176 // Test K - Attempt to use null format with itemPrint 177 printNegativeTestHeader(stdout,"psMetadata", "Test K - Attempt to use null format with itemPrint", 167 178 "Null format not allowed", 0); 168 179 psMetadataItemPrint(fd, NULL, item2); 169 printFooter(stdout, "psMetadata", "Test J- Attempt to use null format with itemPrint", true);170 171 172 // Test K- Attempt to use null item with itemPrint173 printNegativeTestHeader(stdout,"psMetadata", "Test K- Attempt to use null item with itemPrint",180 printFooter(stdout, "psMetadata", "Test K - Attempt to use null format with itemPrint", true); 181 182 183 // Test L - Attempt to use null item with itemPrint 184 printNegativeTestHeader(stdout,"psMetadata", "Test L - Attempt to use null item with itemPrint", 174 185 "Null metadata not allowed", 0); 175 186 psMetadataItemPrint(fd, "Item value: %ld", NULL); 176 printFooter(stdout, "psMetadata", "Test K- Attempt to use null item with itemPrint", true);177 178 179 // Test L- Free psMetadata180 printPositiveTestHeader(stdout, "psMetadata", "Test I- Free psMetadata");187 printFooter(stdout, "psMetadata", "Test L - Attempt to use null item with itemPrint", true); 188 189 190 // Test M - Free psMetadata 191 printPositiveTestHeader(stdout, "psMetadata", "Test M - Free psMetadata"); 181 192 psFree(metadata); 182 193 psFree(item1); … … 190 201 printf("ERROR: Found %d bad memory blocks\n", nBad); 191 202 } 192 printFooter(stdout, "psMetadata", "Test L- Free psMetadata", true);203 printFooter(stdout, "psMetadata", "Test M - Free psMetadata", true); 193 204 194 205
Note:
See TracChangeset
for help on using the changeset viewer.
