IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 540


Ignore:
Timestamp:
Apr 27, 2004, 4:50:56 PM (22 years ago)
Author:
desonia
Message:

added another test.

File:
1 edited

Legend:

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

    r537 r540  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-04-28 02:29:13 $
     8 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-04-28 02:50:56 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    1919#include "psTest.h"
    2020#include "psMemory.h"
     21#include "psAbort.h"
    2122
    22 int TPFreeReferencedMemory(void);
     23static int TPFreeReferencedMemory(void);
     24static int TPCheckBufferPositive(void);
    2325
    2426testDescription tests[] = {
     27                              {TPCheckBufferPositive,"TPCheckBufferPositive",0},
    2528                              {TPFreeReferencedMemory,"TPFreeReferencedMemory",6},
    2629                              {NULL}
     
    3235}
    3336
     37int TPCheckBufferPositive(void)
     38{
     39    int* mem;
     40    const int size = 100;
     41    int failed = 0;
     42
     43    printf("Allocating buffer\n");
     44    mem = (int*) psAlloc(size*sizeof(int));
     45
     46    for (int index=0;index<size;index++) {
     47        mem[index]=index;
     48    }
     49
     50    for (int index=0;index<size;index++) {
     51        if (mem[index] != index) {
     52            failed++;
     53        }
     54    }
     55
     56    return failed;
     57}
     58
    3459int TPFreeReferencedMemory(void)
    3560{
     
    3762    int* mem;
    3863
    39     printf("Allocating buffer\n");
     64    printf("Allocating buffer.\n");
    4065    mem = (int*) psAlloc(100*sizeof(int));
    4166
    4267    psMemIncrRefCounter(mem);
    43     printf("Freeing first time\n");
     68    printf("Freeing buffer after incrementing reference count.\n");
    4469    psFree(mem);
    45 
    46     printf("I survived?\n");
    4770
    4871    return 0;
Note: See TracChangeset for help on using the changeset viewer.