Changeset 14880 for trunk/psModules/test/config/tap_pmConfig.c
- Timestamp:
- Sep 18, 2007, 8:55:37 AM (19 years ago)
- File:
-
- 1 edited
-
trunk/psModules/test/config/tap_pmConfig.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/test/config/tap_pmConfig.c
r13879 r14880 3 3 * @brief Contains the tests for pmConfig.c: 4 4 * 5 * test00: This code will test the pmConfig() routine. 6 * 7 * @author GLG, MHPCC 8 * 9 * XXX: Untested: 10 * pmConfigValidateCamera() 11 * pmConfigCameraFromHeader() 12 * pmConfigRecipeFromCamera() 13 * pmConfigDB() 14 * 5 * This code will test the pmConfig() routine. 6 * pmConfigReadParamsSet 7 * pmConfigAlloc 8 * pmConfigSet 9 * pmConfigDone 10 * pmConfigFileRead 11 * pmConfigValidateCameraFormat 12 * pmConfigCameraFormatFromHeader 13 * pmConfigCameraByName 14 ? pmConfigDB 15 * pmConfigConformHeader 16 - pmConfigFileSets 17 - pmConfigFileSetsMD 18 * pmConfigConvertFilename 19 * pmConfigRead 15 20 * XXXX: Must determine what to do with NULL arguments, then test it. 16 21 * 17 * @version $Revision: 1. 1$ $Name: not supported by cvs2svn $18 * @date $Date: 2007-0 6-19 18:28:38$22 * @version $Revision: 1.2 $ $Name: not supported by cvs2svn $ 23 * @date $Date: 2007-09-18 18:55:36 $ 19 24 * 20 25 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 26 31 #include "tap.h" 27 32 #include "pstap.h" 33 #define ERR_TRACE_LEVEL 0 34 #define VERBOSE 0 28 35 29 36 int main(int argc, char* argv[]) … … 32 39 psLogSetLevel(PS_LOG_INFO); 33 40 psTraceSetLevel(".", 0); 34 plan_tests(20); 35 41 psTraceSetLevel("err", ERR_TRACE_LEVEL); 42 plan_tests(181); 43 44 // -------------------------------------------------------------------- 45 // -------------------------------------------------------------------- 46 // Tests for pmConfigReadParamsSet() 47 { 48 psMemId id = psMemGetId(); 49 bool oldReadCameraConfig = pmConfigReadParamsSet(false); 50 ok(oldReadCameraConfig == true, "pmConfigReadParamsSet() returned old value correctly"); 51 oldReadCameraConfig = pmConfigReadParamsSet(true); 52 ok(oldReadCameraConfig == false, "pmConfigReadParamsSet() returned old value correctly"); 53 oldReadCameraConfig = pmConfigReadParamsSet(true); 54 ok(oldReadCameraConfig == true, "pmConfigReadParamsSet() returned new value correctly"); 55 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 56 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 57 } 58 59 60 // -------------------------------------------------------------------- 61 // -------------------------------------------------------------------- 36 62 // Tests for pmConfigAlloc() 37 63 // XXX: Add a MemCheckConfig() function to verify the return type … … 62 88 } 63 89 64 65 // Verify error with NULL argc pointer 90 91 92 // -------------------------------------------------------------------- 93 // -------------------------------------------------------------------- 94 // Test pmConfigSet() 95 // Test with NULL input 96 // XX: Test with empty string? 97 { 98 psMemId id = psMemGetId(); 99 pmConfigSet(NULL); 100 ok(true, "called pmConfigSet() with NULL input pointer"); 101 psErr *tmpErr = psErrorLast(); 102 ok(PS_ERR_BAD_PARAMETER_VALUE == tmpErr->code, 103 "pmConfigSet(NULL) created the PS_ERR_BAD_PARAMETER_VALUE error"); 104 psFree(tmpErr); 105 psErrorClear(); 106 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 107 } 108 109 110 // Test with acceptable config file name, with a simple path 111 { 112 pmConfigDone(); 113 psMemId id = psMemGetId(); 114 psMetadata *config = NULL; 115 bool rc = pmConfigFileRead(&config, "SampleIPPConfig2", "DESCRIPTION"); 116 ok(rc == false, "pmConfigFileRead() returned FALSE before calling pmConfigSet()"); 117 pmConfigSet("data/path2"); 118 rc = pmConfigFileRead(&config, "SampleIPPConfig2", "DESCRIPTION"); 119 ok(rc == true, "pmConfigFileRead() returned TRUE after calling pmConfigSet() (test 1)"); 120 psFree(config); 121 pmConfigDone(); 122 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 123 } 124 125 126 // Test with acceptable config file name, with a compound path 127 { 128 pmConfigDone(); 129 psMemId id = psMemGetId(); 130 psMetadata *config = NULL; 131 bool rc = pmConfigFileRead(&config, "SampleIPPConfig2", "DESCRIPTION"); 132 ok(rc == false, "pmConfigFileRead() returned FALSE before calling pmConfigSet()"); 133 pmConfigSet("junk:data/path2:data/path5"); 134 rc = pmConfigFileRead(&config, "SampleIPPConfig2", "DESCRIPTION"); 135 ok(rc == true, "pmConfigFileRead() returned TRUE after calling pmConfigSet() (test 2)"); 136 psFree(config); 137 pmConfigDone(); 138 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 139 } 140 141 142 143 // -------------------------------------------------------------------- 144 // -------------------------------------------------------------------- 145 // Test pmConfigDone(): ensure it frees memory allocated by pmConfigSet(); 146 // This also ensures that pmConfigSet() psFrees memory between calls 147 { 148 psMemId id = psMemGetId(); 149 pmConfigSet("junk01"); 150 pmConfigSet("junk:data/path2:data/path5"); 151 pmConfigSet("junk02"); 152 pmConfigDone(); 153 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks: pmConfigDone()"); 154 } 155 156 157 158 // -------------------------------------------------------------------- 159 // -------------------------------------------------------------------- 160 // Test pmConfigFileRead() 161 // Test with NULL config pointer 162 // XXX: There's a memory leak if the first argument points to data that's 163 // already allocated (pmConfigFileRead() frees the first argument) 164 { 165 psMemId id = psMemGetId(); 166 psString name = "foo1"; 167 psString desc = "foo2"; 168 bool rc = pmConfigFileRead(NULL, name, desc); 169 ok(rc == false, "pmConfigFileRead() returned FALSE with NULL config pointer"); 170 psErr *tmpErr = psErrorLast(); 171 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 172 "pmConfigFileRead() created the PS_ERR_BAD_PARAMETER_NULL error"); 173 psFree(tmpErr); 174 psErrorClear(); 175 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 176 } 177 178 179 // Test with NULL name pointer 180 // XXX: Test with empty name string? 181 { 182 psMemId id = psMemGetId(); 183 psMetadata *config = psMetadataAlloc(); 184 psString desc = "foo2"; 185 bool rc = pmConfigFileRead(&config, NULL, desc); 186 ok(rc == false, "pmConfigFileRead() returned FALSE with NULL name pointer"); 187 psErr *tmpErr = psErrorLast(); 188 ok(PS_ERR_BAD_PARAMETER_VALUE == tmpErr->code, 189 "pmConfigFileRead() created the PS_ERR_BAD_PARAMETER_VALUE error"); 190 psFree(tmpErr); 191 psErrorClear(); 192 psFree(config); 193 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 194 } 195 196 197 // Test with NULL desc pointer 198 // XXX: Test with empty desc string and otherwise acceptable inputs. 199 // That generated errors elsewhere. 200 { 201 psMemId id = psMemGetId(); 202 psMetadata *config = psMetadataAlloc(); 203 psString name = "foo1"; 204 bool rc = pmConfigFileRead(&config, name, NULL); 205 ok(rc == false, "pmConfigFileRead() returned FALSE with NULL desc pointer"); 206 psErr *tmpErr = psErrorLast(); 207 ok(PS_ERR_BAD_PARAMETER_VALUE == tmpErr->code, 208 "pmConfigFileRead() created the PS_ERR_BAD_PARAMETER_VALUE error"); 209 psFree(tmpErr); 210 psErrorClear(); 211 psFree(config); 212 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 213 } 214 215 216 // Test with acceptable config file name, no paths 217 // This generates an error because config is non-NULL and pmConfigFileRead() 218 // psFrees it. Create a bugzilla report. 219 { 220 psMemId id = psMemGetId(); 221 psMetadata *config = psMetadataAlloc(); 222 psString name = "data/SampleIPPConfig"; 223 psString desc = "DESCRIPTION"; 224 bool rc = pmConfigFileRead(&config, name, desc); 225 ok(rc == true, "pmConfigFileRead() returned TRUE with acceptable inputs"); 226 227 // Test the several arbitrary config file strings. 228 psS32 tmpInt = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_S32"); 229 ok(rc == true && tmpInt == 20, "pmConfigFileRead() properly set metadata (S32)"); 230 psF32 tmpFloat = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_F32"); 231 ok(rc == true && tmpFloat == 21.0, "pmConfigFileRead() properly set metadata (F32)"); 232 psF64 tmpDub = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_F64"); 233 ok(rc == true && tmpDub == 22.0, "pmConfigFileRead() properly set metadata (F64)"); 234 psBool tmpBool = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_BOOL_T"); 235 ok(rc == true && tmpBool == true, "pmConfigFileRead() properly set metadata (bool)"); 236 tmpBool = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_BOOL_F"); 237 ok(rc == true && tmpBool == false, "pmConfigFileRead() properly set metadata (bool)"); 238 psFree(config); 239 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 240 } 241 242 243 // Test with acceptable config file name, no paths 244 { 245 psMemId id = psMemGetId(); 246 psMetadata *config = NULL; 247 psString name = "data/SampleIPPConfig"; 248 psString desc = "DESCRIPTION"; 249 bool rc = pmConfigFileRead(&config, name, desc); 250 ok(rc == true, "pmConfigFileRead() returned TRUE with acceptable inputs"); 251 252 // Test the several arbitrary config file strings. 253 psS32 tmpInt = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_S32"); 254 ok(rc == true && tmpInt == 20, "pmConfigFileRead() properly set metadata (S32)"); 255 psF32 tmpFloat = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_F32"); 256 ok(rc == true && tmpFloat == 21.0, "pmConfigFileRead() properly set metadata (F32)"); 257 psF64 tmpDub = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_F64"); 258 ok(rc == true && tmpDub == 22.0, "pmConfigFileRead() properly set metadata (F64)"); 259 psBool tmpBool = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_BOOL_T"); 260 ok(rc == true && tmpBool == true, "pmConfigFileRead() properly set metadata (bool)"); 261 tmpBool = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_BOOL_F"); 262 ok(rc == true && tmpBool == false, "pmConfigFileRead() properly set metadata (bool)"); 263 psFree(config); 264 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 265 } 266 267 // Test with acceptable config file name, no paths 268 { 269 psMemId id = psMemGetId(); 270 psMetadata *config = NULL; 271 psString name = "data/SampleIPPConfig"; 272 psString desc = "DESCRIPTION"; 273 bool rc = pmConfigFileRead(&config, name, desc); 274 ok(rc == true, "pmConfigFileRead() returned TRUE with acceptable inputs"); 275 276 // Test the several arbitrary config file strings. 277 psS32 tmpInt = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_S32"); 278 ok(rc == true && tmpInt == 20, "pmConfigFileRead() properly set metadata (S32)"); 279 psF32 tmpFloat = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_F32"); 280 ok(rc == true && tmpFloat == 21.0, "pmConfigFileRead() properly set metadata (F32)"); 281 psF64 tmpDub = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_F64"); 282 ok(rc == true && tmpDub == 22.0, "pmConfigFileRead() properly set metadata (F64)"); 283 psBool tmpBool = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_BOOL_T"); 284 ok(rc == true && tmpBool == true, "pmConfigFileRead() properly set metadata (bool)"); 285 tmpBool = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_BOOL_F"); 286 ok(rc == true && tmpBool == false, "pmConfigFileRead() properly set metadata (bool)"); 287 psFree(config); 288 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 289 } 290 291 // Test with acceptable config file name, with path 292 // Note: This also tests the pmConfigSet() function. 293 { 294 psMemId id = psMemGetId(); 295 psMetadata *config = NULL; 296 psString name = "SampleIPPConfig2"; 297 psString desc = "DESCRIPTION"; 298 pmConfigSet("data/path2"); 299 bool rc = pmConfigFileRead(&config, name, desc); 300 ok(rc == true, "pmConfigFileRead() returned TRUE using paths"); 301 // Test the several arbitrary config file strings. 302 psS32 tmpInt = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_S32"); 303 ok(rc == true && tmpInt == 20, "pmConfigFileRead() properly set metadata (S32)"); 304 psF32 tmpFloat = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_F32"); 305 ok(rc == true && tmpFloat == 21.0, "pmConfigFileRead() properly set metadata (F32)"); 306 psF64 tmpDub = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_F64"); 307 ok(rc == true && tmpDub == 22.0, "pmConfigFileRead() properly set metadata (F64)"); 308 psBool tmpBool = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_BOOL_T"); 309 ok(rc == true && tmpBool == true, "pmConfigFileRead() properly set metadata (bool)"); 310 tmpBool = psMetadataLookupS32(&rc, config, "ARBITRARY_STRING_BOOL_F"); 311 ok(rc == true && tmpBool == false, "pmConfigFileRead() properly set metadata (bool)"); 312 psFree(config); 313 pmConfigDone(); 314 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 315 } 316 317 318 319 // -------------------------------------------------------------------- 320 // -------------------------------------------------------------------- 321 // Test pmConfigValidateCameraFormat() 322 // Test with NULL valid pointer 323 // XXX: This is commented out because of a seg-fault 324 if (0) { 325 psMemId id = psMemGetId(); 326 psMetadata *cameraFormat = psMetadataAlloc(); 327 psMetadata *header = psMetadataAlloc(); 328 bool rc = pmConfigValidateCameraFormat(NULL, cameraFormat, header); 329 ok(rc == false, "pmConfigValidateCameraFormat() returned FALSE with NULL valid pointer"); 330 psErr *tmpErr = psErrorLast(); 331 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 332 "pmConfigValidateCameraFormat() created the PS_ERR_BAD_PARAMETER_NULL error"); 333 psFree(tmpErr); 334 psErrorClear(); 335 psFree(cameraFormat); 336 psFree(header); 337 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 338 } 339 340 341 // Test with NULL cameraFormat pointer 342 { 343 psMemId id = psMemGetId(); 344 bool valid; 345 psMetadata *cameraFormat = psMetadataAlloc(); 346 psMetadata *header = psMetadataAlloc(); 347 bool rc = pmConfigValidateCameraFormat(&valid, NULL, header); 348 ok(rc == false, "pmConfigValidateCameraFormat() returned FALSE with NULL valid pointer"); 349 psErr *tmpErr = psErrorLast(); 350 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 351 "pmConfigValidateCameraFormat() created the PS_ERR_BAD_PARAMETER_NULL error"); 352 psFree(tmpErr); 353 psErrorClear(); 354 psFree(cameraFormat); 355 psFree(header); 356 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 357 } 358 359 360 // Test with NULL header pointer 361 { 362 psMemId id = psMemGetId(); 363 bool valid; 364 psMetadata *cameraFormat = psMetadataAlloc(); 365 psMetadata *header = psMetadataAlloc(); 366 bool rc = pmConfigValidateCameraFormat(&valid, cameraFormat, NULL); 367 ok(rc == false, "pmConfigValidateCameraFormat() returned FALSE with NULL valid pointer"); 368 psErr *tmpErr = psErrorLast(); 369 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 370 "pmConfigValidateCameraFormat() created the PS_ERR_BAD_PARAMETER_NULL error"); 371 psFree(tmpErr); 372 psErrorClear(); 373 psFree(cameraFormat); 374 psFree(header); 375 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 376 } 377 378 // Test with acceptable input 379 // psTraceSetLevel("psModules.config", 10); 380 { 381 psMemId id = psMemGetId(); 382 bool valid; 383 psMetadata *header = psMetadataAlloc(); 384 psMetadata *camera = psMetadataAlloc(); 385 // Test with unitialized camera metadata 386 bool rc = pmConfigValidateCameraFormat(&valid, camera, header); 387 ok(rc == false && valid == false, "pmConfigValidateCameraFormat() returned FALSE with uninitialized psMetadata"); 388 psErr *tmpErr = psErrorLast(); 389 ok(PS_ERR_UNKNOWN == tmpErr->code, 390 "pmConfigValidateCameraFormat() created the PS_ERR_UNKNOWN error"); 391 psFree(tmpErr); 392 psErrorClear(); 393 psFree(camera); 394 psFree(header); 395 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 396 } 397 398 // Test with acceptable input 399 // psTraceSetLevel("psModules.config", 10); 400 // Add a test that sets the metadata value incorrectly 401 { 402 psMemId id = psMemGetId(); 403 bool valid; 404 psMetadata *header = psMetadataAlloc(); 405 psMetadata *camera = NULL; 406 bool rc = pmConfigFileRead(&camera, "data/camera0/format0.config", "Camera 0 Config File"); 407 ok(rc == true, "pmConfigFileRead() read data/camera0/format0.config"); 408 psMetadataAddStr(header, PS_LIST_TAIL, "F0_KEY0", 0, "", "string20"); 409 rc = pmConfigValidateCameraFormat(&valid, camera, header); 410 ok(rc == true, "pmConfigValidateCameraFormat() returned FALSE with acceptable input, wrong values"); 411 ok(valid == false, "pmConfigValidateCameraFormat() rejected header correctly"); 412 psMetadataAddStr(header, PS_LIST_TAIL, "F0_KEY1", 0, "", "string21"); 413 rc = pmConfigValidateCameraFormat(&valid, camera, header); 414 ok(rc == true, "pmConfigValidateCameraFormat() returned FALSE with acceptable input, wrong values"); 415 ok(valid == false, "pmConfigValidateCameraFormat() rejected header correctly"); 416 psMetadataAddS32(header, PS_LIST_TAIL, "F0_KEY2", 0, "", 20); 417 rc = pmConfigValidateCameraFormat(&valid, camera, header); 418 ok(rc == true, "pmConfigValidateCameraFormat() returned TRUE with acceptable input, correct values"); 419 ok(valid == true, "pmConfigValidateCameraFormat() accepted header correctly"); 420 psFree(camera); 421 psFree(header); 422 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 423 } 424 425 426 // -------------------------------------------------------------------- 427 // -------------------------------------------------------------------- 428 // Test pmConfigCameraFormatFromHeader() 429 // 430 // Given a FITS header, check it against all known cameras (unless we 431 // already know which camera, from pmConfigRead) and all known formats 432 // for those cameras in order to identify which is appropriate. 433 // 434 // psMetadata *pmConfigCameraFormatFromHeader( 435 // pmConfig *config, 436 // const psMetadata *header, 437 // bool readRecipes) 438 // Test with NULL config pointer 439 { 440 psMemId id = psMemGetId(); 441 pmConfig *config = pmConfigAlloc(); 442 psMetadata *header = psMetadataAlloc(); 443 bool readRecipes = false; 444 psMetadata *camera = pmConfigCameraFormatFromHeader(NULL, header, readRecipes); 445 ok(camera == NULL, "pmConfigCameraFormatFromHeader() returned NULL with NULL config pointer"); 446 psErr *tmpErr = psErrorLast(); 447 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 448 "pmConfigCameraFormatFromHeader() created the PS_ERR_BAD_PARAMETER_NULL error"); 449 psFree(tmpErr); 450 psErrorClear(); 451 psFree(config); 452 psFree(header); 453 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 454 } 455 456 457 // Test with NULL header pointer 458 { 459 psMemId id = psMemGetId(); 460 pmConfig *config = pmConfigAlloc(); 461 psMetadata *header = psMetadataAlloc(); 462 bool readRecipes = false; 463 psMetadata *camera = pmConfigCameraFormatFromHeader(config, NULL, readRecipes); 464 ok(camera == NULL, "pmConfigCameraFormatFromHeader() returned NULL with NULL header pointer"); 465 psErr *tmpErr = psErrorLast(); 466 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 467 "pmConfigCameraFormatFromHeader() created the PS_ERR_BAD_PARAMETER_NULL error"); 468 psFree(tmpErr); 469 psErrorClear(); 470 psFree(config); 471 psFree(header); 472 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 473 } 474 475 // Test with acceptable inputs 476 if (1) { 477 psMemId id = psMemGetId(); 478 pmConfig *config = pmConfigAlloc(); 479 psMetadata *header = psMetadataAlloc(); 480 bool readRecipes = false; 481 // Load a sample config file 482 bool rc = pmConfigFileRead(&config->site, "data/SampleIPPConfig", "DESCRIPTION"); 483 ok(rc == true && !config, "pmConfigFileRead() was successful"); 484 // Set metadata tags for a simulated FITS header 485 psMetadataAddStr(header, PS_LIST_TAIL, "F0_KEY0", 0, "", "string20"); 486 psMetadataAddStr(header, PS_LIST_TAIL, "F0_KEY1", 0, "", "string21"); 487 psMetadataAddS32(header, PS_LIST_TAIL, "F0_KEY2", 0, "", 20); 488 psMetadata *camera = pmConfigCameraFormatFromHeader(config, header, readRecipes); 489 490 ok(camera != NULL, 491 "pmConfigCameraFormatFromHeader() returned non-NULL with acceptable inputs"); 492 ok(camera != NULL && psMemCheckMetadata(camera), 493 "pmConfigCameraFormatFromHeader() returned non-NULL and correct type with acceptable inputs"); 494 psFree(config); 495 psFree(header); 496 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 497 } 498 499 500 // -------------------------------------------------------------------- 501 // -------------------------------------------------------------------- 502 // Test pmConfigCameraByName() 503 // psMetadata *pmConfigCameraByName(pmConfig *config, const char *cameraName) 504 // Test with NULL config pointer 505 { 506 psMemId id = psMemGetId(); 507 pmConfig *config = pmConfigAlloc(); 508 psString cameraName = "CameraName"; 509 psMetadata *camera = pmConfigCameraByName(NULL, cameraName); 510 ok(camera == NULL, "pmConfigCameraByName() returned NULL with NULL config pointer"); 511 psErr *tmpErr = psErrorLast(); 512 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 513 "pmConfigCameraByName() created the PS_ERR_BAD_PARAMETER_NULL error"); 514 psFree(tmpErr); 515 psErrorClear(); 516 psFree(config); 517 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 518 } 519 520 521 // Test with NULL camera Name 522 { 523 psMemId id = psMemGetId(); 524 pmConfig *config = pmConfigAlloc(); 525 // psString cameraName = "CameraName"; 526 psMetadata *camera = pmConfigCameraByName(config, NULL); 527 ok(camera == NULL, "pmConfigCameraByName() returned NULL with NULL camera name"); 528 psErr *tmpErr = psErrorLast(); 529 ok(PS_ERR_BAD_PARAMETER_VALUE == tmpErr->code, 530 "pmConfigCameraByName() created the PS_ERR_BAD_PARAMETER_VALUE error"); 531 psFree(tmpErr); 532 psErrorClear(); 533 psFree(config); 534 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 535 } 536 537 psTraceSetLevel("err", 10); 538 // Test with acceptable data 539 if (1) { 540 psMemId id = psMemGetId(); 541 pmConfigSet("data"); 542 pmConfig *config = pmConfigAlloc(); 543 bool rc = pmConfigFileRead(&config->site, "data/SampleIPPConfig", "DESCRIPTION"); 544 ok(rc == true, "pmConfigFileRead() was successful"); 545 psString cameraName = "CAMERA0"; 546 psMetadata *camera = pmConfigCameraByName(config, cameraName); 547 ok(camera != NULL && psMemCheckMetadata(camera), 548 "pmConfigCameraByName() returned non-NULL with acceptable"); 549 char *tmpStr = psMetadataLookupStr(&rc, camera, "ID"); 550 ok(tmpStr != NULL && !strcmp(tmpStr, "CAMERA0"), "pmConfigCameraByName() returned non-NULL(CAMERA0)"); 551 pmConfigDone(); 552 psFree(config); 553 psFree(tmpStr); 554 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 555 } 556 557 // -------------------------------------------------------------------- 558 // -------------------------------------------------------------------- 559 // Test pmConfigDB() 560 // psDB *pmConfigDB(pmConfig *config) 561 // Test with NULL config pointer 562 { 563 psMemId id = psMemGetId(); 564 pmConfig *config = pmConfigAlloc(); 565 psDB *db = pmConfigDB(NULL); 566 ok(db == NULL, "pmConfigDB() returned NULL with NULL config pointer"); 567 psErr *tmpErr = psErrorLast(); 568 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 569 "pmConfigDB()() created the PS_ERR_BAD_PARAMETER_NULL error"); 570 psFree(tmpErr); 571 psErrorClear(); 572 psFree(config); 573 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 574 } 575 576 577 // Test with NULL config->site pointer 578 { 579 psMemId id = psMemGetId(); 580 pmConfig *config = pmConfigAlloc(); 581 config->site = NULL; 582 psDB *db = pmConfigDB(config); 583 ok(db == NULL, "pmConfigDB() returned NULL with NULL config->site pointer"); 584 psErr *tmpErr = psErrorLast(); 585 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 586 "pmConfigDB()() created the PS_ERR_BAD_PARAMETER_NULL error"); 587 psFree(tmpErr); 588 psErrorClear(); 589 psFree(config); 590 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 591 } 592 593 // Test with acceptable data 594 // XXX: Not tested. 595 if (1) { 596 psMemId id = psMemGetId(); 597 pmConfig *config = pmConfigAlloc(); 598 config->site = psMetadataAlloc(); 599 bool rc = pmConfigFileRead(&config->site, "data/SampleIPPConfig", "DESCRIPTION"); 600 ok(rc == true, "pmConfigFileRead() was successful"); 601 skip_start(rc == false, 1, "Skipping pmConfigDB() tests because we could not read config file"); 602 psDB *db = pmConfigDB(config); 603 ok(db != NULL, "pmConfigDB() returned non NULL with acceptable data"); 604 psFree(db); 605 skip_end(); 606 psFree(config); 607 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 608 } 609 610 // -------------------------------------------------------------------- 611 // -------------------------------------------------------------------- 612 // Test pmConfigConformHeader() 613 // Test with NULL header pointer 614 { 615 psMemId id = psMemGetId(); 616 psMetadata *header = psMetadataAlloc(); 617 psMetadata *format = psMetadataAlloc(); 618 bool rc = pmConfigConformHeader(NULL, (const psMetadata *) format); 619 ok(rc == false, "pmConfigConformHeader() returned FALSE with NULL header pointer"); 620 psErr *tmpErr = psErrorLast(); 621 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 622 "pmConfigConformHeader() created the PS_ERR_BAD_PARAMETER_NULL error"); 623 psFree(tmpErr); 624 psErrorClear(); 625 psFree(header); 626 psFree(format); 627 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 628 } 629 630 631 // Test with NULL format pointer 632 { 633 psMemId id = psMemGetId(); 634 psMetadata *header = psMetadataAlloc(); 635 psMetadata *format = psMetadataAlloc(); 636 bool rc = pmConfigConformHeader(header, NULL); 637 ok(rc == false, "pmConfigConformHeader() returned FALSE with NULL header pointer"); 638 psErr *tmpErr = psErrorLast(); 639 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 640 "pmConfigConformHeader() created the PS_ERR_BAD_PARAMETER_NULL error"); 641 psFree(tmpErr); 642 psErrorClear(); 643 psFree(header); 644 psFree(format); 645 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 646 } 647 648 // Test with acceptable data 649 { 650 psMemId id = psMemGetId(); 651 bool valid; 652 psMetadata *header = psMetadataAlloc(); 653 psMetadata *format = psMetadataAlloc(); 654 bool rc = pmConfigFileRead(&format, "data/camera0/format0.config", "Camera 0 Config File"); 655 ok(rc == true, "pmConfigFileRead() read camera format correctly"); 656 657 // First ensure that the header is not accepted 658 rc = pmConfigValidateCameraFormat(&valid, format, header); 659 ok(rc == true && valid == false, "pmConfigValidateCameraFormat() rejected header with uninitialized psMetadata"); 660 661 // Now call pmConfigConformHeader() and ensure that the header is accepted 662 rc = pmConfigConformHeader(header, format); 663 ok(rc == true, "pmConfigConformHeader() returned TRUE"); 664 rc = pmConfigValidateCameraFormat(&valid, format, header); 665 ok(rc == true, "pmConfigValidateCameraFormat() returned TRUE"); 666 ok(valid == true, "pmConfigValidateCameraFormat() validated camera format"); 667 psFree(header); 668 psFree(format); 669 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 670 } 671 672 673 // -------------------------------------------------------------------- 674 // -------------------------------------------------------------------- 675 // Test pmConfigFileSets() 676 // test with NULL argc pointer 677 { 678 psMemId id = psMemGetId(); 679 char *str[3]; 680 str[0] = "ARGS:"; 681 str[1] = "-site"; 682 str[2] = "data/SampleIPPConfig"; 683 char *filename = "FILENAME"; 684 char *list = "LIST"; 685 psArray *array = pmConfigFileSets(NULL, str, filename, list); 686 ok(array == NULL, "pmConfigFileSets() returned NULL with NULL argc pointer"); 687 psErr *tmpErr = psErrorLast(); 688 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 689 "pmConfigFileSets() created the PS_ERR_BAD_PARAMETER_NULL error"); 690 psFree(tmpErr); 691 psErrorClear(); 692 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 693 } 694 695 696 // test with negative argc pointer 697 { 698 psMemId id = psMemGetId(); 699 char *str[3]; 700 str[0] = "ARGS:"; 701 str[1] = "-site"; 702 str[2] = "data/SampleIPPConfig"; 703 int myArgc = -1; 704 char *filename = "FILENAME"; 705 char *list = "LIST"; 706 psArray *array = pmConfigFileSets(&myArgc, str, filename, list); 707 ok(array == NULL, "pmConfigFileSets() returned NULL with negative argc pointer"); 708 psErr *tmpErr = psErrorLast(); 709 ok(PS_ERR_BAD_PARAMETER_VALUE == tmpErr->code, 710 "pmConfigFileSets() created the PS_ERR_BAD_PARAMETER_VALUE error"); 711 psFree(tmpErr); 712 psErrorClear(); 713 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 714 } 715 716 717 // test with NULL argv pointer 718 { 719 psMemId id = psMemGetId(); 720 char *str[3]; 721 str[0] = "ARGS:"; 722 str[1] = "-site"; 723 str[2] = "data/SampleIPPConfig"; 724 int myArgc = 3; 725 char *filename = "FILENAME"; 726 char *list = "LIST"; 727 psArray *array = pmConfigFileSets(&myArgc, NULL, filename, list); 728 ok(array == NULL, "pmConfigFileSets() returned NULL with NULL argv pointer"); 729 psErr *tmpErr = psErrorLast(); 730 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 731 "pmConfigFileSets() created the PS_ERR_BAD_PARAMETER_NULL error"); 732 psFree(tmpErr); 733 psErrorClear(); 734 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 735 } 736 737 738 // test with NULL filename pointer 739 { 740 psMemId id = psMemGetId(); 741 char *str[3]; 742 str[0] = "ARGS:"; 743 str[1] = "-site"; 744 str[2] = "data/SampleIPPConfig"; 745 int myArgc = 3; 746 char *list = "LIST"; 747 psArray *array = pmConfigFileSets(&myArgc, str, NULL, list); 748 ok(array == NULL, "pmConfigFileSets() returned NULL with NULL filename pointer"); 749 psErr *tmpErr = psErrorLast(); 750 ok(PS_ERR_BAD_PARAMETER_VALUE == tmpErr->code, 751 "pmConfigFileSets() created the PS_ERR_BAD_PARAMETER_VALUE error"); 752 psFree(tmpErr); 753 psErrorClear(); 754 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 755 } 756 757 758 // test with NULL list pointer 759 { 760 psMemId id = psMemGetId(); 761 char *str[3]; 762 str[0] = "ARGS:"; 763 str[1] = "-site"; 764 str[2] = "data/SampleIPPConfig"; 765 int myArgc = 3; 766 char *filename = "FILENAME"; 767 psArray *array = pmConfigFileSets(&myArgc, str, filename, NULL); 768 ok(array == NULL, "pmConfigFileSets() returned NULL with NULL list pointer"); 769 psErr *tmpErr = psErrorLast(); 770 ok(PS_ERR_BAD_PARAMETER_VALUE == tmpErr->code, 771 "pmConfigFileSets() created the PS_ERR_BAD_PARAMETER_VALUE error"); 772 psFree(tmpErr); 773 psErrorClear(); 774 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 775 } 776 777 778 // test with acceptable data 779 if (0) { 780 psMemId id = psMemGetId(); 781 char *str[3]; 782 str[0] = "ARGS:"; 783 str[1] = "-site"; 784 str[2] = "data/SampleIPPConfig"; 785 int myArgc = 3; 786 char *filename = "FILENAME"; 787 char *list = "LIST"; 788 psArray *array = pmConfigFileSets(&myArgc, str, filename, list); 789 ok(array != NULL && psMemCheckArray(array), 790 "pmConfigFileSets() returned non-NULL with acceptable input data"); 791 psErrorClear(); 792 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 793 } 794 795 // -------------------------------------------------------------------- 796 // -------------------------------------------------------------------- 797 // Test pmConfigFileSetsMD() 798 // bool pmConfigFileSetsMD(psMetadata *metadata, int *argc, char **argv, const char *name, 799 // const char *file, const char *list) 800 // XX: Should we test/check for bad argv/argc params? 801 // test with NULL metadata pointer 802 { 803 psMemId id = psMemGetId(); 804 psMetadata *metadata = psMetadataAlloc(); 805 char *str[3]; 806 str[0] = "ARGS:"; 807 str[1] = "-site"; 808 str[2] = "data/SampleIPPConfig"; 809 int myArgc = 3; 810 char *name = "NAME"; 811 char *file = "FILENAME"; 812 char *list = "LIST"; 813 bool rc = pmConfigFileSetsMD(NULL, &myArgc, str, name, file, list); 814 ok(rc == false, "pmConfigFileSetsMD() returned FALSE with NULL metadata pointer"); 815 psErr *tmpErr = psErrorLast(); 816 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 817 "pmConfigFileSetsMD() created the PS_ERR_BAD_PARAMETER_NULL error"); 818 psFree(tmpErr); 819 psFree(metadata); 820 psErrorClear(); 821 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 822 } 823 824 825 // test with NULL name pointer 826 { 827 psMemId id = psMemGetId(); 828 psMetadata *metadata = psMetadataAlloc(); 829 char *str[3]; 830 str[0] = "ARGS:"; 831 str[1] = "-site"; 832 str[2] = "data/SampleIPPConfig"; 833 int myArgc = 3; 834 char *file = "FILENAME"; 835 char *list = "LIST"; 836 bool rc = pmConfigFileSetsMD(metadata, &myArgc, str, NULL, file, list); 837 ok(rc == false, "pmConfigFileSetsMD() returned FALSE with NULL name pointer"); 838 psErr *tmpErr = psErrorLast(); 839 ok(PS_ERR_BAD_PARAMETER_VALUE == tmpErr->code, 840 "pmConfigFileSetsMD() created the PS_ERR_BAD_PARAMETER_VALUE error"); 841 psFree(tmpErr); 842 psFree(metadata); 843 psErrorClear(); 844 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 845 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 846 } 847 848 849 // test with NULL file pointer 850 { 851 psMemId id = psMemGetId(); 852 psMetadata *metadata = psMetadataAlloc(); 853 char *str[3]; 854 str[0] = "ARGS:"; 855 str[1] = "-site"; 856 str[2] = "data/SampleIPPConfig"; 857 int myArgc = 3; 858 char *name = "NAME"; 859 char *list = "LIST"; 860 bool rc = pmConfigFileSetsMD(metadata, &myArgc, str, name, NULL, list); 861 ok(rc == false, "pmConfigFileSetsMD() returned FALSE with NULL file pointer"); 862 psErr *tmpErr = psErrorLast(); 863 ok(PS_ERR_BAD_PARAMETER_VALUE == tmpErr->code, 864 "pmConfigFileSetsMD() created the PS_ERR_BAD_PARAMETER_VALUE error"); 865 psFree(tmpErr); 866 psFree(metadata); 867 psErrorClear(); 868 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 869 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 870 } 871 872 873 // test with NULL list pointer 874 { 875 psMemId id = psMemGetId(); 876 psMetadata *metadata = psMetadataAlloc(); 877 char *str[3]; 878 str[0] = "ARGS:"; 879 str[1] = "-site"; 880 str[2] = "data/SampleIPPConfig"; 881 int myArgc = 3; 882 char *name = "NAME"; 883 char *file = "FILENAME"; 884 bool rc = pmConfigFileSetsMD(metadata, &myArgc, str, name, file, NULL); 885 ok(rc == false, "pmConfigFileSetsMD() returned FALSE with NULL list pointer"); 886 psErr *tmpErr = psErrorLast(); 887 ok(PS_ERR_BAD_PARAMETER_VALUE == tmpErr->code, 888 "pmConfigFileSetsMD() created the PS_ERR_BAD_PARAMETER_VALUE error"); 889 psFree(tmpErr); 890 psFree(metadata); 891 psErrorClear(); 892 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 893 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 894 } 895 896 897 // test with acceptable input data 898 if (0) { 899 psMemId id = psMemGetId(); 900 psMetadata *metadata = psMetadataAlloc(); 901 char *str[3]; 902 str[0] = "ARGS:"; 903 str[1] = "-site"; 904 str[2] = "data/SampleIPPConfig"; 905 int myArgc = 3; 906 char *name = "NAME"; 907 char *file = "FILENAME"; 908 char *list = "LIST"; 909 bool rc = pmConfigFileSetsMD(metadata, &myArgc, str, name, file, list); 910 ok(rc == true, "pmConfigFileSetsMD() returned TRUE with acceptable input data"); 911 psFree(metadata); 912 psErrorClear(); 913 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 914 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 915 } 916 917 918 // -------------------------------------------------------------------- 919 // -------------------------------------------------------------------- 920 // Test pmConfigConvertFilename() 921 // convert the supplied name, create a new output psString 922 // psString pmConfigConvertFilename(const char *filename, const pmConfig *config, 923 // bool create) 924 // test with NULL filename pointer 925 { 926 psMemId id = psMemGetId(); 927 pmConfig *config = pmConfigAlloc(); 928 bool create = false; 929 bool rc = pmConfigConvertFilename(NULL, (const pmConfig *) config, create); 930 ok(rc == false, "pmConfigConvertFilename() returned FALSE with NULL filename pointer"); 931 psErr *tmpErr = psErrorLast(); 932 ok(PS_ERR_BAD_PARAMETER_VALUE == tmpErr->code, 933 "pmConfigConvertFilename() created the PS_ERR_BAD_PARAMETER_VALUE error"); 934 psFree(tmpErr); 935 psErrorClear(); 936 psFree(config); 937 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 938 } 939 940 941 // test with NULL config pointer 942 { 943 psMemId id = psMemGetId(); 944 char *name = "NAME"; 945 pmConfig *config = pmConfigAlloc(); 946 bool create = false; 947 bool rc = pmConfigConvertFilename(name, NULL, create); 948 ok(rc == false, "pmConfigConvertFilename() returned FALSE with NULL config pointer"); 949 psErr *tmpErr = psErrorLast(); 950 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 951 "pmConfigConvertFilename() created the PS_ERR_BAD_PARAMETER_NULL error"); 952 psFree(tmpErr); 953 psErrorClear(); 954 psFree(config); 955 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 956 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 957 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 958 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 959 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 960 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 961 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 962 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 963 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 964 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 965 } 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 // test with acceptable input data 983 // First call with create==FALSE, and a filename that does not exist. 984 // Should return NULL. Then set create==TRUE, and call; should return 985 // "JUNK". Then call again with create==FALSE; should return "JUNK" 986 if (1) { 987 psMemId id = psMemGetId(); 988 char *filename = "file:///////JUNK"; 989 pmConfig *config = pmConfigAlloc(); 990 bool rc = pmConfigFileRead(&config->site, "data/SampleIPPConfig", "DESCRIPTION"); 991 ok(rc == true, "pmConfigFileRead() was successful"); 992 bool create = false; 993 psString tmpStr = pmConfigConvertFilename(filename, (const pmConfig *) config, create); 994 ok(NULL == tmpStr, "pmConfigConvertFilename() returned NULL with create==FALSE"); 995 create = true; 996 tmpStr = pmConfigConvertFilename(filename, (const pmConfig *) config, create); 997 ok(tmpStr != NULL, "pmConfigConvertFilename() returned non-NULL with create==TRUE"); 998 ok(!strcmp(tmpStr, "/JUNK"), "pmConfigConvertFilename() returned correct filename (%s)", tmpStr); 999 psFree(tmpStr); 1000 psFree(config); 1001 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 1002 } 1003 // -------------------------------------------------------------------- 1004 // -------------------------------------------------------------------- 1005 // Test pmConfigRead() 1006 // Test with NULL argc pointer 66 1007 { 67 1008 psMemId id = psMemGetId(); … … 72 1013 pmConfig *myConfig = pmConfigRead(NULL, str, "RecipeName"); 73 1014 ok(myConfig == NULL, "pmConfigRead() returned NULL with NULL argc pointer"); 1015 psErr *tmpErr = psErrorLast(); 1016 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 1017 "pmConfigValidateCameraFormat() created the PS_ERR_BAD_PARAMETER_NULL error"); 1018 psFree(tmpErr); 1019 psErrorClear(); 74 1020 psFree(myConfig); 75 1021 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 76 1022 } 77 1023 78 // Verify error with NULL argv pointer 1024 1025 // Test with NULL argv pointer 79 1026 { 80 1027 psMemId id = psMemGetId(); 81 1028 pmConfig *myConfig = pmConfigRead(&argc, NULL, "RecipeName"); 82 1029 ok(myConfig == NULL, "pmConfigRead() returned NULL with NULL argv pointer"); 1030 psErr *tmpErr = psErrorLast(); 1031 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 1032 "pmConfigValidateCameraFormat() created the PS_ERR_BAD_PARAMETER_NULL error"); 1033 psFree(tmpErr); 1034 psErrorClear(); 83 1035 psFree(myConfig); 84 1036 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 85 1037 } 86 1038 87 // Verify non-error with NULL recipe string 88 { 89 psMemId id = psMemGetId(); 90 psString str[3]; 91 str[0] = "ARGS:"; 92 str[1] = "-site"; 93 str[2] = "data/SampleIPPConfig"; 94 pmConfig *myConfig = pmConfigRead(&argc, str, NULL); 1039 1040 // Test with NULL recipe string (should not cause error) 1041 // XXX: Not working, debug 1042 if (0) { 1043 psMemId id = psMemGetId(); 1044 char *str[3]; 1045 str[0] = "ARGS:"; 1046 str[1] = "-site"; 1047 str[2] = "data/SampleIPPConfig"; 1048 int numArgs = 3; 1049 pmConfig *myConfig = pmConfigRead(&numArgs, str, NULL); 95 1050 ok(myConfig != NULL, "pmConfigRead() returned non-NULL with NULL recipe"); 1051 psErr *tmpErr = psErrorLast(); 1052 ok(PS_ERR_BAD_PARAMETER_NULL == tmpErr->code, 1053 "pmConfigValidateCameraFormat() created the PS_ERR_BAD_PARAMETER_NULL error"); 1054 psFree(tmpErr); 1055 psErrorClear(); 96 1056 psFree(myConfig); 97 1057 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 98 1058 } 99 1059 100 { 1060 1061 // Test pmConfigRead() with acceptable data. 1062 if (1) { 101 1063 psMemId id = psMemGetId(); 102 1064 bool testStatus = true; … … 113 1075 bool rc; 114 1076 pmConfig *myConfig = pmConfigRead(&argc, str, "RecipeName"); 1077 ok(myConfig, "pmConfigRead() returned non-NULL"); 115 1078 if (myConfig == NULL) { 116 1079 printf("TEST ERROR: pmConfigRead() returned NULL\n"); … … 245 1208 ok(!psMemCheckLeaks (id, NULL, NULL, false), "no memory leaks"); 246 1209 } 1210 247 1211 } 248 //HERE 1212
Note:
See TracChangeset
for help on using the changeset viewer.
