IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4263


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

Update test case for psDBChange to verify invalid arguments.

Location:
trunk/psLib/test/dataIO
Files:
2 edited

Legend:

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

    r4257 r4263  
    99 *  @author Aaron Culliney, MHPCC
    1010 *
    11  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-06-15 01:02:08 $
     11 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-06-15 01:48:25 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    7070
    7171testDescription tests[] = {
    72                               {TPDBInit,            -1,  "dbInit",            0, false},
    73                               {TPDBChange,          -2,  "dbChange",          0, false},
     72                              {TPDBInit,           841,  "dbInit",            0, false},
     73                              {TPDBChange,         842,  "dbChange",          0, false},
    7474                              {TPDBCreateTable,     -3,  "dbCreateTable",     0, false},
    7575                              {TPDBDropTable,       -4,  "dbDropTable",       0, false},
     
    317317}
    318318
    319 // Testpoint #XXX, psDBChange shall change databases.
     319// Testpoint #842, psDBChange shall change databases.
    320320psS32 TPDBChange( void )
    321321{
    322     psS32 failed = 0;
    323     psDB *dbh = NULL;
    324 
    325     dbh = _init_psDB();
    326     if (dbh == NULL) {
    327         return 1;
    328     }
    329 
    330     psLogMsg( __func__, PS_LOG_INFO, "psDBChange shall change to a new test database.\n" );
    331 
    332     failed = ! psDBChange(dbh, dbname);
    333 
    334     psDBCleanup(dbh);
    335 
    336     return failed;
     322    psDB *dbh = NULL;
     323
     324    // Initialize database connection
     325    dbh = _init_psDB();
     326    if (dbh == NULL) {
     327        psError(PS_ERR_UNKNOWN,true,"Did not expect NULL for valid arguments");
     328        return 1;
     329    }
     330
     331    // Attempt to change database with valid arguments
     332    if(!psDBChange(dbh, dbname)) {
     333        psError(PS_ERR_UNKNOWN,true,"Did not expect return false for valid arguments");
     334        return 2;
     335    }
     336
     337    // Attemp to change database to invalid database name
     338    if(psDBChange(dbh,"abc")) {
     339        psError(PS_ERR_UNKNOWN,true,"Did not expect return true for unknown database name");
     340        return 3;
     341    }
     342
     343    // Cleanup database connection
     344    psDBCleanup(dbh);
     345
     346    // Attempt to change database with NULL database object
     347    if(psDBChange(NULL,dbname)) {
     348        psError(PS_ERR_UNKNOWN,true,"Did not expect return true for NULL database object");
     349        return 4;
     350    }
     351
     352    return 0;
    337353}
    338354
  • trunk/psLib/test/dataIO/verified/tst_psDB.stderr

    r4257 r4263  
    1818\**********************************************************************************/
    1919
    20 <DATE><TIME>|<HOST>|I|TPDBChange
    21     psDBChange shall change to a new test database.
     20<DATE><TIME>|<HOST>|E|psDBChange (FILE:LINENO)
     21    Failed to change database.  Error: Access denied for user ''@'localhost' to database 'abc'
     22<DATE><TIME>|<HOST>|E|psDBChange (FILE:LINENO)
     23    Invalid psDB has been specified.
    2224
    2325---> TESTPOINT PASSED (psDB{dbChange} | tst_psDB.c)
Note: See TracChangeset for help on using the changeset viewer.