Changeset 3945 for trunk/psLib/test/collections
- Timestamp:
- May 16, 2005, 9:43:53 AM (21 years ago)
- Location:
- trunk/psLib/test/collections
- Files:
-
- 3 added
- 4 edited
-
test1.config (added)
-
test2.config (added)
-
test3.config (added)
-
tst_psMetadataIO.c (modified) (2 diffs)
-
verified/tst_psMetadataIO.stderr (modified) (1 diff)
-
verified/tst_psMetadataIO.stdout (modified) (1 diff)
-
verified/tst_psMetadata_01.stdout (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/collections/tst_psMetadataIO.c
r3779 r3945 4 4 * 5 5 * This test driver contains the following tests for psMetadata: 6 * Test A - Read config file with overwrite set true 7 * Test B - Read config file with overwrite set false 8 * Test C - Read config file without auto-allocation of metadata 9 * Test D - Attempt to use null fileName argument 10 * Test E - Attempt to open nonexistant file 11 * Test F - Free psMetadata 6 * Read config file with overwrite set true 7 * Read config file with overwrite set false 8 * Attempt to use null fileName argument 9 * Attempt to open nonexistant file 12 10 * 13 11 * @author Ross Harman, MHPCC 14 12 * @author Robert DeSonia, MHPCC 13 * @author Eric Van Alst, MHPCC 15 14 * 16 * @version $Revision: 1.1 4$ $Name: not supported by cvs2svn $17 * @date $Date: 2005-0 4-28 02:45:12$15 * @version $Revision: 1.15 $ $Name: not supported by cvs2svn $ 16 * @date $Date: 2005-05-16 19:41:40 $ 18 17 * 19 18 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 25 24 #include "psTest.h" 26 25 27 static void printMetadataItem(psMetadataItem *metadataItem, char *spaces); 28 static void printMetadata(psMetadata *metadata); 29 static void printMetadataList(psList *metadataItemList, char* spaces); 30 static void printMetadataTable(psHash *mdTable); 31 32 static void printMetadata(psMetadata *metadata) 33 { 34 printf("Contents of metadata list:\n"); 35 printMetadataList(metadata->list, " "); 36 printf("\nContents of metadata table:\n"); 37 printMetadataTable(metadata->table); 38 } 39 40 static void printMetadataList(psList *metadataItemList, char* spaces) 41 { 42 psMetadataItem *entryChild = NULL; 43 26 static psS32 testMetadataParseConfig(void); 27 static psS32 testMetadataParseConfig1(void); 28 static psS32 testMetadataParseConfig2(void); 29 30 testDescription tests[] = { 31 {testMetadataParseConfig,000,"psMetadataParseConfig",0,false}, 32 {testMetadataParseConfig1,000,"psMetadataParseConfig",0,false}, 33 {testMetadataParseConfig2,000,"psMetadataParseConfig",0,false}, 34 {NULL} 35 }; 36 37 static void writeMetadataItem(psMetadataItem* metadataIem, char* indentStr); 38 static void writeMetadata(psMetadata* metadata, char* indentStr); 39 static void writeMetadataList(psList *metadataItemList, char* indentStr); 40 41 static psBool checkFailedLines(psS32 failedLines, psS32 expectedFailedLines, char* configFile); 42 static psBool checkNumberOfItems(psMetadata* md, psS32 expectedItems, char* configFile); 43 static psBool checkItemName(psMetadataItem* mdItem, char* expectedName, char* configFile); 44 static psBool checkItemType(psMetadataItem* mdItem, psS32 expectedType, char* configFile); 45 static psBool checkItemComment(psMetadataItem* mdItem, char* expectedComment, char* configFile); 46 47 #define ERROR_TOL 0.0001 48 49 const char testConfig3[] = "test3.config"; 50 const psS32 testConfig3Fails = 1; 51 52 const char testConfig2[] = "test2.config"; 53 const psS32 testConfig2Fails = 17; 54 55 // SDR-14 test config file #1 56 const char testConfig1[] = "test1.config"; 57 const psS32 testConfig1FailsOverwrite = 0; 58 const psS32 testConfig1Fails = 1; 59 const psS32 testConfig1Items = 25; 60 const char* testConfig1KeyOverwrite[] = 61 { 62 "Double","String","boolean","primes","comment", 63 "comment","comment","comment","comment","Float", 64 "boolean1","negprimes","vector1","vector2","vector3", 65 "vector4","vector5","vector6","vector7","vector8", 66 "CELL.00", "CELL.01","MYCELL","MYCELL","cell" 67 }; 68 const char* testConfig1CommentOverwrite[] = 69 { 70 "This is a comment","comment","The value of 'boolean' is 'true'","These are prime numbers", 71 "","","","","", 72 "This generates a warning, and, if 'overwrite' is 'false', is ignored","The value of 'boolean' is 'false'", 73 "","","","","", 74 "","","","", 75 "","","","A number","" 76 }; 77 const psMetadataType testConfig1TypeOverwrite[] = 78 { 79 PS_META_F64, PS_META_STR, PS_META_BOOL, PS_META_VEC, PS_META_STR, 80 PS_META_STR, PS_META_STR, PS_META_STR, PS_META_STR, PS_META_F64, 81 PS_META_BOOL, PS_META_VEC, PS_META_VEC, PS_META_VEC, PS_META_VEC, 82 PS_META_VEC, PS_META_VEC, PS_META_VEC, PS_META_VEC, PS_META_VEC, 83 PS_META_META, PS_META_META, PS_META_META, PS_META_S32, PS_META_META 84 }; 85 const psS32 testConfig1ValueS32Overwrite[] = 86 { 87 0, 0, 0, 0, 0, 88 0, 0, 0, 0, 0, 89 0, 0, 0, 0, 0, 90 0, 0, 0, 0, 0, 91 0, 0, 0, 123, 0 92 }; 93 const psF32 testConfig1ValueF32Overwrite[] = 94 { 95 0.0, 0.0, 0.0, 0.0, 0.0, 96 0.0, 0.0, 0.0, 0.0, 0.0, 97 0.0, 0.0, 0.0, 0.0, 0.0, 98 0.0, 0.0, 0.0, 0.0, 0.0, 99 0.0, 0.0, 0.0, 0.0, 0.0 100 }; 101 const psF64 testConfig1ValueF64Overwrite[] = 102 { 103 1.23456789, 0.0, 0.0, 0.0, 0.0, 104 0.0, 0.0, 0.0, 0.0, 1.23456, 105 0.0, 0.0, 0.0, 0.0, 0.0, 106 0.0, 0.0, 0.0, 0.0, 0.0, 107 0.0, 0.0, 0.0, 0.0, 0.0 108 }; 109 const psBool testConfig1ValueBoolOverwrite[] = 110 { 111 false, false, true, false, false, 112 false, false, false, false, false, 113 false, false, false, false, false, 114 false, false, false, false, false, 115 false, false, false, false, false 116 }; 117 const char* testConfig1ValueStrOverwrite[] = 118 { 119 "", "This is the string that forms the value","","","This", 120 "is","a","non-unique","key","", 121 "","","","","", 122 "","","","","", 123 "","","","","" 124 }; 125 const psS32 testConfig1ValueVecItemsU8 = 7; 126 const psElemType testConfig1ValueVecTypeU8 = PS_TYPE_U8; 127 const psU8 testConfig1ValueVecValueU8[] = 128 { 129 2, 3, 5, 7, 11, 13, 17 130 }; 131 const psS32 testConfig1ValueVecItemsS8 = 8; 132 const psElemType testConfig1ValueVecTypeS8 = PS_TYPE_S8; 133 const psS8 testConfig1ValueVecValueS8[] = 134 { 135 -2, -3, -5, -7, -11, -13, -17, -19 136 }; 137 const psS32 testConfig1ValueVecItemsU16 = 5; 138 const psElemType testConfig1ValueVecTypeU16 = PS_TYPE_U16; 139 const psU16 testConfig1ValueVecValueU16[] = 140 { 141 0, 1, 2, 4, 8 142 }; 143 const psS32 testConfig1ValueVecItemsU32 = 6; 144 const psElemType testConfig1ValueVecTypeU32 = PS_TYPE_U32; 145 const psU32 testConfig1ValueVecValueU32[] = 146 { 147 0, 8, 16, 32, 64, 128 148 }; 149 const psS32 testConfig1ValueVecItemsU64 = 3; 150 const psElemType testConfig1ValueVecTypeU64 = PS_TYPE_U64; 151 const psU64 testConfig1ValueVecValueU64[] = 152 { 153 0, 64, 256 154 }; 155 const psS32 testConfig1ValueVecItemsS16 = 5; 156 const psElemType testConfig1ValueVecTypeS16 = PS_TYPE_S16; 157 const psS16 testConfig1ValueVecValueS16[] = 158 { 159 -2, -1, 0, 1, 2 160 }; 161 const psS32 testConfig1ValueVecItemsS32 = 6; 162 const psElemType testConfig1ValueVecTypeS32 = PS_TYPE_S32; 163 const psS32 testConfig1ValueVecValueS32[] = 164 { 165 -4, -2, 0, 2, 4, 6 166 }; 167 const psS32 testConfig1ValueVecItemsS64 = 7; 168 const psElemType testConfig1ValueVecTypeS64 = PS_TYPE_S64; 169 const psS64 testConfig1ValueVecValueS64[] = 170 { 171 -16, -4, 0, 4, 16, 36, 64 172 }; 173 const psS32 testConfig1ValueVecItemsF32 = 4; 174 const psElemType testConfig1ValueVecTypeF32 = PS_TYPE_F32; 175 const psF32 testConfig1ValueVecValueF32[] = 176 { 177 -1.03, 1.04, -1.05, 1.06 178 }; 179 const psS32 testConfig1ValueVecItemsF64 = 5; 180 const psElemType testConfig1ValueVecTypeF64 = PS_TYPE_F64; 181 const psF64 testConfig1ValueVecValueF64[] = 182 { 183 -2.22, 2.21, -2.20, 2.19, -2.18 184 }; 185 const psS32 testConfig1ValueMetaItems1 = 3; 186 const char* testConfig1ValueMetaNames1[] = 187 { 188 "EXTNAME","BIASSEC","CHIP" 189 }; 190 const psMetadataType testConfig1ValueMetaTypes1[] = 191 { 192 PS_META_STR, PS_META_STR, PS_META_STR 193 }; 194 const char* testConfig1ValueMetaValue1[] = 195 { 196 "CCD00","BSEC-00","CHIP.00" 197 }; 198 const psS32 testConfig1ValueMetaItems2 = 3; 199 const char* testConfig1ValueMetaNames2[] = 200 { 201 "EXTNAME","BIASSEC","CHIP" 202 }; 203 const psMetadataType testConfig1ValueMetaTypes2[] = 204 { 205 PS_META_STR, PS_META_STR, PS_META_STR 206 }; 207 const char* testConfig1ValueMetaValue2[] = 208 { 209 "CCD01","BSEC-01","CHIP.00" 210 }; 211 const psS32 testConfig1ValueMetaItems3 = 4; 212 const char* testConfig1ValueMetaNames3[] = 213 { 214 "EXTNAME","BIASSEC","CHIP","NCELL" 215 }; 216 const psMetadataType testConfig1ValueMetaTypes3[] = 217 { 218 PS_META_STR, PS_META_STR, PS_META_STR, PS_META_S32 219 }; 220 const char* testConfig1ValueMetaValueStr3[] = 221 { 222 "CCD00","BSEC-00","CHIP.00","" 223 }; 224 const psS32 testConfig1ValueMetaValueS323[] = 225 { 226 0, 0, 0, 24 227 }; 228 229 static void writeMetadata(psMetadata* metadata, char* indentStr) 230 { 231 writeMetadataList(metadata->list, indentStr); 232 } 233 234 static void writeMetadataList(psList* metadataItemList, char* indentStr) 235 { 236 psMetadataItem* entryChild = NULL; 237 psMetadataItem* searchChild = NULL; 238 psArray* nonUniqueKeyArray = NULL; 239 psBool keyFound = false; 240 char* tempKey = NULL; 241 242 // Allocate iterator for moving through metadata list 44 243 psListIterator* iter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD, true); 45 46 while ( (entryChild=psListGetAndIncrement(iter)) != NULL) { 47 printMetadataItem(entryChild, spaces); 244 psListIterator* searchIter = psListIteratorAlloc(metadataItemList, PS_LIST_HEAD, true); 245 246 // Allocate array for nonUnique key names 247 nonUniqueKeyArray = psArrayAlloc(10); 248 nonUniqueKeyArray->n = 0; 249 250 251 // Loop through all items in the list 252 while ( (entryChild = psListGetAndIncrement(iter)) != NULL) { 253 // Search list for another entry with same key name 254 // Check if last entry 255 if(iter->index != metadataItemList->size) { 256 // Set search iterator to index 257 if(!psListIteratorSet(searchIter,iter->index) ) { 258 psError(PS_ERR_UNKNOWN,true,"Error searching list for multiple keys"); 259 break; 260 } 261 keyFound = false; 262 while ( (searchChild = psListGetAndIncrement(searchIter)) != NULL) { 263 if(strcmp(entryChild->name,searchChild->name) == 0) { 264 // Search nonUnique key array 265 for(psS32 i = 0; i < nonUniqueKeyArray->n; i++) { 266 if(strcmp(entryChild->name,nonUniqueKeyArray->data[i]) == 0) { 267 keyFound = true; 268 } 269 } 270 if(!keyFound) { 271 // Add key to non-unique array 272 tempKey = psStringCopy(entryChild->name); 273 nonUniqueKeyArray = psArrayAdd(nonUniqueKeyArray,1,tempKey); 274 psFree(tempKey); 275 276 // Print MULTI line 277 printf("%-25s MULTI\n",entryChild->name); 278 279 // Break out of loop 280 break; 281 } 282 } 283 } 284 } 285 writeMetadataItem(entryChild,indentStr); 48 286 } 49 287 50 288 psFree(iter); 51 } 52 53 static void printMetadataTable(psHash *mdTable) 54 { 55 psS32 i; 56 psHashBucket* ptr = NULL; 57 for(i=0; i<mdTable->nbucket; i++) { 58 ptr = mdTable->buckets[i]; 59 while (ptr != NULL) { 60 printMetadataItem(ptr->data, " "); 61 ptr = ptr->next; 62 } 63 } 64 } 65 66 static void printMetadataItem(psMetadataItem *metadataItem, char *spaces) 67 { 68 char* vecStr; 69 70 printf("%sKey Name: %8s ", spaces, metadataItem->name); 71 printf("Key mdType: 0x%08x ", metadataItem->type); 72 73 switch (metadataItem->type) { 74 case PS_META_MULTI: 75 printf("Key Value: %17c", ' '); 289 psFree(searchIter); 290 psFree(nonUniqueKeyArray); 291 } 292 293 char* vectorToConfigString(psVector* vector) 294 { 295 psS32 maxLength = 256; 296 297 char* str = psAlloc(sizeof(char)*maxLength+1); 298 299 if (vector == NULL) { 300 snprintf(str,maxLength, "NULL"); 301 return str; 302 } 303 304 int size = vector->n; 305 306 if (size == 0) { 307 snprintf(str,maxLength, " "); 308 return str; 309 } 310 311 char* tempStr = psAlloc(sizeof(char)*maxLength+1); 312 *str = '\0'; 313 bool full = false; 314 315 #define APPEND_ELEMENTS_CASE(TYPE, NATIVE_TYPE, FORMAT) \ 316 case PS_TYPE_##TYPE: \ 317 strcat(str,#TYPE); \ 318 for(psS32 i = 0; i < (strlen(str)-6); i++) { \ 319 strcat(str," "); \ 320 } \ 321 for (lcv=0; lcv < size && ! full; lcv++) { \ 322 snprintf(tempStr, maxLength, "%s" FORMAT, prefix, (NATIVE_TYPE) (vector->data.TYPE[lcv])); \ 323 strncat(str,tempStr,maxLength); \ 324 full = (strlen(str) > maxLength-2); \ 325 prefix = ","; \ 326 } \ 327 break; 328 329 int lcv; 330 char* prefix = " "; 331 switch(vector->type.type) { 332 APPEND_ELEMENTS_CASE(S8,char,"%hd") 333 APPEND_ELEMENTS_CASE(S16,short int,"%hd") 334 APPEND_ELEMENTS_CASE(S32,int,"%d") 335 APPEND_ELEMENTS_CASE(S64,long,"%ld") 336 APPEND_ELEMENTS_CASE(U8,unsigned char,"%hu") 337 APPEND_ELEMENTS_CASE(U16,unsigned short,"%hu") 338 APPEND_ELEMENTS_CASE(U32,unsigned int, "%u") 339 APPEND_ELEMENTS_CASE(U64,unsigned long,"%lu") 340 APPEND_ELEMENTS_CASE(F32,double,"%g") 341 APPEND_ELEMENTS_CASE(F64,double,"%g") 342 default: 343 snprintf(str,maxLength,"INVALID TYPE"); 76 344 break; 345 } 346 347 psFree(tempStr); 348 349 return str; 350 } 351 352 353 static void writeMetadataItem(psMetadataItem *metadataItem, char* indentStr) 354 { 355 char* vecStr; 356 357 switch(metadataItem->type) { 77 358 case PS_META_BOOL: 78 printf(" Key Value: %15d ",metadataItem->data.B);359 printf("%s%-25s BOOL %40d",indentStr,metadataItem->name,metadataItem->data.B); 79 360 break; 80 361 case PS_META_S32: 81 printf(" Key Value: %15d ",metadataItem->data.S32);362 printf("%s%-25s S32 %40d",indentStr,metadataItem->name,metadataItem->data.S32); 82 363 break; 83 364 case PS_META_F32: 84 printf(" Key Value: %15.3f ",metadataItem->data.F32);365 printf("%s%-25s F32 %40f",indentStr,metadataItem->name,metadataItem->data.F32); 85 366 break; 86 367 case PS_META_F64: 87 printf(" Key Value: %15.3f ",metadataItem->data.F64);368 printf("%s%-25s F64 %40lf",indentStr,metadataItem->name,metadataItem->data.F64); 88 369 break; 89 370 case PS_META_VEC: 90 vecStr = (char*) psVectorToString((psVector*)metadataItem->data.V, 15);91 printf(" Key Value: %15s ",vecStr);371 vecStr = (char*)vectorToConfigString((psVector*)metadataItem->data.V); 372 printf("%s@%-24s %s",indentStr,metadataItem->name,vecStr); 92 373 psFree(vecStr); 93 374 break; 94 375 case PS_META_STR: 95 printf("Key Value: %15s ", (char*)metadataItem->data.V); 376 printf("%s%-25s STR %40s",indentStr,metadataItem->name,(char*)metadataItem->data.V); 377 break; 378 case PS_META_META: 379 printf("%s%-25s METADATA\n",indentStr,metadataItem->name); 380 writeMetadata((psMetadata*)metadataItem->data.md," "); 96 381 break; 97 382 default: 98 printf("Bad type: 0x%08x ", metadataItem->type); 99 } 100 printf("Key Comment: %s\n", metadataItem->comment); 101 102 if(metadataItem->data.V && metadataItem->type==PS_META_MULTI) { 103 printMetadataList(metadataItem->data.V, " "); 104 } 105 } 106 383 printf("#%s%-24s BAD TYPE=%d",indentStr,metadataItem->name,metadataItem->type); 384 break; 385 } 386 if(strlen(metadataItem->comment) > 0) { 387 printf(" # %-20s\n",metadataItem->comment); 388 } else { 389 printf("\n"); 390 } 391 } 392 393 static psBool checkFailedLines(psS32 failedLines, psS32 expectedFailedLines, char* configFile) 394 { 395 psBool returnValue = true; 396 397 // Verify the expected number of failed lines 398 if(failedLines != expectedFailedLines) { 399 psError(PS_ERR_UNKNOWN,true,"File: %s : Number of failed lines = %d not as expected %d", 400 configFile,failedLines,expectedFailedLines); 401 returnValue = false; 402 } 403 return returnValue; 404 } 405 406 static psBool checkNumberOfItems(psMetadata* md, psS32 expectedItems, char* configFile) 407 { 408 psBool returnValue = true; 409 410 // Verify the number of items in metadata 411 if(md->list->size != expectedItems) { 412 psError(PS_ERR_UNKNOWN,true,"File: %s : Number of items = %d not as expected %d", 413 configFile,md->list->size, expectedItems); 414 returnValue = false; 415 } 416 return returnValue; 417 } 418 419 static psBool checkItemName(psMetadataItem* mdItem, char* expectedName, char* configFile) 420 { 421 psBool returnValue = true; 422 423 // Compare key names 424 if(strcmp(mdItem->name,expectedName) != 0) { 425 psError(PS_ERR_UNKNOWN,true,"File: %s : Key name %s not as expected %s", 426 configFile,mdItem->name,expectedName); 427 returnValue = false; 428 } 429 430 return returnValue; 431 } 432 433 static psBool checkItemType(psMetadataItem* mdItem, psS32 expectedType, char* configFile) 434 { 435 psBool returnValue = true; 436 437 // Compare types 438 if(mdItem->type != expectedType) { 439 psError(PS_ERR_UNKNOWN,true,"File: %s : Type %d not as expected %d", 440 configFile,mdItem->type,expectedType); 441 returnValue = false; 442 } 443 return returnValue; 444 } 445 446 static psBool checkItemComment(psMetadataItem* mdItem, char* expectedComment, char* configFile) 447 { 448 psBool returnValue = true; 449 450 // Compare comments 451 if(strcmp(mdItem->comment,expectedComment) != 0) { 452 psError(PS_ERR_UNKNOWN,true,"File: %s : Comment %s not as expected %s", 453 configFile,mdItem->comment,expectedComment); 454 returnValue = false; 455 } 456 return returnValue; 457 } 107 458 108 459 psS32 main(psS32 argc, char* argv[]) 109 460 { 110 // Test A - Read config file with overwrite set true 111 printPositiveTestHeader(stdout, "psMetadata", "Test A - Read config file with overwrite set true"); 112 psMetadata *metadata1 = NULL; 113 psU32 failedLines1 = 0; 114 metadata1 = psMetadataParseConfig(metadata1, &failedLines1, "test.config", true); 115 printf("Failed lines: %d Expected: 6\n", failedLines1); 116 printMetadata(metadata1); 117 printFooter(stdout, "psMetadata", "Test A - Read config file with overwrite set true", true); 118 119 120 // Test B - Read config file with overwrite set false 121 printPositiveTestHeader(stdout, "psMetadata", "Test B - Read config file with overwrite set false"); 122 psMetadata *metadata2 = NULL; 123 psU32 failedLines2 = 0; 124 metadata2 = psMetadataParseConfig(metadata2, &failedLines2, "test.config", false); 125 printf("Failed lines: %d Expected: 7 ", failedLines2); 126 printMetadata(metadata2); 127 printFooter(stdout, "psMetadata", "Test B - Read config file with overwrite set false", true); 128 129 130 // Test C - Read config file without auto-allocation of metadata 131 printPositiveTestHeader(stdout, "psMetadata", "Test C - Read config file without auto-allocation of metadata"); 132 psMetadata *metadata3 = psMetadataAlloc(); 133 psU32 failedLines3 = 0; 134 metadata3 = psMetadataParseConfig(metadata3, &failedLines3, "test.config", true); 135 printf("Failed lines: %d Expected: 6 ", failedLines3); 136 printMetadata(metadata3); 137 printFooter(stdout, "psMetadata", "Test C - Read config file without auto-allocation of metadata", true); 138 139 140 // Test D - Attempt to use null fileName argument 141 printNegativeTestHeader(stdout,"psMetadataIO", "Test D - Attempt to use null fileName argument", 142 "Null failedLines not allowed", 0); 143 psMetadataParseConfig(metadata1, &failedLines1, NULL, true); 144 printFooter(stdout, "psMetadata", "Test D - Attempt to use null fileName argument", true); 145 146 147 // Test E - Attempt to open nonexistant file 148 printNegativeTestHeader(stdout,"psMetadataIO", "Test E - Attempt to open nonexistant file", 149 "Error opening file", 0); 150 psMetadataParseConfig(metadata1, &failedLines1, "abcedfg", true); 151 printFooter(stdout, "psMetadata", "Test E - Attempt to open nonexistant file", true); 152 153 154 // Test F - Free psMetadata 155 printPositiveTestHeader(stdout, "psMetadata", "Test F - Free psMetadata"); 461 psLogSetLevel(PS_LOG_INFO); 462 463 if( !runTestSuite(stderr,"psMetadataParseConfig",tests,argc,argv)) { 464 return 1; 465 } 466 467 return 0; 468 } 469 470 psS32 testMetadataParseConfig(void) 471 { 472 psMetadata* metadata1 = NULL; 473 psMetadataItem* entryChild = NULL; 474 psS32 failedLines = 0; 475 psListIterator* iter = NULL; 476 psListIterator* mdIter = NULL; 477 psMetadataItem* mdChild = NULL; 478 psS32 metaCounter = 0; 479 psS32 mdCounter = 0; 480 481 // Read config file test1.config with overwrite set true 482 metadata1 = psMetadataParseConfig(metadata1,&failedLines,testConfig1,true); 483 // Verify the expected number of failed lines 484 if(!checkFailedLines(failedLines,testConfig1FailsOverwrite,(char*)testConfig1)) { 485 return 1; 486 } 487 // Verify the number of items in metadata 488 if(!checkNumberOfItems(metadata1,testConfig1Items,(char*)testConfig1)) { 489 return 2; 490 } 491 // Verify metadata item quads 492 iter = psListIteratorAlloc(metadata1->list, PS_LIST_HEAD, true); 493 for(psS32 i = 0; i < testConfig1Items; i++) { 494 // Get list item 495 entryChild = psListGetAndIncrement(iter); 496 497 // Verify end of list not reached prematurely 498 if(entryChild == NULL) { 499 psError(PS_ERR_UNKNOWN,true,"End of list encountered at %d not as expected %d", 500 i,testConfig1Items); 501 return i*10+1; 502 } 503 // Verify name 504 if(!checkItemName(entryChild,(char*)testConfig1KeyOverwrite[i],(char*)testConfig1)) { 505 return i*10+2; 506 } 507 // Verify type 508 if(!checkItemType(entryChild,testConfig1TypeOverwrite[i],(char*)testConfig1)) { 509 return i*10+3; 510 } 511 // Verify comment 512 if(!checkItemComment(entryChild,(char*)testConfig1CommentOverwrite[i],(char*)testConfig1)) { 513 return i*10+4; 514 } 515 // Compare values 516 switch(entryChild->type) { 517 case PS_META_S32: 518 if(entryChild->data.S32 != testConfig1ValueS32Overwrite[i]) { 519 psError(PS_ERR_UNKNOWN,true,"File: %s : Value %d not as expected %d", 520 testConfig1,entryChild->data.S32, testConfig1ValueS32Overwrite[i]); 521 return i*10+5; 522 } 523 break; 524 case PS_META_F32: 525 if(fabs(entryChild->data.F32 - testConfig1ValueF32Overwrite[i]) > ERROR_TOL) { 526 psError(PS_ERR_UNKNOWN,true,"File: %s : Value %f not as expected %f", 527 testConfig1,entryChild->data.F32, testConfig1ValueF32Overwrite[i]); 528 return i*10+5; 529 } 530 break; 531 case PS_META_F64: 532 if(fabs(entryChild->data.F64 - testConfig1ValueF64Overwrite[i]) > ERROR_TOL) { 533 psError(PS_ERR_UNKNOWN,true,"File: %s : Value %lf not as expected %lf", 534 testConfig1,entryChild->data.F64, testConfig1ValueF64Overwrite[i]); 535 return i*10+5; 536 } 537 break; 538 case PS_META_BOOL: 539 if(entryChild->data.B != testConfig1ValueBoolOverwrite[i]) { 540 psError(PS_ERR_UNKNOWN,true,"File: %s : Value %d not as expected %d", 541 testConfig1,entryChild->data.B,testConfig1ValueBoolOverwrite[i]); 542 return i*10+5; 543 } 544 break; 545 case PS_META_STR: 546 if(strcmp(entryChild->data.V,testConfig1ValueStrOverwrite[i]) != 0) { 547 psError(PS_ERR_UNKNOWN,true,"File: %s : Value %s not as expected %s", 548 testConfig1,entryChild->data.V,testConfig1ValueStrOverwrite[i]); 549 return i*10+5; 550 } 551 break; 552 case PS_META_VEC: 553 // Verify the correct number of entries 554 switch(((psVector*)(entryChild->data.V))->type.type) { 555 case PS_TYPE_U8: 556 if(((psVector*)(entryChild->data.V))->n != testConfig1ValueVecItemsU8) { 557 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector entries %d not as expected %d", 558 testConfig1,((psVector*)(entryChild->data.V))->n,testConfig1ValueVecItemsU8); 559 return i*10+5; 560 } 561 // Verify the correct type 562 if(((psVector*)(entryChild->data.V))->type.type != testConfig1ValueVecTypeU8) { 563 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector type %d not as expected %s", 564 testConfig1,((psVector*)entryChild->data.V)->type.type,testConfig1ValueVecTypeU8); 565 return i*10+5; 566 } 567 // Verify the values in vector 568 for(psS32 j = 0; j < testConfig1ValueVecItemsU8; j++) { 569 if(((psVector*)entryChild->data.V)->data.U8[j] != testConfig1ValueVecValueU8[j]) { 570 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector data[%d] = %d not as expected %d", 571 testConfig1,j,((psVector*)entryChild->data.V)->data.U8[j], 572 testConfig1ValueVecValueU8[j]); 573 return i*10+5*j; 574 } 575 } 576 break; 577 case PS_TYPE_U16: 578 if(((psVector*)(entryChild->data.V))->n != testConfig1ValueVecItemsU16) { 579 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector entries %d not as expected %d", 580 testConfig1,((psVector*)(entryChild->data.V))->n,testConfig1ValueVecItemsU16); 581 return i*10+5; 582 } 583 // Verify the correct type 584 if(((psVector*)(entryChild->data.V))->type.type != testConfig1ValueVecTypeU16) { 585 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector type %d not as expected %s", 586 testConfig1,((psVector*)entryChild->data.V)->type.type,testConfig1ValueVecTypeU16); 587 return i*10+5; 588 } 589 // Verify the values in vector 590 for(psS32 j = 0; j < testConfig1ValueVecItemsU16; j++) { 591 if(((psVector*)entryChild->data.V)->data.U16[j] != testConfig1ValueVecValueU16[j]) { 592 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector data[%d] = %d not as expected %d", 593 testConfig1,j,((psVector*)entryChild->data.V)->data.U16[j], 594 testConfig1ValueVecValueU16[j]); 595 return i*10+5*j; 596 } 597 } 598 break; 599 case PS_TYPE_U32: 600 if(((psVector*)(entryChild->data.V))->n != testConfig1ValueVecItemsU32) { 601 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector entries %d not as expected %d", 602 testConfig1,((psVector*)(entryChild->data.V))->n,testConfig1ValueVecItemsU32); 603 return i*10+5; 604 } 605 // Verify the correct type 606 if(((psVector*)(entryChild->data.V))->type.type != testConfig1ValueVecTypeU32) { 607 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector type %d not as expected %s", 608 testConfig1,((psVector*)entryChild->data.V)->type.type,testConfig1ValueVecTypeU32); 609 return i*10+5; 610 } 611 // Verify the values in vector 612 for(psS32 j = 0; j < testConfig1ValueVecItemsU32; j++) { 613 if(((psVector*)entryChild->data.V)->data.U32[j] != testConfig1ValueVecValueU32[j]) { 614 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector data[%d] = %d not as expected %d", 615 testConfig1,j,((psVector*)entryChild->data.V)->data.U32[j], 616 testConfig1ValueVecValueU32[j]); 617 return i*10+5*j; 618 } 619 } 620 break; 621 case PS_TYPE_U64: 622 if(((psVector*)(entryChild->data.V))->n != testConfig1ValueVecItemsU64) { 623 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector entries %d not as expected %d", 624 testConfig1,((psVector*)(entryChild->data.V))->n,testConfig1ValueVecItemsU64); 625 return i*10+5; 626 } 627 // Verify the correct type 628 if(((psVector*)(entryChild->data.V))->type.type != testConfig1ValueVecTypeU64) { 629 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector type %d not as expected %s", 630 testConfig1,((psVector*)entryChild->data.V)->type.type,testConfig1ValueVecTypeU64); 631 return i*10+5; 632 } 633 // Verify the values in vector 634 for(psS32 j = 0; j < testConfig1ValueVecItemsU64; j++) { 635 if(((psVector*)entryChild->data.V)->data.U64[j] != testConfig1ValueVecValueU64[j]) { 636 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector data[%d] = %ld not as expected %ld", 637 testConfig1,j,((psVector*)entryChild->data.V)->data.U64[j], 638 testConfig1ValueVecValueU64[j]); 639 return i*10+5*j; 640 } 641 } 642 break; 643 case PS_TYPE_S8: 644 if(((psVector*)(entryChild->data.V))->n != testConfig1ValueVecItemsS8) { 645 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector entries %d not as expected %d", 646 testConfig1,((psVector*)(entryChild->data.V))->n,testConfig1ValueVecItemsS8); 647 return i*10+5; 648 } 649 // Verify the correct type 650 if(((psVector*)(entryChild->data.V))->type.type != testConfig1ValueVecTypeS8) { 651 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector type %d not as expected %s", 652 testConfig1,((psVector*)entryChild->data.V)->type.type,testConfig1ValueVecTypeS8); 653 return i*10+5; 654 } 655 // Verify the values in vector 656 for(psS32 j = 0; j < testConfig1ValueVecItemsS8; j++) { 657 if(((psVector*)entryChild->data.V)->data.S8[j] != testConfig1ValueVecValueS8[j]) { 658 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector data[%d] = %d not as expected %d", 659 testConfig1,j,((psVector*)entryChild->data.V)->data.S8[j], 660 testConfig1ValueVecValueS8[j]); 661 return i*10+5*j; 662 } 663 } 664 break; 665 case PS_TYPE_S16: 666 if(((psVector*)(entryChild->data.V))->n != testConfig1ValueVecItemsS16) { 667 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector entries %d not as expected %d", 668 testConfig1,((psVector*)(entryChild->data.V))->n,testConfig1ValueVecItemsS16); 669 return i*10+5; 670 } 671 // Verify the correct type 672 if(((psVector*)(entryChild->data.V))->type.type != testConfig1ValueVecTypeS16) { 673 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector type %d not as expected %s", 674 testConfig1,((psVector*)entryChild->data.V)->type.type,testConfig1ValueVecTypeS16); 675 return i*10+5; 676 } 677 // Verify the values in vector 678 for(psS32 j = 0; j < testConfig1ValueVecItemsS16; j++) { 679 if(((psVector*)entryChild->data.V)->data.S16[j] != testConfig1ValueVecValueS16[j]) { 680 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector data[%d] = %d not as expected %d", 681 testConfig1,j,((psVector*)entryChild->data.V)->data.S16[j], 682 testConfig1ValueVecValueS16[j]); 683 return i*10+5*j; 684 } 685 } 686 break; 687 case PS_TYPE_S32: 688 if(((psVector*)(entryChild->data.V))->n != testConfig1ValueVecItemsS32) { 689 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector entries %d not as expected %d", 690 testConfig1,((psVector*)(entryChild->data.V))->n,testConfig1ValueVecItemsS32); 691 return i*10+5; 692 } 693 // Verify the correct type 694 if(((psVector*)(entryChild->data.V))->type.type != testConfig1ValueVecTypeS32) { 695 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector type %d not as expected %s", 696 testConfig1,((psVector*)entryChild->data.V)->type.type,testConfig1ValueVecTypeS32); 697 return i*10+5; 698 } 699 // Verify the values in vector 700 for(psS32 j = 0; j < testConfig1ValueVecItemsS32; j++) { 701 if(((psVector*)entryChild->data.V)->data.S32[j] != testConfig1ValueVecValueS32[j]) { 702 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector data[%d] = %d not as expected %d", 703 testConfig1,j,((psVector*)entryChild->data.V)->data.S32[j], 704 testConfig1ValueVecValueS32[j]); 705 return i*10+5*j; 706 } 707 } 708 break; 709 case PS_TYPE_S64: 710 if(((psVector*)(entryChild->data.V))->n != testConfig1ValueVecItemsS64) { 711 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector entries %d not as expected %d", 712 testConfig1,((psVector*)(entryChild->data.V))->n,testConfig1ValueVecItemsS64); 713 return i*10+5; 714 } 715 // Verify the correct type 716 if(((psVector*)(entryChild->data.V))->type.type != testConfig1ValueVecTypeS64) { 717 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector type %d not as expected %s", 718 testConfig1,((psVector*)entryChild->data.V)->type.type,testConfig1ValueVecTypeS64); 719 return i*10+5; 720 } 721 // Verify the values in vector 722 for(psS32 j = 0; j < testConfig1ValueVecItemsS64; j++) { 723 if(((psVector*)entryChild->data.V)->data.S64[j] != testConfig1ValueVecValueS64[j]) { 724 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector data[%d] = %ld not as expected %ld", 725 testConfig1,j,((psVector*)entryChild->data.V)->data.S64[j], 726 testConfig1ValueVecValueS64[j]); 727 return i*10+5*j; 728 } 729 } 730 break; 731 case PS_TYPE_F32: 732 if(((psVector*)(entryChild->data.V))->n != testConfig1ValueVecItemsF32) { 733 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector entries %d not as expected %d", 734 testConfig1,((psVector*)(entryChild->data.V))->n,testConfig1ValueVecItemsF32); 735 return i*10+5; 736 } 737 // Verify the correct type 738 if(((psVector*)(entryChild->data.V))->type.type != testConfig1ValueVecTypeF32) { 739 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector type %d not as expected %s", 740 testConfig1,((psVector*)entryChild->data.V)->type.type,testConfig1ValueVecTypeF32); 741 return i*10+5; 742 } 743 // Verify the values in vector 744 for(psS32 j = 0; j < testConfig1ValueVecItemsF32; j++) { 745 if(fabs(((psVector*)entryChild->data.V)->data.F32[j]-testConfig1ValueVecValueF32[j]) 746 > ERROR_TOL) { 747 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector data[%d] = %f not as expected %f", 748 testConfig1,j,((psVector*)entryChild->data.V)->data.F32[j], 749 testConfig1ValueVecValueF32[j]); 750 return i*10+5*j; 751 } 752 } 753 break; 754 case PS_TYPE_F64: 755 if(((psVector*)(entryChild->data.V))->n != testConfig1ValueVecItemsF64) { 756 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector entries %d not as expected %d", 757 testConfig1,((psVector*)(entryChild->data.V))->n,testConfig1ValueVecItemsF64); 758 return i*10+5; 759 } 760 // Verify the correct type 761 if(((psVector*)(entryChild->data.V))->type.type != testConfig1ValueVecTypeF64) { 762 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector type %d not as expected %s", 763 testConfig1,((psVector*)entryChild->data.V)->type.type,testConfig1ValueVecTypeF64); 764 return i*10+5; 765 } 766 // Verify the values in vector 767 for(psS32 j = 0; j < testConfig1ValueVecItemsF64; j++) { 768 if(fabs(((psVector*)entryChild->data.V)->data.F64[j]-testConfig1ValueVecValueF64[j]) 769 > ERROR_TOL) { 770 psError(PS_ERR_UNKNOWN,true,"File: %s : Vector data[%d] = %lf not as expected %lf", 771 testConfig1,j,((psVector*)entryChild->data.V)->data.F64[j], 772 testConfig1ValueVecValueF64[j]); 773 return i*10+5*j; 774 } 775 } 776 break; 777 default: 778 break; 779 } 780 break; 781 case PS_META_META: 782 if(metaCounter == 0) { 783 // Check if number of items is as expected 784 if(entryChild->data.md->list->size != testConfig1ValueMetaItems1) { 785 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 1 items %d not as expected %d", 786 testConfig1,entryChild->data.md->list->size,testConfig1ValueMetaItems1); 787 return i*10+6; 788 } 789 // Loop through metadata items 790 mdIter = psListIteratorAlloc(entryChild->data.md->list, PS_LIST_HEAD, true); 791 mdCounter = 0; 792 while ( (mdChild = psListGetAndIncrement(mdIter)) != NULL) { 793 if(strcmp(mdChild->name,testConfig1ValueMetaNames1[mdCounter]) != 0) { 794 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 1 name[%d] %s not as expected %s", 795 testConfig1,mdCounter,mdChild->name,testConfig1ValueMetaNames1[mdCounter]); 796 return i*10+6*mdCounter; 797 } 798 if(mdChild->type != testConfig1ValueMetaTypes1[mdCounter]) { 799 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 1 type[%d] %d not as expected %d", 800 testConfig1,mdCounter,mdChild->type,testConfig1ValueMetaTypes1[mdCounter]); 801 return i*10+6*mdCounter; 802 } 803 if(strcmp((char*)mdChild->data.V,testConfig1ValueMetaValue1[mdCounter]) != 0) { 804 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 1 value[%d] %s not as expected %s", 805 testConfig1,mdCounter,(char*)mdChild->data.V,testConfig1ValueMetaValue1[mdCounter]); 806 return i*10+6*mdCounter; 807 } 808 mdCounter++; 809 } 810 psFree(mdIter); 811 } else if(metaCounter == 1) { 812 // Check if number of items is as expected 813 if(entryChild->data.md->list->size != testConfig1ValueMetaItems2) { 814 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 2 items %d not as expected %d", 815 testConfig1,entryChild->data.md->list->size,testConfig1ValueMetaItems2); 816 return i*10+6; 817 } 818 // Loop through metadata items 819 mdIter = psListIteratorAlloc(entryChild->data.md->list, PS_LIST_HEAD, true); 820 mdCounter = 0; 821 while ( (mdChild = psListGetAndIncrement(mdIter)) != NULL) { 822 if(strcmp(mdChild->name,testConfig1ValueMetaNames2[mdCounter]) != 0) { 823 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 2 name[%d] %s not as expected %s", 824 testConfig1,mdCounter,mdChild->name,testConfig1ValueMetaNames2[mdCounter]); 825 return i*10+6*mdCounter; 826 } 827 if(mdChild->type != testConfig1ValueMetaTypes2[mdCounter]) { 828 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 2 type[%d] %d not as expected %d", 829 testConfig1,mdCounter,mdChild->type,testConfig1ValueMetaTypes2[mdCounter]); 830 return i*10+6*mdCounter; 831 } 832 if(strcmp((char*)mdChild->data.V,testConfig1ValueMetaValue2[mdCounter]) != 0) { 833 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 2 value[%d] %s not as expected %s", 834 testConfig1,mdCounter,(char*)mdChild->data.V,testConfig1ValueMetaValue2[mdCounter]); 835 return i*10+6*mdCounter; 836 } 837 mdCounter++; 838 } 839 psFree(mdIter); 840 } else if(metaCounter == 2) { 841 // Check if number of items is as expected 842 if(entryChild->data.md->list->size != testConfig1ValueMetaItems3) { 843 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 3 items %d not as expected %d", 844 testConfig1,entryChild->data.md->list->size,testConfig1ValueMetaItems3); 845 return i*10+6; 846 } 847 // Loop through metadata items 848 mdIter = psListIteratorAlloc(entryChild->data.md->list, PS_LIST_HEAD, true); 849 mdCounter = 0; 850 while ( (mdChild = psListGetAndIncrement(mdIter)) != NULL) { 851 if(strcmp(mdChild->name,testConfig1ValueMetaNames3[mdCounter]) != 0) { 852 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 3 name[%d] %s not as expected %s", 853 testConfig1,mdCounter,mdChild->name,testConfig1ValueMetaNames3[mdCounter]); 854 return i*10+6*mdCounter; 855 } 856 if(mdChild->type != testConfig1ValueMetaTypes3[mdCounter]) { 857 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 3 type[%d] %d not as expected %d", 858 testConfig1,mdCounter,mdChild->type,testConfig1ValueMetaTypes3[mdCounter]); 859 return i*10+6*mdCounter; 860 } 861 switch(mdChild->type) { 862 case PS_META_STR: 863 if(strcmp((char*)mdChild->data.V,testConfig1ValueMetaValueStr3[mdCounter]) != 0) { 864 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 3 value[%d] %s not as expected %s", 865 testConfig1,mdCounter,(char*)mdChild->data.V, 866 testConfig1ValueMetaValueStr3[mdCounter]); 867 return i*10+6*mdCounter; 868 } 869 break; 870 case PS_META_S32: 871 if(mdChild->data.S32 != testConfig1ValueMetaValueS323[mdCounter]) { 872 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 3 value[%d] %d not as expected %d", 873 testConfig1,mdCounter,mdChild->data.S32, 874 testConfig1ValueMetaValueS323[mdCounter]); 875 return i*10+6*mdCounter; 876 } 877 break; 878 default: 879 psError(PS_ERR_UNKNOWN,true,"File: %s : Metadata 3 value[%d] unknown type", 880 testConfig1,mdCounter); 881 return i*10+6*mdCounter; 882 break; 883 } 884 mdCounter++; 885 } 886 psFree(mdIter); 887 } 888 metaCounter++; 889 break; 890 default: 891 psError(PS_ERR_UNKNOWN,true,"Unexpected type %d encountered",entryChild->type); 892 return i*10+5; 893 break; 894 } 895 } 896 897 writeMetadata(metadata1,""); 898 156 899 psFree(metadata1); 157 psFree(metadata2);158 psFree(metadata3);159 if(psMemCheckLeaks(0, NULL, stdout,false)) {160 psError(PS_ERR_UNKNOWN,true,"Memory leak detected");161 return 10;162 }163 psMemCheckCorruption(0);164 psS32 nBad = psMemCheckCorruption(0);165 if(nBad) {166 printf("ERROR: Found %d bad memory blocks\n", nBad);167 }168 printFooter(stdout, "psMetadata", "Test F - Free psMetadata", true);169 170 900 171 901 return 0; 172 902 } 903 904 psS32 testMetadataParseConfig1(void) 905 { 906 psMetadata* metadata1 = NULL; 907 psS32 failedLines = 0; 908 909 // Read config file test2.config with overwrite set true 910 // This file contains parse errors 911 psLogMsg(__func__,PS_LOG_INFO,"Following should generate parse error message"); 912 metadata1 = psMetadataParseConfig(metadata1,&failedLines,testConfig2,true); 913 // Verify the expected number of failed lines 914 if(!checkFailedLines(failedLines,testConfig2Fails,(char*)testConfig2)) { 915 return 1; 916 } 917 // Verify return value is null 918 if(metadata1 != NULL) { 919 psError(PS_ERR_UNKNOWN,true,"Expected a NULL return for failed parse"); 920 return 2; 921 } 922 923 // Attempt parse a non-existant file 924 psLogMsg(__func__,PS_LOG_INFO,"Following should generate error message"); 925 metadata1 = psMetadataParseConfig(metadata1,&failedLines,"ab.config",true); 926 if(metadata1 != NULL) { 927 psError(PS_ERR_UNKNOWN,true,"Expected a NULL return for non-existant file"); 928 return 3; 929 } 930 931 // Attempt parse with NULL failed lines ptr 932 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL failed lines arg"); 933 metadata1 = psMetadataParseConfig(metadata1,NULL,testConfig2,true); 934 if(metadata1 != NULL) { 935 psError(PS_ERR_UNKNOWN,true,"Expected a NULL return for NULL failed lines argument"); 936 return 4; 937 } 938 939 // Attempt parse with NULL file name 940 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error message for NULL file name arg"); 941 metadata1 = psMetadataParseConfig(metadata1,&failedLines,NULL,true); 942 if(metadata1 != NULL) { 943 psError(PS_ERR_UNKNOWN,true,"Expected a NULL return for NULL filename argument"); 944 return 5; 945 } 946 947 psFree(metadata1); 948 949 return 0; 950 } 951 952 psS32 testMetadataParseConfig2(void) 953 { 954 psMetadata* metadata1 = NULL; 955 psS32 failedLines = 0; 956 957 // Read config file test1.config with overwrite set false 958 psLogMsg(__func__,PS_LOG_INFO,"Following should generate an error of duplicate key names"); 959 metadata1 = psMetadataParseConfig(metadata1,&failedLines,testConfig3,false); 960 // Verify the expected number of failed lines 961 if(!checkFailedLines(failedLines,testConfig3Fails,(char*)testConfig3)) { 962 return 1; 963 } 964 if(metadata1 != NULL) { 965 psError(PS_ERR_UNKNOWN,true,"Expected a NULL return for failed due to overwrite false"); 966 return 2; 967 } 968 psFree(metadata1); 969 970 return 0; 971 } 972 -
trunk/psLib/test/collections/verified/tst_psMetadataIO.stderr
r3690 r3945 1 /***************************** TESTPOINT ******************************************\ 2 * TestFile: tst_psMetadataIO.c * 3 * TestPoint: psMetadataParseConfig{psMetadataParseConfig} * 4 * TestType: Positive * 5 \**********************************************************************************/ 6 7 <DATE><TIME>|<HOST>|W|psMetadataAddItem 8 Metadata item Float has been replaced 9 10 ---> TESTPOINT PASSED (psMetadataParseConfig{psMetadataParseConfig} | tst_psMetadataIO.c) 11 12 /***************************** TESTPOINT ******************************************\ 13 * TestFile: tst_psMetadataIO.c * 14 * TestPoint: psMetadataParseConfig{psMetadataParseConfig} * 15 * TestType: Positive * 16 \**********************************************************************************/ 17 18 <DATE><TIME>|<HOST>|I|testMetadataParseConfig1 19 Following should generate parse error message 20 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 21 Failed to parse the value 'X' of metadata item boolean, type BOOL, on line 2 of test2.config. 22 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 23 Failed to read a metadata value on line 4 of test2.config. 24 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 25 Failed to read a metadata value on line 7 of test2.config. 26 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 27 Failed to parse the value 'x,y,z' of metadata item @vector1, type U8, on line 8 of test2.config. 28 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 29 Failed to read a metadata type on line 9 of test2.config. 30 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 31 Failed to read a metadata value on line 9 of test2.config. 32 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 33 Failed to parse the value '' of metadata item @vector3, type F8, on line 10 of test2.config. 34 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 35 Duplicate MULTI specifier on line 14 of test2.config. 36 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 37 Metadata type 'CELL', found on line 17 of test2.config, is not invalid. 38 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 39 Failed to parse the value 'aabb' of metadata item value1, type F64, on line 20 of test2.config. 40 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 41 Failed to parse the value 'ccdd' of metadata item value2, type S32, on line 21 of test2.config. 42 <DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO) 43 More than one '@' character not allowed. Found on line 24 of test2.config. 44 <DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO) 45 Failed to read a metadata type on line 27 of test2.config. 46 <DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO) 47 Specified type, CELL, on line 31 of test2.config is already defined. 48 <DATE><TIME>|<HOST>|E|psMetadataAddItem (FILE:LINENO) 49 Duplicate metadata item name is not allowed. Use a psMetadataFlags option to allow such action. 50 <DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO) 51 Metadata type 'NEWCELL', found on line 37 of test2.config, is not invalid. 52 <DATE><TIME>|<HOST>|E|parseMetadataItem (FILE:LINENO) 53 Failed to read a metadata OURCELL on line 40 of test2.config. 54 <DATE><TIME>|<HOST>|E|parseLine (FILE:LINENO) 55 Metadata type 'NEWCELL1', found on line 43 of test2.config, is not invalid. 56 <DATE><TIME>|<HOST>|I|testMetadataParseConfig1 57 Following should generate error message 1 58 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 2 Failed to parse the value '9876.54qqq32' of metadata item xPosition, type F64, on line 89 of test.config. 59 Failed to open file 'ab.config'. Check if it exists and it has the proper permissions. 60 <DATE><TIME>|<HOST>|I|testMetadataParseConfig1 61 Following should generate an error message for NULL failed lines arg 3 62 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 4 Failed to read a metadata value on line 95 of test.config. 63 Unallowable operation: nFail is NULL. 64 <DATE><TIME>|<HOST>|I|testMetadataParseConfig1 65 Following should generate an error message for NULL file name arg 5 66 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 6 Metadata type '99.999', found on line 101 of test.config, is not invalid. 7 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 8 More than one '*' character not allowed. Found on line 107 of test.config. 9 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 10 More than one '@' character not allowed. Found on line 113 of test.config. 11 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 12 More than one '~' character not allowed. Found on line 119 of test.config. 13 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 14 Failed to parse the value '9876.54qqq32' of metadata item xPosition, type F64, on line 89 of test.config. 15 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 16 Failed to read a metadata value on line 95 of test.config. 17 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 18 Metadata type '99.999', found on line 101 of test.config, is not invalid. 19 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 20 More than one '*' character not allowed. Found on line 107 of test.config. 21 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 22 More than one '@' character not allowed. Found on line 113 of test.config. 23 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 24 More than one '~' character not allowed. Found on line 119 of test.config. 67 Unallowable operation: fileName is NULL. 68 69 ---> TESTPOINT PASSED (psMetadataParseConfig{psMetadataParseConfig} | tst_psMetadataIO.c) 70 71 /***************************** TESTPOINT ******************************************\ 72 * TestFile: tst_psMetadataIO.c * 73 * TestPoint: psMetadataParseConfig{psMetadataParseConfig} * 74 * TestType: Positive * 75 \**********************************************************************************/ 76 77 <DATE><TIME>|<HOST>|I|testMetadataParseConfig2 78 Following should generate an error of duplicate key names 25 79 <DATE><TIME>|<HOST>|E|psMetadataAddItem (FILE:LINENO) 26 80 Duplicate metadata item name is not allowed. Use a psMetadataFlags option to allow such action. 27 81 <DATE><TIME>|<HOST>|E|psMetadataAddV (FILE:LINENO) 28 82 Failed to add metadata item to metadata collection list. 29 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 30 Duplicate Metadata item, speed, found on line 127 of test.config. Overwrite not allowed. 31 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 32 Failed to parse the value '9876.54qqq32' of metadata item xPosition, type F64, on line 89 of test.config. 33 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 34 Failed to read a metadata value on line 95 of test.config. 35 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 36 Metadata type '99.999', found on line 101 of test.config, is not invalid. 37 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 38 More than one '*' character not allowed. Found on line 107 of test.config. 39 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 40 More than one '@' character not allowed. Found on line 113 of test.config. 41 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 42 More than one '~' character not allowed. Found on line 119 of test.config. 43 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 44 Unallowable operation: fileName is NULL. 45 <DATE><TIME>|<HOST>|E|psMetadataParseConfig (FILE:LINENO) 46 Failed to open file 'abcedfg'. Check if it exists and it has the proper permissions. 83 84 ---> TESTPOINT PASSED (psMetadataParseConfig{psMetadataParseConfig} | tst_psMetadataIO.c) 85 -
trunk/psLib/test/collections/verified/tst_psMetadataIO.stdout
r3779 r3945 1 /***************************** TESTPOINT ******************************************\ 2 * TestFile: tst_psMetadataIO.c * 3 * TestPoint: psMetadata{Test A - Read config file with overwrite set true} * 4 * TestType: Positive * 5 \**********************************************************************************/ 1 Double F64 1.234568 # This is a comment 2 String STR This is the string that forms the value # comment 3 boolean BOOL 1 # The value of 'boolean' is 'true' 4 @primes U8 2,3,5,7,11,13,17 # These are prime numbers 5 comment MULTI 6 comment STR This 7 comment STR is 8 comment STR a 9 comment STR non-unique 10 comment STR key 11 Float F64 1.234560 # This generates a warning, and, if 'overwrite' is 'false', is ignored 12 boolean1 BOOL 0 # The value of 'boolean' is 'false' 13 @negprimes S8 -2,-3,-5,-7,-11,-13,-17,-19 14 @vector1 U16 0,1,2,4,8 15 @vector2 U32 0,8,16,32,64,128 16 @vector3 U64 0,64,256 17 @vector4 S16 -2,-1,0,1,2 18 @vector5 S32 -4,-2,0,2,4,6 19 @vector6 S64 -16,-4,0,4,16,36,64 20 @vector7 F32 -1.03,1.04,-1.05,1.06 21 @vector8 F64 -2.22,2.21,-2.2,2.19,-2.18 22 CELL.00 METADATA 23 EXTNAME STR CCD00 24 BIASSEC STR BSEC-00 25 CHIP STR CHIP.00 6 26 7 Failed lines: 6 Expected: 6 8 Contents of metadata list: 9 Key Name: pi Key mdType: 0x00000408 Key Value: 3.142 Key Comment: Definition of pi 10 Key Name: altitude Key mdType: 0x00000104 Key Value: 10000 Key Comment: 11 Key Name: time Key mdType: 0x00000404 Key Value: 1234.568 Key Comment: 12 Key Name: myBool Key mdType: 0x00001301 Key Value: 0 Key Comment: F, f, 0, T, t, 1 are also acceptable 13 Key Name: title1 Key mdType: 0x00010001 Key Value: Hello world Key Comment: This is a comment for the string value 14 Key Name: title2 Key mdType: 0x00010001 Key Value: Good bye world Key Comment: STRING or STR may be used as the string type 15 Key Name: primes Key mdType: 0x00010002 Key Value: [2,3,5,7,...] Key Comment: These are prime numbers 16 Key Name: negatives Key mdType: 0x00010002 Key Value: [-1,-2,-3,...] Key Comment: 17 Key Name: comment Key mdType: 0x00010001 Key Value: This Key Comment: 18 Key Name: comment Key mdType: 0x00010001 Key Value: is Key Comment: 19 Key Name: comment Key mdType: 0x00010001 Key Value: an Key Comment: 20 Key Name: comment Key mdType: 0x00010001 Key Value: ugly Key Comment: 21 Key Name: comment Key mdType: 0x00010001 Key Value: comment Key Comment: 22 Key Name: comment Key mdType: 0x00010001 Key Value: but Key Comment: 23 Key Name: comment Key mdType: 0x00010001 Key Value: still Key Comment: 24 Key Name: comment Key mdType: 0x00010001 Key Value: valid Key Comment: 25 Key Name: speed Key mdType: 0x00000404 Key Value: 66.660 Key Comment: 27 CELL.01 METADATA 28 EXTNAME STR CCD01 29 BIASSEC STR BSEC-01 30 CHIP STR CHIP.00 26 31 27 Contents of metadata table: 28 Key Name: comment Key mdType: 0x0001000a Key Value: Key Comment: List of Metadata Items 29 Key Name: comment Key mdType: 0x00010001 Key Value: This Key Comment: 30 Key Name: comment Key mdType: 0x00010001 Key Value: is Key Comment: 31 Key Name: comment Key mdType: 0x00010001 Key Value: an Key Comment: 32 Key Name: comment Key mdType: 0x00010001 Key Value: ugly Key Comment: 33 Key Name: comment Key mdType: 0x00010001 Key Value: comment Key Comment: 34 Key Name: comment Key mdType: 0x00010001 Key Value: but Key Comment: 35 Key Name: comment Key mdType: 0x00010001 Key Value: still Key Comment: 36 Key Name: comment Key mdType: 0x00010001 Key Value: valid Key Comment: 37 Key Name: title2 Key mdType: 0x00010001 Key Value: Good bye world Key Comment: STRING or STR may be used as the string type 38 Key Name: time Key mdType: 0x00000404 Key Value: 1234.568 Key Comment: 39 Key Name: negatives Key mdType: 0x00010002 Key Value: [-1,-2,-3,...] Key Comment: 40 Key Name: pi Key mdType: 0x00000408 Key Value: 3.142 Key Comment: Definition of pi 41 Key Name: myBool Key mdType: 0x00001301 Key Value: 0 Key Comment: F, f, 0, T, t, 1 are also acceptable 42 Key Name: primes Key mdType: 0x00010002 Key Value: [2,3,5,7,...] Key Comment: These are prime numbers 43 Key Name: altitude Key mdType: 0x00000104 Key Value: 10000 Key Comment: 44 Key Name: speed Key mdType: 0x00000404 Key Value: 66.660 Key Comment: 45 Key Name: title1 Key mdType: 0x00010001 Key Value: Hello world Key Comment: This is a comment for the string value 32 MYCELL MULTI 33 MYCELL METADATA 34 EXTNAME STR CCD00 35 BIASSEC STR BSEC-00 36 CHIP STR CHIP.00 37 NCELL S32 24 46 38 47 ---> TESTPOINT PASSED (psMetadata{Test A - Read config file with overwrite set true} | tst_psMetadataIO.c) 39 MYCELL S32 123 # A number 40 cell METADATA 41 foo METADATA 42 bar STR BAZ 43 ping STR PONG 48 44 49 /***************************** TESTPOINT ******************************************\ 50 * TestFile: tst_psMetadataIO.c * 51 * TestPoint: psMetadata{Test B - Read config file with overwrite set false} * 52 * TestType: Positive * 53 \**********************************************************************************/ 45 EXTNAME STR CCD00 46 BIASSEC STR BSEC-00 47 CHIP STR CHIP.00 48 NCELL S32 12 54 49 55 Failed lines: 7 Expected: 7 Contents of metadata list:56 Key Name: pi Key mdType: 0x00000408 Key Value: 3.142 Key Comment: Definition of pi57 Key Name: altitude Key mdType: 0x00000104 Key Value: 10000 Key Comment:58 Key Name: time Key mdType: 0x00000404 Key Value: 1234.568 Key Comment:59 Key Name: myBool Key mdType: 0x00001301 Key Value: 0 Key Comment: F, f, 0, T, t, 1 are also acceptable60 Key Name: title1 Key mdType: 0x00010001 Key Value: Hello world Key Comment: This is a comment for the string value61 Key Name: title2 Key mdType: 0x00010001 Key Value: Good bye world Key Comment: STRING or STR may be used as the string type62 Key Name: primes Key mdType: 0x00010002 Key Value: [2,3,5,7,...] Key Comment: These are prime numbers63 Key Name: negatives Key mdType: 0x00010002 Key Value: [-1,-2,-3,...] Key Comment:64 Key Name: comment Key mdType: 0x00010001 Key Value: This Key Comment:65 Key Name: comment Key mdType: 0x00010001 Key Value: is Key Comment:66 Key Name: comment Key mdType: 0x00010001 Key Value: an Key Comment:67 Key Name: comment Key mdType: 0x00010001 Key Value: ugly Key Comment:68 Key Name: comment Key mdType: 0x00010001 Key Value: comment Key Comment:69 Key Name: comment Key mdType: 0x00010001 Key Value: but Key Comment:70 Key Name: comment Key mdType: 0x00010001 Key Value: still Key Comment:71 Key Name: comment Key mdType: 0x00010001 Key Value: valid Key Comment:72 Key Name: speed Key mdType: 0x00000404 Key Value: 55.550 Key Comment:73 74 Contents of metadata table:75 Key Name: comment Key mdType: 0x0001000a Key Value: Key Comment: List of Metadata Items76 Key Name: comment Key mdType: 0x00010001 Key Value: This Key Comment:77 Key Name: comment Key mdType: 0x00010001 Key Value: is Key Comment:78 Key Name: comment Key mdType: 0x00010001 Key Value: an Key Comment:79 Key Name: comment Key mdType: 0x00010001 Key Value: ugly Key Comment:80 Key Name: comment Key mdType: 0x00010001 Key Value: comment Key Comment:81 Key Name: comment Key mdType: 0x00010001 Key Value: but Key Comment:82 Key Name: comment Key mdType: 0x00010001 Key Value: still Key Comment:83 Key Name: comment Key mdType: 0x00010001 Key Value: valid Key Comment:84 Key Name: title2 Key mdType: 0x00010001 Key Value: Good bye world Key Comment: STRING or STR may be used as the string type85 Key Name: time Key mdType: 0x00000404 Key Value: 1234.568 Key Comment:86 Key Name: negatives Key mdType: 0x00010002 Key Value: [-1,-2,-3,...] Key Comment:87 Key Name: pi Key mdType: 0x00000408 Key Value: 3.142 Key Comment: Definition of pi88 Key Name: myBool Key mdType: 0x00001301 Key Value: 0 Key Comment: F, f, 0, T, t, 1 are also acceptable89 Key Name: primes Key mdType: 0x00010002 Key Value: [2,3,5,7,...] Key Comment: These are prime numbers90 Key Name: altitude Key mdType: 0x00000104 Key Value: 10000 Key Comment:91 Key Name: speed Key mdType: 0x00000404 Key Value: 55.550 Key Comment:92 Key Name: title1 Key mdType: 0x00010001 Key Value: Hello world Key Comment: This is a comment for the string value93 94 ---> TESTPOINT PASSED (psMetadata{Test B - Read config file with overwrite set false} | tst_psMetadataIO.c)95 96 /***************************** TESTPOINT ******************************************\97 * TestFile: tst_psMetadataIO.c *98 * TestPoint: psMetadata{Test C - Read config file without auto-allocation of metadata} *99 * TestType: Positive *100 \**********************************************************************************/101 102 Failed lines: 6 Expected: 6 Contents of metadata list:103 Key Name: pi Key mdType: 0x00000408 Key Value: 3.142 Key Comment: Definition of pi104 Key Name: altitude Key mdType: 0x00000104 Key Value: 10000 Key Comment:105 Key Name: time Key mdType: 0x00000404 Key Value: 1234.568 Key Comment:106 Key Name: myBool Key mdType: 0x00001301 Key Value: 0 Key Comment: F, f, 0, T, t, 1 are also acceptable107 Key Name: title1 Key mdType: 0x00010001 Key Value: Hello world Key Comment: This is a comment for the string value108 Key Name: title2 Key mdType: 0x00010001 Key Value: Good bye world Key Comment: STRING or STR may be used as the string type109 Key Name: primes Key mdType: 0x00010002 Key Value: [2,3,5,7,...] Key Comment: These are prime numbers110 Key Name: negatives Key mdType: 0x00010002 Key Value: [-1,-2,-3,...] Key Comment:111 Key Name: comment Key mdType: 0x00010001 Key Value: This Key Comment:112 Key Name: comment Key mdType: 0x00010001 Key Value: is Key Comment:113 Key Name: comment Key mdType: 0x00010001 Key Value: an Key Comment:114 Key Name: comment Key mdType: 0x00010001 Key Value: ugly Key Comment:115 Key Name: comment Key mdType: 0x00010001 Key Value: comment Key Comment:116 Key Name: comment Key mdType: 0x00010001 Key Value: but Key Comment:117 Key Name: comment Key mdType: 0x00010001 Key Value: still Key Comment:118 Key Name: comment Key mdType: 0x00010001 Key Value: valid Key Comment:119 Key Name: speed Key mdType: 0x00000404 Key Value: 66.660 Key Comment:120 121 Contents of metadata table:122 Key Name: comment Key mdType: 0x0001000a Key Value: Key Comment: List of Metadata Items123 Key Name: comment Key mdType: 0x00010001 Key Value: This Key Comment:124 Key Name: comment Key mdType: 0x00010001 Key Value: is Key Comment:125 Key Name: comment Key mdType: 0x00010001 Key Value: an Key Comment:126 Key Name: comment Key mdType: 0x00010001 Key Value: ugly Key Comment:127 Key Name: comment Key mdType: 0x00010001 Key Value: comment Key Comment:128 Key Name: comment Key mdType: 0x00010001 Key Value: but Key Comment:129 Key Name: comment Key mdType: 0x00010001 Key Value: still Key Comment:130 Key Name: comment Key mdType: 0x00010001 Key Value: valid Key Comment:131 Key Name: title2 Key mdType: 0x00010001 Key Value: Good bye world Key Comment: STRING or STR may be used as the string type132 Key Name: time Key mdType: 0x00000404 Key Value: 1234.568 Key Comment:133 Key Name: negatives Key mdType: 0x00010002 Key Value: [-1,-2,-3,...] Key Comment:134 Key Name: pi Key mdType: 0x00000408 Key Value: 3.142 Key Comment: Definition of pi135 Key Name: myBool Key mdType: 0x00001301 Key Value: 0 Key Comment: F, f, 0, T, t, 1 are also acceptable136 Key Name: primes Key mdType: 0x00010002 Key Value: [2,3,5,7,...] Key Comment: These are prime numbers137 Key Name: altitude Key mdType: 0x00000104 Key Value: 10000 Key Comment:138 Key Name: speed Key mdType: 0x00000404 Key Value: 66.660 Key Comment:139 Key Name: title1 Key mdType: 0x00010001 Key Value: Hello world Key Comment: This is a comment for the string value140 141 ---> TESTPOINT PASSED (psMetadata{Test C - Read config file without auto-allocation of metadata} | tst_psMetadataIO.c)142 143 /***************************** TESTPOINT ******************************************\144 * TestFile: tst_psMetadataIO.c *145 * TestPoint: psMetadataIO{Test D - Attempt to use null fileName argument} *146 * TestType: Negative *147 * ExpectedErrorText: Null failedLines not allowed *148 * ExpectedStatusValue: 0 *149 \**********************************************************************************/150 151 152 ---> TESTPOINT PASSED (psMetadata{Test D - Attempt to use null fileName argument} | tst_psMetadataIO.c)153 154 /***************************** TESTPOINT ******************************************\155 * TestFile: tst_psMetadataIO.c *156 * TestPoint: psMetadataIO{Test E - Attempt to open nonexistant file} *157 * TestType: Negative *158 * ExpectedErrorText: Error opening file *159 * ExpectedStatusValue: 0 *160 \**********************************************************************************/161 162 163 ---> TESTPOINT PASSED (psMetadata{Test E - Attempt to open nonexistant file} | tst_psMetadataIO.c)164 165 /***************************** TESTPOINT ******************************************\166 * TestFile: tst_psMetadataIO.c *167 * TestPoint: psMetadata{Test F - Free psMetadata} *168 * TestType: Positive *169 \**********************************************************************************/170 171 172 ---> TESTPOINT PASSED (psMetadata{Test F - Free psMetadata} | tst_psMetadataIO.c)173 -
trunk/psLib/test/collections/verified/tst_psMetadata_01.stdout
r3779 r3945 44 44 Key Name: PCOUNT Key mdType: 0x00000104 Key Value: 0 Key Comment: required keyword; must = 0 45 45 Key Name: XTENSION Key mdType: 0x00010001 Key Value: 'IMAGE ' Key Comment: IMAGE extension 46 Key Name: BITPIX Key mdType: 0x0001000a Key Value: Key Comment: List of Metadata Items46 Key Name: BITPIX Key mdType: 0x0001000a Key Value: Key Comment: 47 47 Key Name: BITPIX Key mdType: 0x00000104 Key Value: -64 Key Comment: number of bits per data pixel 48 48 Key Name: BITPIX Key mdType: 0x00000104 Key Value: -64 Key Comment: number of bits per data pixel 49 49 Key Name: GCOUNT Key mdType: 0x00000104 Key Value: 1 Key Comment: required keyword; must = 1 50 Key Name: HISTORY Key mdType: 0x0001000a Key Value: Key Comment: List of Metadata Items50 Key Name: HISTORY Key mdType: 0x0001000a Key Value: Key Comment: 51 51 Key Name: HISTORY Key mdType: 0x00010001 Key Value: Key Comment: File modified by user 'harman' with fv on 2004-08-04T<DATE> 52 52 Key Name: HISTORY Key mdType: 0x00010001 Key Value: Key Comment: File modified by user 'harman' with fv on 2004-08-04T<DATE> … … 81 81 Key Name: GCOUNT Key mdType: 0x00000104 Key Value: 1 Key Comment: required keyword; must = 1 82 82 Key Name: BITPIX Key mdType: 0x00000104 Key Value: -64 Key Comment: number of bits per data pixel 83 Key Name: HISTORY Key mdType: 0x0001000a Key Value: Key Comment: List of Metadata Items83 Key Name: HISTORY Key mdType: 0x0001000a Key Value: Key Comment: 84 84 Key Name: HISTORY Key mdType: 0x00010001 Key Value: Key Comment: File modified by user 'harman' with fv on 2004-08-04T<DATE> 85 85 Key Name: HISTORY Key mdType: 0x00010001 Key Value: Key Comment: File modified by user 'harman' with fv on 2004-08-04T<DATE>
Note:
See TracChangeset
for help on using the changeset viewer.
