IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1872


Ignore:
Timestamp:
Sep 23, 2004, 3:08:25 PM (22 years ago)
Author:
evanalst
Message:

Add additional test case for psErrorCodeString function.

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

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/sysUtils/tst_psError.c

    r1867 r1872  
    44 *
    55 *  This test driver contains the following test points for psError
    6  *     testError00 - psError()
    7  *     testError01 - psErrorMsg(), psErrorStackPrint()
    8  *     testError02 - psErrorStackPrintV()
    9  *     testError03 - psErrorGet(), psErrorLast()
    10  *     testError04 - psErrorClear()
     6 *     testError00 - psError()                          (Testpoint #486)
     7 *     testError01 - psErrorMsg(), psErrorStackPrint()  (Testpoint #   )
     8 *     testError02 - psErrorStackPrintV()               (Testpoint #   )
     9 *     testError03 - psErrorGet(), psErrorLast()        (Testpoint #   )
     10 *     testError04 - psErrorClear()                     (Testpoint #   )
    1111 *
    1212 *  @author  Eric Van Alst, MHPCC
    1313 *
    14  *  @version $Revision: 1.7 $  $Name: not supported by cvs2svn $
    15  *  @date  $Date: 2004-09-23 21:59:16 $
     14 *  @version $Revision: 1.8 $  $Name: not supported by cvs2svn $
     15 *  @date  $Date: 2004-09-24 01:08:25 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2929static int testError03(void);
    3030static int testError04(void);
     31static int testError05(void);
    3132
    3233// Function used in testError02 to verify the psErrorStackPrintV function
     
    4950                              {testError03, 0, "psErrorGet(),psErrorLast()", 0, false},
    5051                              {testError04, 0, "psErrorClear()", 0, false},
     52                              {testError05, 0, "psErrorCodeString()", 0, false},
    5153                              {NULL}
    5254                          };
     
    5961}
    6062
     63static int testError05(void)
     64{
     65    psErrorCode code = PS_ERR_BAD_PARAMETER_VALUE;
     66
     67    // Verify the return value of psErrorCodeString
     68    psLogMsg("tst_psError05", PS_LOG_INFO, psErrorCodeString(code));
     69
     70    // Verify the return value of psErrorCodeString if code is negative
     71    if( psErrorCodeString(-1) != NULL) {
     72        psLogMsg("tst_psError05", PS_LOG_INFO, "Failed error string with neg. code");
     73        return 40;
     74    }
     75
     76    return 0;
     77}
     78
    6179static int testError04(void)
    6280{
     
    6684
    6785    // Generate three error messages
    68     if (psErrorMsg("test3A", code, true, "Error code = %d", code) !=  code) {
    69         psLogMsg("tst_psError03", PS_LOG_ERROR, "Failed return value verify.");
     86    if (psErrorMsg("test4A", code, true, "Error code = %d", code) !=  code) {
     87        psLogMsg("tst_psError04", PS_LOG_ERROR, "Failed return value verify.");
    7088        return 30;
    7189    }
    72     if (psErrorMsg("test3A", (code+1), false, "Error code = %d", (code+1)) != (code+1)) {
    73         psLogMsg("tst_psError03", PS_LOG_ERROR, "Failed return value verify.");
     90    if (psErrorMsg("test4A", (code+1), false, "Error code = %d", (code+1)) != (code+1)) {
     91        psLogMsg("tst_psError04", PS_LOG_ERROR, "Failed return value verify.");
    7492        return 31;
    7593    }
    76     if (psErrorMsg("test3A", (code+2), false, "Error code = %d", (code+2)) != (code+2)) {
    77         psLogMsg("tst_psError03", PS_LOG_ERROR, "Failed return value verify.");
     94    if (psErrorMsg("test4A", (code+2), false, "Error code = %d", (code+2)) != (code+2)) {
     95        psLogMsg("tst_psError04", PS_LOG_ERROR, "Failed return value verify.");
    7896        return 32;
    7997    }
  • trunk/psLib/test/sysUtils/verified/tst_psError.stderr

    r1867 r1872  
    7878\**********************************************************************************/
    7979
    80 <DATE><TIME>|<HOST>|E|test3A
     80<DATE><TIME>|<HOST>|E|test4A
    8181    Error code = 262
    82 <DATE><TIME>|<HOST>|E|test3A
     82<DATE><TIME>|<HOST>|E|test4A
    8383    Error code = 263
    84 <DATE><TIME>|<HOST>|E|test3A
     84<DATE><TIME>|<HOST>|E|test4A
    8585    Error code = 264
    8686
    8787---> TESTPOINT PASSED (psError{psErrorClear()} | tst_psError.c)
    8888
     89/***************************** TESTPOINT ******************************************\
     90*             TestFile: tst_psError.c                                              *
     91*            TestPoint: psError{psErrorCodeString()}                               *
     92*             TestType: Positive                                                   *
     93\**********************************************************************************/
     94
     95<DATE><TIME>|<HOST>|I|tst_psError05
     96    parameter is out-of-range
     97
     98---> TESTPOINT PASSED (psError{psErrorCodeString()} | tst_psError.c)
     99
Note: See TracChangeset for help on using the changeset viewer.