IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1445


Ignore:
Timestamp:
Aug 9, 2004, 3:39:37 PM (22 years ago)
Author:
harman
Message:

Added tests

Location:
trunk/psLib/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/astronomy/tst_psMetadata_05.c

    r1444 r1445  
    1111*  @author  Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    14 *  @date  $Date: 2004-08-10 01:14:46 $
     13*  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     14*  @date  $Date: 2004-08-10 01:39:37 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959int main( int argc, char* argv[] )
    6060{
     61    long data;
    6162    psMetadataItem *item1 = NULL;
    6263    psMetadataItem *item2 = NULL;
     
    131132        printf("ERROR: Couldn't open file for writing\n");
    132133    }
    133     psMetadataItemPrint(fd, "Item value: %ld", item2);
     134    psMetadataItemPrint(fd, "%ld", item2);
    134135    printFooter(stdout, "psMetadata", "Test F - Write metadata item to file", true);
    135 
    136 
    137     // Test F - Attempt to use null metadata with setIterator
    138     printNegativeTestHeader(stdout,"psMetadata", "Test F - Attempt to use null metadata with setIterator",
     136    fclose(fd);
     137    fd = fopen("./tst_psMetadata05_OUT", "r");
     138    if(fd == NULL) {
     139        printf("ERROR: Couldn't open file for reading\n");
     140    }
     141    fscanf(fd, "%ld", &data);
     142    fclose(fd);
     143    if(data != 55) {
     144        printf("ERROR: Data in file is not as expected. Value: %ld. Should be: 55.\n", data);
     145    }
     146
     147
     148    // Test G - Attempt to use null metadata with setIterator
     149    printNegativeTestHeader(stdout,"psMetadata", "Test G - Attempt to use null metadata with setIterator",
    139150                            "Null metadata collection not allowed", 0);
    140151    psMetadataSetIterator(NULL, 0);
    141     printFooter(stdout, "psMetadata", "Test F - Attempt to use null metadata with setIterator", true);
    142 
    143 
    144     // Test G - Attempt to use null metadata with getNext
    145     printNegativeTestHeader(stdout,"psMetadata", "Test G - Attempt to use null metadata with getNext",
     152    printFooter(stdout, "psMetadata", "Test G - Attempt to use null metadata with setIterator", true);
     153
     154
     155    // Test H - Attempt to use null metadata with getNext
     156    printNegativeTestHeader(stdout,"psMetadata", "Test H - Attempt to use null metadata with getNext",
    146157                            "Null metadata collection not allowed", 0);
    147158    psMetadataGetNext(NULL, "myItem2", 0);
    148     printFooter(stdout, "psMetadata", "Test G - Attempt to use null metadata with getNext", true);
    149 
    150 
    151     // Test H - Attempt to use null metadata with getPrevious
    152     printNegativeTestHeader(stdout,"psMetadata", "Test H - Attempt to use null metadata with getPrevious",
     159    printFooter(stdout, "psMetadata", "Test H - Attempt to use null metadata with getNext", true);
     160
     161
     162    // Test I - Attempt to use null metadata with getPrevious
     163    printNegativeTestHeader(stdout,"psMetadata", "Test I - Attempt to use null metadata with getPrevious",
    153164                            "Null metadata collection not allowed", 0);
    154165    psMetadataGetPrevious(NULL, "myItem2", 0);
    155     printFooter(stdout, "psMetadata", "Test H - Attempt to use null metadata with getPrevious", true);
    156 
    157 
    158     // Test I - Attempt to use null file with itemPrint
    159     printNegativeTestHeader(stdout,"psMetadata", "Test I - Attempt to use null file with itemPrint",
     166    printFooter(stdout, "psMetadata", "Test I - Attempt to use null metadata with getPrevious", true);
     167
     168
     169    // Test J - Attempt to use null file with itemPrint
     170    printNegativeTestHeader(stdout,"psMetadata", "Test J - Attempt to use null file with itemPrint",
    160171                            "Null file descriptor not allowed", 0);
    161172    psMetadataItemPrint(NULL, "Item value: %ld", item2);
    162     printFooter(stdout, "psMetadata", "Test I - Attempt to use null file with itemPrint", true);
    163 
    164 
    165     // Test J - Attempt to use null format with itemPrint
    166     printNegativeTestHeader(stdout,"psMetadata", "Test J - Attempt to use null format with itemPrint",
     173    printFooter(stdout, "psMetadata", "Test J - Attempt to use null file with itemPrint", true);
     174
     175
     176    // Test K - Attempt to use null format with itemPrint
     177    printNegativeTestHeader(stdout,"psMetadata", "Test K - Attempt to use null format with itemPrint",
    167178                            "Null format not allowed", 0);
    168179    psMetadataItemPrint(fd, NULL, item2);
    169     printFooter(stdout, "psMetadata", "Test J - Attempt to use null format with itemPrint", true);
    170 
    171 
    172     // Test K - Attempt to use null item with itemPrint
    173     printNegativeTestHeader(stdout,"psMetadata", "Test K - Attempt to use null item with itemPrint",
     180    printFooter(stdout, "psMetadata", "Test K - Attempt to use null format with itemPrint", true);
     181
     182
     183    // Test L - Attempt to use null item with itemPrint
     184    printNegativeTestHeader(stdout,"psMetadata", "Test L - Attempt to use null item with itemPrint",
    174185                            "Null metadata not allowed", 0);
    175186    psMetadataItemPrint(fd, "Item value: %ld", NULL);
    176     printFooter(stdout, "psMetadata", "Test K - Attempt to use null item with itemPrint", true);
    177 
    178 
    179     // Test L - Free psMetadata
    180     printPositiveTestHeader(stdout, "psMetadata", "Test I - Free psMetadata");
     187    printFooter(stdout, "psMetadata", "Test L - Attempt to use null item with itemPrint", true);
     188
     189
     190    // Test M - Free psMetadata
     191    printPositiveTestHeader(stdout, "psMetadata", "Test M - Free psMetadata");
    181192    psFree(metadata);
    182193    psFree(item1);
     
    190201        printf("ERROR: Found %d bad memory blocks\n", nBad);
    191202    }
    192     printFooter(stdout, "psMetadata", "Test L - Free psMetadata", true);
     203    printFooter(stdout, "psMetadata", "Test M - Free psMetadata", true);
    193204
    194205
  • trunk/psLib/test/collections/tst_psMetadata_05.c

    r1444 r1445  
    1111*  @author  Ross Harman, MHPCC
    1212*
    13 *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    14 *  @date  $Date: 2004-08-10 01:14:46 $
     13*  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     14*  @date  $Date: 2004-08-10 01:39:37 $
    1515*
    1616*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5959int main( int argc, char* argv[] )
    6060{
     61    long data;
    6162    psMetadataItem *item1 = NULL;
    6263    psMetadataItem *item2 = NULL;
     
    131132        printf("ERROR: Couldn't open file for writing\n");
    132133    }
    133     psMetadataItemPrint(fd, "Item value: %ld", item2);
     134    psMetadataItemPrint(fd, "%ld", item2);
    134135    printFooter(stdout, "psMetadata", "Test F - Write metadata item to file", true);
    135 
    136 
    137     // Test F - Attempt to use null metadata with setIterator
    138     printNegativeTestHeader(stdout,"psMetadata", "Test F - Attempt to use null metadata with setIterator",
     136    fclose(fd);
     137    fd = fopen("./tst_psMetadata05_OUT", "r");
     138    if(fd == NULL) {
     139        printf("ERROR: Couldn't open file for reading\n");
     140    }
     141    fscanf(fd, "%ld", &data);
     142    fclose(fd);
     143    if(data != 55) {
     144        printf("ERROR: Data in file is not as expected. Value: %ld. Should be: 55.\n", data);
     145    }
     146
     147
     148    // Test G - Attempt to use null metadata with setIterator
     149    printNegativeTestHeader(stdout,"psMetadata", "Test G - Attempt to use null metadata with setIterator",
    139150                            "Null metadata collection not allowed", 0);
    140151    psMetadataSetIterator(NULL, 0);
    141     printFooter(stdout, "psMetadata", "Test F - Attempt to use null metadata with setIterator", true);
    142 
    143 
    144     // Test G - Attempt to use null metadata with getNext
    145     printNegativeTestHeader(stdout,"psMetadata", "Test G - Attempt to use null metadata with getNext",
     152    printFooter(stdout, "psMetadata", "Test G - Attempt to use null metadata with setIterator", true);
     153
     154
     155    // Test H - Attempt to use null metadata with getNext
     156    printNegativeTestHeader(stdout,"psMetadata", "Test H - Attempt to use null metadata with getNext",
    146157                            "Null metadata collection not allowed", 0);
    147158    psMetadataGetNext(NULL, "myItem2", 0);
    148     printFooter(stdout, "psMetadata", "Test G - Attempt to use null metadata with getNext", true);
    149 
    150 
    151     // Test H - Attempt to use null metadata with getPrevious
    152     printNegativeTestHeader(stdout,"psMetadata", "Test H - Attempt to use null metadata with getPrevious",
     159    printFooter(stdout, "psMetadata", "Test H - Attempt to use null metadata with getNext", true);
     160
     161
     162    // Test I - Attempt to use null metadata with getPrevious
     163    printNegativeTestHeader(stdout,"psMetadata", "Test I - Attempt to use null metadata with getPrevious",
    153164                            "Null metadata collection not allowed", 0);
    154165    psMetadataGetPrevious(NULL, "myItem2", 0);
    155     printFooter(stdout, "psMetadata", "Test H - Attempt to use null metadata with getPrevious", true);
    156 
    157 
    158     // Test I - Attempt to use null file with itemPrint
    159     printNegativeTestHeader(stdout,"psMetadata", "Test I - Attempt to use null file with itemPrint",
     166    printFooter(stdout, "psMetadata", "Test I - Attempt to use null metadata with getPrevious", true);
     167
     168
     169    // Test J - Attempt to use null file with itemPrint
     170    printNegativeTestHeader(stdout,"psMetadata", "Test J - Attempt to use null file with itemPrint",
    160171                            "Null file descriptor not allowed", 0);
    161172    psMetadataItemPrint(NULL, "Item value: %ld", item2);
    162     printFooter(stdout, "psMetadata", "Test I - Attempt to use null file with itemPrint", true);
    163 
    164 
    165     // Test J - Attempt to use null format with itemPrint
    166     printNegativeTestHeader(stdout,"psMetadata", "Test J - Attempt to use null format with itemPrint",
     173    printFooter(stdout, "psMetadata", "Test J - Attempt to use null file with itemPrint", true);
     174
     175
     176    // Test K - Attempt to use null format with itemPrint
     177    printNegativeTestHeader(stdout,"psMetadata", "Test K - Attempt to use null format with itemPrint",
    167178                            "Null format not allowed", 0);
    168179    psMetadataItemPrint(fd, NULL, item2);
    169     printFooter(stdout, "psMetadata", "Test J - Attempt to use null format with itemPrint", true);
    170 
    171 
    172     // Test K - Attempt to use null item with itemPrint
    173     printNegativeTestHeader(stdout,"psMetadata", "Test K - Attempt to use null item with itemPrint",
     180    printFooter(stdout, "psMetadata", "Test K - Attempt to use null format with itemPrint", true);
     181
     182
     183    // Test L - Attempt to use null item with itemPrint
     184    printNegativeTestHeader(stdout,"psMetadata", "Test L - Attempt to use null item with itemPrint",
    174185                            "Null metadata not allowed", 0);
    175186    psMetadataItemPrint(fd, "Item value: %ld", NULL);
    176     printFooter(stdout, "psMetadata", "Test K - Attempt to use null item with itemPrint", true);
    177 
    178 
    179     // Test L - Free psMetadata
    180     printPositiveTestHeader(stdout, "psMetadata", "Test I - Free psMetadata");
     187    printFooter(stdout, "psMetadata", "Test L - Attempt to use null item with itemPrint", true);
     188
     189
     190    // Test M - Free psMetadata
     191    printPositiveTestHeader(stdout, "psMetadata", "Test M - Free psMetadata");
    181192    psFree(metadata);
    182193    psFree(item1);
     
    190201        printf("ERROR: Found %d bad memory blocks\n", nBad);
    191202    }
    192     printFooter(stdout, "psMetadata", "Test L - Free psMetadata", true);
     203    printFooter(stdout, "psMetadata", "Test M - Free psMetadata", true);
    193204
    194205
Note: See TracChangeset for help on using the changeset viewer.