IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8425


Ignore:
Timestamp:
Aug 18, 2006, 4:35:05 PM (20 years ago)
Author:
drobbin
Message:

Updated tests. Manip still under construction.

Location:
trunk/psLib/test/types
Files:
4 edited

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 */
    112
    213#include "pstap.h"
  • trunk/psLib/test/types/tap_psMetadata_creating.c

    r8414 r8425  
    22*  C Implementation: tap_psMetadata_creating
    33*
    4 * Description:
     4* Description:  Tests for psMetadataAlloc, psMetadataItemAlloc's (TYPEs),
     5*               psMemCheckMetadata, psMemCheckMetadataItem, psMetadataAddItem,
     6*               psMetadataIteratorAlloc
    57*
    68*
     
    1517void testItemAllocs(void);
    1618void testMDAlloc_AddItem(void);
     19void testIterAlloc(void);
    1720
    1821int main(void)
    1922{
    20     plan_tests(31);
     23    plan_tests(37);
    2124
    2225    diag("psMetadata & psMetadataItem Creation Functions");
     
    2427    testItemAllocs();
    2528    testMDAlloc_AddItem();
     29    testIterAlloc();
    2630
    2731    done();
     
    366370}
    367371
     372void 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  
    22 *  C Implementation: tap_psMetadata_manip
    33 *
    4 * Description:
     4 * Description:  Tests for psMetadataRemove's, psMetadataLookup's (TYPE),
    55 *
    66 *
     
    1313#include "pstap.h"
    1414
     15void testIter(void);
     16
    1517int main(void)
    1618{
    1719    plan_tests(2);
    1820
    19     diag("psMetadataLookup and Remove Fxns");
     21    diag("psMetadataLookup, Remove, and Iterator Fxns");
     22
    2023
    2124
    2225    done();
    2326}
     27
     28void 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 */
    112
    213#include <fcntl.h>
Note: See TracChangeset for help on using the changeset viewer.