IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1874


Ignore:
Timestamp:
Sep 23, 2004, 3:34:43 PM (22 years ago)
Author:
harman
Message:

Added more tests

Location:
trunk/psModules/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/pmMaskBadPixels.c

    r1870 r1874  
    1919 *  @author Ross Harman, MHPCC
    2020 *
    21  *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2004-09-23 23:33:54 $
     21 *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2004-09-24 01:34:43 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8686        psErrorMsg(PS_ERRORNAME_DOMAIN "pmMaskBadPixels", PS_ERR_BAD_PARAMETER_SIZE, true,
    8787                   PS_ERRORTEXT_pmMaskBadPixels_SIZE_MASK_IMAGE,
    88                    inImage->numRows, inImage->numCols, mask->numRows, mask->numCols);
     88                   inMask->numRows, inMask->numCols, mask->numRows, mask->numCols);
    8989        return false;
    9090    }
  • trunk/psModules/src/tst_pmMaskBadPixels.c

    r1870 r1874  
    33 *  @brief Contains the tests for pmMaskBadPixels:
    44 *
     5 *    Test A - Create mask based on maskVal argument
     6 *    Test B - Create mask based on saturation argument
     7 *    Test C - Create mask based on growVal and grow arguments
     8 *    Test D - Auto Create mask based on maskVal argument
     9 *    Test E - Attempt to use null mask
     10 *    Test F - Attempt tp use null input image
     11 *    Test G - Attempt to use input image bigger than mask
     12 *    Test H - Attempt to use input image mask bigger than mask
     13 *    Test I - Attempt to use offset greater than input image
     14 *    Test J - Attempt to use complex input image
     15 *    Test K - Attempt to use non-mask type mask image
     16 *
    517 *  @author Ross Harman, MHPCC
    618 *
    7  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-09-23 23:33:54 $
     19 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     20 *  @date $Date: 2004-09-24 01:34:43 $
    921 *
    1022 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6779    CREATE_AND_SET_IMAGE(inImage1,F64,0,50,50);
    6880    CREATE_AND_SET_IMAGE(mask1,U8,0,50,50)
    69     psReadout *inReadout  = psReadoutAlloc(0, 0, inImage1);
     81    psReadout *inReadout = psReadoutAlloc(0, 0, inImage1);
    7082    mask1->data.PS_TYPE_MASK_DATA[24][24]=1;
    7183    PRINT_MATRIX(mask1, U8, "Data mask:");
     
    8395    CREATE_AND_SET_IMAGE(inImage2,F64,150.0,50,50);
    8496    CREATE_AND_SET_IMAGE(mask2,U8,0,50,50)
    85     psReadout *inReadout2  = psReadoutAlloc(0, 0, inImage2);
     97    psReadout *inReadout2 = psReadoutAlloc(0, 0, inImage2);
    8698    PRINT_MATRIX(mask2, U8, "Data mask:");
    8799    pmMaskBadPixels(inReadout2, mask2, 0, 100.0, 0, 0);
     
    98110    CREATE_AND_SET_IMAGE(inImage3,F64,50.0,50,50);
    99111    CREATE_AND_SET_IMAGE(mask3,U8,0,50,50)
    100     psReadout *inReadout3  = psReadoutAlloc(0, 0, inImage3);
     112    psReadout *inReadout3 = psReadoutAlloc(0, 0, inImage3);
    101113    mask3->data.PS_TYPE_MASK_DATA[24][24]=1;
     114    mask3->data.PS_TYPE_MASK_DATA[4][3]=1;
     115    mask3->data.PS_TYPE_MASK_DATA[4][46]=1;
    102116    PRINT_MATRIX(mask3, U8, "Data mask:");
    103117    pmMaskBadPixels(inReadout3, mask3, 0, 100.0, 1, 10);
     
    110124
    111125
    112     // Test D - Create mask based on maskVal argument starting with non-null mask
    113     printPositiveTestHeader(stdout, "pmMaskBadPixels", "Test D - Create mask based on maskVal argument starting with non-null mask");
     126    // Test D - Auto Create mask based on maskVal argument
     127    printPositiveTestHeader(stdout, "pmMaskBadPixels", "Test D - Auto create mask based on maskVal argument");
    114128    CREATE_AND_SET_IMAGE(inImage4,F64,50.0,50,50);
    115129    CREATE_AND_SET_IMAGE(mask4,U8,0,50,50)
    116130    CREATE_AND_SET_IMAGE(mask4i,U8,0,50,50)
    117     psReadout *inReadout4  = psReadoutAlloc(0, 0, inImage4);
     131    psReadout *inReadout4 = psReadoutAlloc(0, 0, inImage4);
    118132    inReadout4->mask = mask4i;
    119133    mask4->data.PS_TYPE_MASK_DATA[24][24]=1;
     
    124138    psFree(inReadout4);
    125139    psFree(inImage4);
    126     printFooter(stdout, "pmMaskBadPixels", "Test D - Create mask based on maskVal argument starting with non-null mask", true);
    127     printf("\n\n\n");
    128 
     140    printFooter(stdout, "pmMaskBadPixels", "Test D - Auto create mask based on maskVal argument", true);
     141    printf("\n\n\n");
     142
     143
     144    // Test E - Attempt to use null mask
     145    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test E - Attempt to use null mask",
     146                            "Null not allowed for mask image", 0);
     147    CREATE_AND_SET_IMAGE(inImage5,F64,50.0,50,50);
     148    psReadout *inReadout5 = psReadoutAlloc(0, 0, inImage5);
     149    pmMaskBadPixels(inReadout4, NULL, 0, 100.0, 1, 10);
     150    psFree(inReadout5);
     151    psFree(inImage5);
     152    printFooter(stdout, "pmMaskBadPixels", "Test E - Attempt to use null mask", true);
     153    printf("\n\n\n");
     154
     155
     156    // Test F - Attempt tp use null input image
     157    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test F - Attempt tp use null input image",
     158                            "Null not allowed for input image", 0);
     159
     160    CREATE_AND_SET_IMAGE(mask6,U8,0,50,50)
     161    psReadout *inReadout6 = psReadoutAlloc(0, 0, NULL);
     162    inReadout6->mask = mask6;
     163    pmMaskBadPixels(inReadout6, mask6, 0, 100.0, 1, 10);
     164    psFree(inReadout6);
     165    printFooter(stdout, "pmMaskBadPixels", "Test F - Attempt tp use null input image", true);
     166    printf("\n\n\n");
     167
     168
     169    // Test G - Attempt to use input image bigger than mask
     170    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test G - Attempt to use input image bigger than mask",
     171                            "Input image size exceeds that of mask image", 0);
     172    CREATE_AND_SET_IMAGE(inImage7,F64,0.0,60,60);
     173    CREATE_AND_SET_IMAGE(mask7,U8,0,50,50)
     174    CREATE_AND_SET_IMAGE(mask7i,U8,0,50,50)
     175    psReadout *inReadout7 = psReadoutAlloc(0, 0, inImage7);
     176    inReadout4->mask = mask7i;
     177    pmMaskBadPixels(inReadout4, mask7, 0, 100.0, 1, 10);
     178    psFree(mask7);
     179    psFree(inReadout7);
     180    psFree(inImage7);
     181    printFooter(stdout, "pmMaskBadPixels", "Test G - Attempt to use input image bigger than mask", true);
     182    printf("\n\n\n");
     183
     184
     185    // Test H - Attempt to use input image mask bigger than mask
     186    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test H - Attempt to use input image mask bigger than mask",
     187                            "Input image mask size exceeds that of mask image", 0);
     188    CREATE_AND_SET_IMAGE(inImage8,F64,0.0,50,50);
     189    CREATE_AND_SET_IMAGE(mask8,U8,0,50,50)
     190    CREATE_AND_SET_IMAGE(mask8i,U8,0,60,60)
     191    psReadout *inReadout8 = psReadoutAlloc(0, 0, inImage8);
     192    inReadout8->mask = mask8i;
     193    pmMaskBadPixels(inReadout8, mask8, 0, 100.0, 1, 10);
     194    psFree(mask8);
     195    psFree(inReadout8);
     196    psFree(inImage8);
     197    printFooter(stdout, "pmMaskBadPixels", "Test H - Attempt to use input image mask bigger than mask", true);
     198    printf("\n\n\n");
     199
     200
     201    // Test I - Attempt to use offset greater than input image
     202    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test I - Attempt to use offset greater than input image",
     203                            "Total offset >= input image size", 0);
     204    CREATE_AND_SET_IMAGE(inImage9,F64,0.0,50,50);
     205    CREATE_AND_SET_IMAGE(mask9,U8,0,50,50)
     206    CREATE_AND_SET_IMAGE(mask9i,U8,0,50,50)
     207    psReadout *inReadout9 = psReadoutAlloc(0, 0, inImage9);
     208    inReadout9->mask = mask9i;
     209    *(int*)&inReadout->col0 = 150;
     210    *(int*)&inReadout->row0 = 150;
     211    pmMaskBadPixels(inReadout9, mask9, 0, 100.0, 1, 10);
     212    psFree(mask9);
     213    psFree(inReadout9);
     214    psFree(inImage9);
     215    printFooter(stdout, "pmMaskBadPixels", "Test I - Attempt to use offset greater than input image", true);
     216    printf("\n\n\n");
     217
     218
     219    // Test J - Attempt to use complex input image
     220    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test J - Attempt to use complex input image",
     221                            "Complex types not allowed for input image", 0);
     222    CREATE_AND_SET_IMAGE(inImage10,C64,50.0,50,50);
     223    CREATE_AND_SET_IMAGE(mask10,U8,0,50,50)
     224    CREATE_AND_SET_IMAGE(mask10i,U8,0,50,50)
     225    psReadout *inReadout10 = psReadoutAlloc(0, 0, inImage10);
     226    inReadout10->mask = mask10i;
     227    pmMaskBadPixels(inReadout10, mask10, 0, 100.0, 1, 10);
     228    psFree(mask10);
     229    psFree(inReadout10);
     230    psFree(inImage10);
     231    printFooter(stdout, "pmMaskBadPixels", "Test J - Attempt to use complex input image", true);
     232    printf("\n\n\n");
     233
     234
     235    // Test K - Attempt to use non-mask type mask image
     236    printNegativeTestHeader(stdout,"pmMaskBadPixels", "Test K - Attempt to use non-mask type mask image",
     237                            "Mask must be PS_TYPE_MASK type", 0);
     238    CREATE_AND_SET_IMAGE(inImage11,F64,50.0,50,50);
     239    CREATE_AND_SET_IMAGE(mask11,F64,0,50,50)
     240    CREATE_AND_SET_IMAGE(mask11i,U8,0,50,50)
     241    psReadout *inReadout11 = psReadoutAlloc(0, 0, inImage10);
     242    inReadout11->mask = mask11i;
     243    pmMaskBadPixels(inReadout11, mask11, 0, 100.0, 1, 10);
     244    psFree(mask11);
     245    psFree(inReadout11);
     246    psFree(inImage11);
     247    printFooter(stdout, "pmMaskBadPixels", "Test K - Attempt to use non-mask type mask image", true);
     248    printf("\n\n\n");
    129249
    130250    return 0;
Note: See TracChangeset for help on using the changeset viewer.