u12.c File Reference

#include <stdlib.h>
#include "memory.h"
#include "nmd.h"

Include dependency graph for u12.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)


Function Documentation

int main ( int  argc,
char **  argv 
)

Stress test

Definition at line 6 of file u12.c.

References NMDCreateObject(), NMDDestroyObject(), NMDGetValue(), NMDInt, and NMDSetValue().

00006                                {
00007   NMD_metadata nmd; NMDErrorCode ierr; 
00008   int i;
00009   PetscFunctionBegin;
00010   PetscInitialize(&argc,&argv,0,0);
00011 
00012   ierr = NMDCreateObject(&nmd); NMD_ERR_RETURN(ierr);
00013 
00014   /*
00015    * Test relocation of categories
00016    */
00017   for (i=0; i<999; i++) {
00018     char catname[20];
00019     memset(catname,0,20);
00020     sprintf(catname,"cat%d",i);
00021     ierr = NMDSetValue(nmd,catname,"cmp",NMDInt,&i); NMD_ERR_RETURN(ierr);
00022   }
00023   for (i=0; i<999; i++) {
00024     char catname[20]; int ii; NMDTruth flg;
00025     memset(catname,0,20);
00026     sprintf(catname,"cat%d",i);
00027     ierr = NMDGetValue
00028       (nmd,catname,"cmp",NULL,(void*)&ii,&flg); NMD_ERR_RETURN(ierr);
00029     if (!flg)
00030       NMD_ERR_REPORTi("Could not get value at",i);
00031     if (i!=ii)
00032       NMD_ERR_REPORTi("Value mismatch at",i);
00033   }
00034 
00035   /*
00036    * Test relocation of components
00037    */
00038   for (i=0; i<999; i++) {
00039     char cmpname[20];
00040     memset(cmpname,0,20);
00041     sprintf(cmpname,"cmp%d",i);
00042     ierr = NMDSetValue(nmd,"testcmp",cmpname,NMDInt,&i); NMD_ERR_RETURN(ierr);
00043   }
00044   for (i=0; i<999; i++) {
00045     char cmpname[20]; int ii; NMDTruth flg;
00046     memset(cmpname,0,20);
00047     sprintf(cmpname,"cmp%d",i);
00048     ierr = NMDGetValue
00049       (nmd,"testcmp",cmpname,NULL,(void*)&ii,&flg); NMD_ERR_RETURN(ierr);
00050     if (!flg)
00051       NMD_ERR_REPORTi("Could not get value at",i);
00052     if (i!=ii)
00053       NMD_ERR_REPORTi("Value mismatch at",i);
00054   }
00055 
00056   ierr = NMDDestroyObject(nmd); NMD_ERR_RETURN(ierr);
00057 
00058   PetscFinalize();
00059   PetscFunctionReturn(0);
00060 }

Here is the call graph for this function:


Generated on Sun Oct 4 03:59:30 2009 for NMD by  doxygen 1.5.9