Changeset 8425
- Timestamp:
- Aug 18, 2006, 4:35:05 PM (20 years ago)
- Location:
- trunk/psLib/test/types
- Files:
-
- 4 edited
-
tap_psMetadata_copying.c (modified) (1 diff)
-
tap_psMetadata_creating.c (modified) (4 diffs)
-
tap_psMetadata_manip.c (modified) (2 diffs)
-
tap_psMetadata_printing.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/types/tap_psMetadata_copying.c
r8384 r8425 1 /** 2 * C Implementation: tap_psMetadata_copying 3 * 4 * Description: Tests for psMetadataCopy, psMetadataItemCopy, & psMetadataItemTransfer. 5 * 6 * 7 * Author: dRob <David.Robbins@mhpcc.hpc.mil>, (C) 2006 8 * 9 * Copyright: See COPYING file that comes with this distribution 10 * 11 */ 1 12 2 13 #include "pstap.h" -
trunk/psLib/test/types/tap_psMetadata_creating.c
r8414 r8425 2 2 * C Implementation: tap_psMetadata_creating 3 3 * 4 * Description: 4 * Description: Tests for psMetadataAlloc, psMetadataItemAlloc's (TYPEs), 5 * psMemCheckMetadata, psMemCheckMetadataItem, psMetadataAddItem, 6 * psMetadataIteratorAlloc 5 7 * 6 8 * … … 15 17 void testItemAllocs(void); 16 18 void testMDAlloc_AddItem(void); 19 void testIterAlloc(void); 17 20 18 21 int main(void) 19 22 { 20 plan_tests(3 1);23 plan_tests(37); 21 24 22 25 diag("psMetadata & psMetadataItem Creation Functions"); … … 24 27 testItemAllocs(); 25 28 testMDAlloc_AddItem(); 29 testIterAlloc(); 26 30 27 31 done(); … … 366 370 } 367 371 372 void testIterAlloc(void) 373 { 374 diag("\n >>>Test 4: psMetadataIteratorAlloc"); 375 psMetadata *md = psMetadataAlloc(); 376 psMetadata *md2 = NULL; 377 psMetadataAddS32(md, PS_LIST_HEAD, "S32_1", PS_META_NO_REPLACE, "", 1); 378 psMetadataAddS32(md, PS_LIST_TAIL, "S32_2", PS_META_DEFAULT, "", 2); 379 380 psMetadataIterator *iter = NULL; 381 //Return NULL for NULL metadata input 382 { 383 iter = psMetadataIteratorAlloc(md2, PS_LIST_HEAD, NULL); 384 ok( iter == NULL, 385 "psMetadataIteratorAlloc: return NULL for NULL metadata input."); 386 } 387 //Return NULL for metadata with no List 388 md2 = psMetadataAlloc(); 389 psFree(md2->list); 390 md2->list = NULL; 391 { 392 iter = psMetadataIteratorAlloc(md2, PS_LIST_HEAD, NULL); 393 ok( iter == NULL, 394 "psMetadataIteratorAlloc: return NULL for metadata with no list."); 395 } 396 psFree(md2); 397 398 //Return newly allocated MetadataIterator, regex=NULL 399 { 400 iter = psMetadataIteratorAlloc(md, PS_LIST_HEAD, NULL); 401 ok( iter != NULL, 402 "psMetadataIteratorAlloc: return valid iterator for valid inputs, regex=NULL."); 403 } 404 405 406 //Check for Memory leaks 407 { 408 psFree(iter); 409 psFree(md); 410 checkMem(); 411 } 412 } 413 -
trunk/psLib/test/types/tap_psMetadata_manip.c
r8414 r8425 2 2 * C Implementation: tap_psMetadata_manip 3 3 * 4 * Description: 4 * Description: Tests for psMetadataRemove's, psMetadataLookup's (TYPE), 5 5 * 6 6 * … … 13 13 #include "pstap.h" 14 14 15 void testIter(void); 16 15 17 int main(void) 16 18 { 17 19 plan_tests(2); 18 20 19 diag("psMetadataLookup and Remove Fxns"); 21 diag("psMetadataLookup, Remove, and Iterator Fxns"); 22 20 23 21 24 22 25 done(); 23 26 } 27 28 void testIter(void) 29 { 30 diag("\n >>>Test 4: psMetadataIterator Functions"); 31 psMetadata *md = psMetadataAlloc(); 32 psMetadataAddS32(md, PS_LIST_HEAD, "S32_1", PS_META_NO_REPLACE, "", 1); 33 psMetadataAddS32(md, PS_LIST_TAIL, "S32_2", PS_META_NO_REPLACE, "", 2); 34 psMetadataAddS32(md, PS_LIST_TAIL, "S32_3", PS_META_NO_REPLACE, "", 3); 35 36 psMetadataIterator *iter = NULL; 37 38 //Return NULL in psMetadataGetAnd(In/De)crement for NULL iterator input 39 { 40 ok( psMetadataGetAndIncrement(NULL) == NULL, 41 "psMetadataGetAndIncrement: return NULL for NULL iterator input."); 42 ok( psMetadataGetAndDecrement(NULL) == NULL, 43 "psMetadataGetAndDecrement: return NULL for NULL iterator input."); 44 } 45 //Return NULL in psMetadataGetAnd(In/De)crement for iterator with no list iterator 46 psMetadataIterator *iter2 = psMetadataIteratorAlloc(md, PS_LIST_HEAD, NULL); 47 psFree(iter2->iter); 48 iter2->iter = NULL; 49 { 50 ok( psMetadataGetAndIncrement(iter2) == NULL, 51 "psMetadataGetAndIncrement: return NULL for iterator with no list iterator."); 52 ok( psMetadataGetAndDecrement(iter2) == NULL, 53 "psMetadataGetAndDecrement: return NULL for iterator with no list iterator."); 54 } 55 psFree(iter2); 56 57 //Return valid iterator for valid inputs, regex= NULL 58 psMetadataItem *item = NULL; 59 { 60 iter = psMetadataIteratorAlloc(md, PS_LIST_HEAD, NULL); 61 ok( iter != NULL, 62 "psMetadataIteratorAlloc: return valid iterator for valid inputs, regex=NULL."); 63 skip_start(iter == NULL, 4, 64 "Skipping 4 tests because psMetadataIteratorAlloc failed"); 65 66 item = psMetadataGetAndIncrement(iter); 67 ok( item != NULL, 68 "psMetadataGetAndIncrement: return valid item for valid iterator input."); 69 skip_start(item == NULL, 1, 70 "Skipping 1 tests because psMetadataGetAndIncrement failed"); 71 ok(item->type == PS_DATA_S32 72 && !strncmp(item->name, "S32_1", 7) 73 && item->data.S32 == 1 74 && !strncmp(item->comment, "", 2), 75 "psMetadataGetAndIncrement: retrieve correct item from valid iterator."); 76 skip_end(); 77 78 item = psMetadataGetAndDecrement(iter); 79 ok( item != NULL, 80 "psMetadataGetAndDecrement: return valid item for valid iterator input."); 81 skip_start(item == NULL, 1, 82 "Skipping 1 tests because psMetadataGetAndDecrement failed"); 83 ok(item->type == PS_DATA_S32 84 && !strncmp(item->name, "S32_2", 7) 85 && item->data.S32 == 2 86 && !strncmp(item->comment, "", 2), 87 "psMetadataGetAndDecrement: retrieve correct item from valid iterator."); 88 skip_end(); 89 90 skip_end(); 91 92 } 93 94 //Check for Memory leaks 95 { 96 psFree(iter); 97 psFree(md); 98 checkMem(); 99 } 100 } 101 102 -
trunk/psLib/test/types/tap_psMetadata_printing.c
r8414 r8425 1 /** 2 * C Implementation: tap_psMetadata_printing 3 * 4 * Description: Tests for psMetadataPrint and psMetadataItemPrint. 5 * 6 * 7 * Author: dRob <David.Robbins@mhpcc.hpc.mil>, (C) 2006 8 * 9 * Copyright: See COPYING file that comes with this distribution 10 * 11 */ 1 12 2 13 #include <fcntl.h>
Note:
See TracChangeset
for help on using the changeset viewer.
