IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 14, 2005, 3:02:08 PM (21 years ago)
Author:
evanalst
Message:

Update test case fro psDBInit and psDBCleanup to include error conditions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/dataIO/tst_psDB.c

    r4105 r4257  
    99 *  @author Aaron Culliney, MHPCC
    1010 *
    11  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-03 23:46:07 $
     11 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-15 01:02:08 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    9898    psDB *dbh = NULL;
    9999
    100     psLogMsg( __func__, PS_LOG_INFO, "initialize database connection...\n" );
    101 
     100    // Initialize database connection with test database
    102101    dbh = psDBInit(host, user, passwd, dbname);
    103102    if (dbh == NULL) {
     
    290289}
    291290
    292 // Testpoint #XXX, initialize/break-down MySQL connection.
     291// Testpoint #841, initialize/break-down MySQL connection.
    293292psS32 TPDBInit( void )
    294293{
    295     psS32 failed = 0;
    296     psDB *dbh = NULL;
    297 
    298     psLogMsg( __func__, PS_LOG_INFO, "psDBInit/psDBCleanup shall initialize/cleanup database connection.\n" );
    299 
    300     dbh = _init_psDB();
    301     if (dbh == NULL) {
    302         return 1;
    303     }
    304 
    305     psDBCleanup(dbh);
    306 
    307     return failed;
     294    psDB *dbh = NULL;
     295
     296    // Initialize database with valid arguments
     297    dbh = _init_psDB();
     298    if (dbh == NULL) {
     299        psError(PS_ERR_UNKNOWN,true,"Did not expect NULL to be returned for valid arguments");
     300        return 1;
     301    }
     302
     303    // Cleanup database/connection with valid psDB object
     304    psDBCleanup(dbh);
     305
     306    // Attempt to initialize database with invalid arguments
     307    dbh = psDBInit("xxx",NULL,NULL,NULL);
     308    if(dbh != NULL) {
     309        psError(PS_ERR_UNKNOWN,true,"Did not expect non-NULL psDB with invalid arguments");
     310        return 2;
     311    }
     312
     313    // Attempt cleanup database/connection with NULL psDB object
     314    psDBCleanup(NULL);
     315
     316    return 0;
    308317}
    309318
Note: See TracChangeset for help on using the changeset viewer.