ArraySequenceFactoriesTest.c

Go to the documentation of this file.
00001 /*************** <lalVerbatim file="ArraySequenceFactoriesTestCV"> ****
00002 $Id: ArraySequenceFactoriesTest.m4,v 1.1 2002/05/21 17:14:38 teviet Exp $
00003 **************** </lalVerbatim> ****************************************/
00004 
00005 /* <lalLaTeX>
00006 
00007 \subsection{Program \texttt{ArraySequenceFactoriesTest.c}}
00008 \label{ss:ArraySequenceFactoriesTest.c}
00009 
00010 A program to test create/destroy array sequence routines.
00011 
00012 \subsubsection*{Usage}
00013 \begin{verbatim}
00014 ArraySequenceFactoriesTest [options]
00015 Options:
00016   -h         print help
00017   -q         quiet: run silently
00018   -v         verbose: print extra information
00019   -d level   set lalDebugLevel to level
00020 \end{verbatim}
00021 
00022 \subsubsection*{Description}
00023 
00024 \subsubsection*{Exit codes}
00025 \begin{tabular}{|c|l|}
00026 \hline
00027  Code & Explanation                   \\
00028 \hline
00029 \tt 0 & Success, normal exit.         \\
00030 \tt 1 & Subroutine failed.            \\
00031 \hline
00032 \end{tabular}
00033 
00034 \subsubsection*{Algorithm}
00035 
00036 \subsubsection*{Uses}
00037 \begin{verbatim}
00038 lalDebugLevel
00039 TYPECODECreateArraySequence()
00040 TYPECODEDestroyArraySequence()
00041 \end{verbatim}
00042 
00043 \subsubsection*{Notes}
00044 
00045 \vfill{\footnotesize\input{ArraySequenceFactoriesTestCV}}
00046 
00047 </lalLaTeX> */
00048 
00049 #include <stdlib.h>
00050 #include <stdio.h>
00051 #include <string.h>
00052 
00053 #include <lal/LALConfig.h>
00054 
00055 #ifdef HAVE_UNISTD_H
00056 #include <unistd.h>
00057 #endif
00058 
00059 #ifdef HAVE_GETOPT_H
00060 #include <getopt.h>
00061 #endif
00062 
00063 #include <lal/LALStdlib.h>
00064 #include <lal/SeqFactories.h>
00065 
00066 #define CODES_(x) #x
00067 #define CODES(x) CODES_(x)
00068 
00069 NRCSID( MAIN, "$Id: ArraySequenceFactoriesTest.m4,v 1.1 2002/05/21 17:14:38 teviet Exp $" );
00070 
00071 extern char *optarg;
00072 extern int   optind;
00073 
00074 int lalDebugLevel = 0;
00075 int verbose    = 0;
00076 
00077 static void
00078 Usage (const char *program, int exitflag);
00079 
00080 static void
00081 ParseOptions (int argc, char *argv[]);
00082 
00083 static void
00084 TestStatus (LALStatus *status, const char *expectedCodes, int exitCode);
00085 
00086 static void
00087 ClearStatus (LALStatus *status);
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 static void ZArraySequenceFactoriesTest ( void )
00108 {
00109   CreateArraySequenceIn input;
00110   UINT4Vector dimLength;
00111   UINT4 data[] = { 2, 3, 2 };
00112   UINT4 dataBad[] = { 2, 3, 0 };
00113   static LALStatus  status;
00114   static COMPLEX16ArraySequence  *sequence;
00115   static COMPLEX16ArraySequence   sstore;
00116 
00117 
00118   /*
00119    *
00120    * Test ordinary behavior.
00121    *
00122    */
00123 
00124   dimLength.length = 3;
00125   dimLength.data = data;
00126   input.length = 2;
00127   input.dimLength = &dimLength;
00128 
00129   LALZCreateArraySequence ( &status, &sequence, &input );
00130   TestStatus( &status, CODES( 0 ), 1 );
00131 
00132   memset( sequence->data, 0, sequence->length*sequence->arrayDim*sizeof( COMPLEX16 ) );
00133 
00134   LALZDestroyArraySequence ( &status, &sequence );
00135   TestStatus( &status, CODES( 0 ), 1 );
00136 
00137   LALCheckMemoryLeaks();
00138 
00139 
00140   /*
00141    *
00142    * Test error codes.
00143    *
00144    */
00145 
00146 #ifndef LAL_NDEBUG
00147 
00148   if ( ! lalNoDebug )
00149   {
00150     input.length = 0;
00151     LALZCreateArraySequence ( &status, &sequence, &input );
00152     TestStatus( &status, CODES( SEQFACTORIESH_ESLENGTH ), 1 );
00153 
00154     input.length = 2;
00155     input.dimLength->data = dataBad;
00156     LALZCreateArraySequence ( &status, &sequence, &input );
00157     TestStatus( &status, CODES( SEQFACTORIESH_EALENGTH ), 1 );
00158 
00159     LALZCreateArraySequence ( &status, &sequence, NULL );
00160     TestStatus( &status, CODES( SEQFACTORIESH_EINPTR ), 1 );
00161 
00162     LALZDestroyArraySequence ( &status, NULL );
00163     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00164 
00165     input.dimLength->data = data;
00166     LALZCreateArraySequence ( &status, NULL, &input );
00167     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00168 
00169     LALZDestroyArraySequence ( &status, &sequence );
00170     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00171 
00172     sequence = &sstore;
00173     LALZCreateArraySequence ( &status, &sequence, &input );
00174     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00175 
00176     LALZDestroyArraySequence ( &status, &sequence );
00177     TestStatus( &status, CODES( SEQFACTORIESH_EDPTR ), 1 );
00178   }
00179 
00180 #endif
00181 
00182   LALCheckMemoryLeaks();
00183   printf( "PASS: tests of LALZCreateArraySequence and LALZDestroyArraySequence \n" );
00184 
00185   return;
00186 }
00187 
00188 
00189 
00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 
00205 
00206 
00207 static void CArraySequenceFactoriesTest ( void )
00208 {
00209   CreateArraySequenceIn input;
00210   UINT4Vector dimLength;
00211   UINT4 data[] = { 2, 3, 2 };
00212   UINT4 dataBad[] = { 2, 3, 0 };
00213   static LALStatus  status;
00214   static COMPLEX8ArraySequence  *sequence;
00215   static COMPLEX8ArraySequence   sstore;
00216 
00217 
00218   /*
00219    *
00220    * Test ordinary behavior.
00221    *
00222    */
00223 
00224   dimLength.length = 3;
00225   dimLength.data = data;
00226   input.length = 2;
00227   input.dimLength = &dimLength;
00228 
00229   LALCCreateArraySequence ( &status, &sequence, &input );
00230   TestStatus( &status, CODES( 0 ), 1 );
00231 
00232   memset( sequence->data, 0, sequence->length*sequence->arrayDim*sizeof( COMPLEX8 ) );
00233 
00234   LALCDestroyArraySequence ( &status, &sequence );
00235   TestStatus( &status, CODES( 0 ), 1 );
00236 
00237   LALCheckMemoryLeaks();
00238 
00239 
00240   /*
00241    *
00242    * Test error codes.
00243    *
00244    */
00245 
00246 #ifndef LAL_NDEBUG
00247 
00248   if ( ! lalNoDebug )
00249   {
00250     input.length = 0;
00251     LALCCreateArraySequence ( &status, &sequence, &input );
00252     TestStatus( &status, CODES( SEQFACTORIESH_ESLENGTH ), 1 );
00253 
00254     input.length = 2;
00255     input.dimLength->data = dataBad;
00256     LALCCreateArraySequence ( &status, &sequence, &input );
00257     TestStatus( &status, CODES( SEQFACTORIESH_EALENGTH ), 1 );
00258 
00259     LALCCreateArraySequence ( &status, &sequence, NULL );
00260     TestStatus( &status, CODES( SEQFACTORIESH_EINPTR ), 1 );
00261 
00262     LALCDestroyArraySequence ( &status, NULL );
00263     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00264 
00265     input.dimLength->data = data;
00266     LALCCreateArraySequence ( &status, NULL, &input );
00267     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00268 
00269     LALCDestroyArraySequence ( &status, &sequence );
00270     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00271 
00272     sequence = &sstore;
00273     LALCCreateArraySequence ( &status, &sequence, &input );
00274     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00275 
00276     LALCDestroyArraySequence ( &status, &sequence );
00277     TestStatus( &status, CODES( SEQFACTORIESH_EDPTR ), 1 );
00278   }
00279 
00280 #endif
00281 
00282   LALCheckMemoryLeaks();
00283   printf( "PASS: tests of LALCCreateArraySequence and LALCDestroyArraySequence \n" );
00284 
00285   return;
00286 }
00287 
00288 
00289 
00290 
00291 
00292 
00293 
00294 
00295 
00296 
00297 
00298 
00299 
00300 
00301 
00302 
00303 
00304 
00305 
00306 
00307 static void DArraySequenceFactoriesTest ( void )
00308 {
00309   CreateArraySequenceIn input;
00310   UINT4Vector dimLength;
00311   UINT4 data[] = { 2, 3, 2 };
00312   UINT4 dataBad[] = { 2, 3, 0 };
00313   static LALStatus  status;
00314   static REAL8ArraySequence  *sequence;
00315   static REAL8ArraySequence   sstore;
00316 
00317 
00318   /*
00319    *
00320    * Test ordinary behavior.
00321    *
00322    */
00323 
00324   dimLength.length = 3;
00325   dimLength.data = data;
00326   input.length = 2;
00327   input.dimLength = &dimLength;
00328 
00329   LALDCreateArraySequence ( &status, &sequence, &input );
00330   TestStatus( &status, CODES( 0 ), 1 );
00331 
00332   memset( sequence->data, 0, sequence->length*sequence->arrayDim*sizeof( REAL8 ) );
00333 
00334   LALDDestroyArraySequence ( &status, &sequence );
00335   TestStatus( &status, CODES( 0 ), 1 );
00336 
00337   LALCheckMemoryLeaks();
00338 
00339 
00340   /*
00341    *
00342    * Test error codes.
00343    *
00344    */
00345 
00346 #ifndef LAL_NDEBUG
00347 
00348   if ( ! lalNoDebug )
00349   {
00350     input.length = 0;
00351     LALDCreateArraySequence ( &status, &sequence, &input );
00352     TestStatus( &status, CODES( SEQFACTORIESH_ESLENGTH ), 1 );
00353 
00354     input.length = 2;
00355     input.dimLength->data = dataBad;
00356     LALDCreateArraySequence ( &status, &sequence, &input );
00357     TestStatus( &status, CODES( SEQFACTORIESH_EALENGTH ), 1 );
00358 
00359     LALDCreateArraySequence ( &status, &sequence, NULL );
00360     TestStatus( &status, CODES( SEQFACTORIESH_EINPTR ), 1 );
00361 
00362     LALDDestroyArraySequence ( &status, NULL );
00363     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00364 
00365     input.dimLength->data = data;
00366     LALDCreateArraySequence ( &status, NULL, &input );
00367     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00368 
00369     LALDDestroyArraySequence ( &status, &sequence );
00370     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00371 
00372     sequence = &sstore;
00373     LALDCreateArraySequence ( &status, &sequence, &input );
00374     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00375 
00376     LALDDestroyArraySequence ( &status, &sequence );
00377     TestStatus( &status, CODES( SEQFACTORIESH_EDPTR ), 1 );
00378   }
00379 
00380 #endif
00381 
00382   LALCheckMemoryLeaks();
00383   printf( "PASS: tests of LALDCreateArraySequence and LALDDestroyArraySequence \n" );
00384 
00385   return;
00386 }
00387 
00388 
00389 
00390 
00391 
00392 
00393 
00394 
00395 
00396 
00397 
00398 
00399 
00400 
00401 
00402 
00403 
00404 
00405 
00406 
00407 static void SArraySequenceFactoriesTest ( void )
00408 {
00409   CreateArraySequenceIn input;
00410   UINT4Vector dimLength;
00411   UINT4 data[] = { 2, 3, 2 };
00412   UINT4 dataBad[] = { 2, 3, 0 };
00413   static LALStatus  status;
00414   static REAL4ArraySequence  *sequence;
00415   static REAL4ArraySequence   sstore;
00416 
00417 
00418   /*
00419    *
00420    * Test ordinary behavior.
00421    *
00422    */
00423 
00424   dimLength.length = 3;
00425   dimLength.data = data;
00426   input.length = 2;
00427   input.dimLength = &dimLength;
00428 
00429   LALSCreateArraySequence ( &status, &sequence, &input );
00430   TestStatus( &status, CODES( 0 ), 1 );
00431 
00432   memset( sequence->data, 0, sequence->length*sequence->arrayDim*sizeof( REAL4 ) );
00433 
00434   LALSDestroyArraySequence ( &status, &sequence );
00435   TestStatus( &status, CODES( 0 ), 1 );
00436 
00437   LALCheckMemoryLeaks();
00438 
00439 
00440   /*
00441    *
00442    * Test error codes.
00443    *
00444    */
00445 
00446 #ifndef LAL_NDEBUG
00447 
00448   if ( ! lalNoDebug )
00449   {
00450     input.length = 0;
00451     LALSCreateArraySequence ( &status, &sequence, &input );
00452     TestStatus( &status, CODES( SEQFACTORIESH_ESLENGTH ), 1 );
00453 
00454     input.length = 2;
00455     input.dimLength->data = dataBad;
00456     LALSCreateArraySequence ( &status, &sequence, &input );
00457     TestStatus( &status, CODES( SEQFACTORIESH_EALENGTH ), 1 );
00458 
00459     LALSCreateArraySequence ( &status, &sequence, NULL );
00460     TestStatus( &status, CODES( SEQFACTORIESH_EINPTR ), 1 );
00461 
00462     LALSDestroyArraySequence ( &status, NULL );
00463     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00464 
00465     input.dimLength->data = data;
00466     LALSCreateArraySequence ( &status, NULL, &input );
00467     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00468 
00469     LALSDestroyArraySequence ( &status, &sequence );
00470     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00471 
00472     sequence = &sstore;
00473     LALSCreateArraySequence ( &status, &sequence, &input );
00474     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00475 
00476     LALSDestroyArraySequence ( &status, &sequence );
00477     TestStatus( &status, CODES( SEQFACTORIESH_EDPTR ), 1 );
00478   }
00479 
00480 #endif
00481 
00482   LALCheckMemoryLeaks();
00483   printf( "PASS: tests of LALSCreateArraySequence and LALSDestroyArraySequence \n" );
00484 
00485   return;
00486 }
00487 
00488 
00489 
00490 
00491 
00492 
00493 
00494 
00495 
00496 
00497 
00498 
00499 
00500 
00501 
00502 
00503 
00504 
00505 
00506 
00507 static void I2ArraySequenceFactoriesTest ( void )
00508 {
00509   CreateArraySequenceIn input;
00510   UINT4Vector dimLength;
00511   UINT4 data[] = { 2, 3, 2 };
00512   UINT4 dataBad[] = { 2, 3, 0 };
00513   static LALStatus  status;
00514   static INT2ArraySequence  *sequence;
00515   static INT2ArraySequence   sstore;
00516 
00517 
00518   /*
00519    *
00520    * Test ordinary behavior.
00521    *
00522    */
00523 
00524   dimLength.length = 3;
00525   dimLength.data = data;
00526   input.length = 2;
00527   input.dimLength = &dimLength;
00528 
00529   LALI2CreateArraySequence ( &status, &sequence, &input );
00530   TestStatus( &status, CODES( 0 ), 1 );
00531 
00532   memset( sequence->data, 0, sequence->length*sequence->arrayDim*sizeof( INT2 ) );
00533 
00534   LALI2DestroyArraySequence ( &status, &sequence );
00535   TestStatus( &status, CODES( 0 ), 1 );
00536 
00537   LALCheckMemoryLeaks();
00538 
00539 
00540   /*
00541    *
00542    * Test error codes.
00543    *
00544    */
00545 
00546 #ifndef LAL_NDEBUG
00547 
00548   if ( ! lalNoDebug )
00549   {
00550     input.length = 0;
00551     LALI2CreateArraySequence ( &status, &sequence, &input );
00552     TestStatus( &status, CODES( SEQFACTORIESH_ESLENGTH ), 1 );
00553 
00554     input.length = 2;
00555     input.dimLength->data = dataBad;
00556     LALI2CreateArraySequence ( &status, &sequence, &input );
00557     TestStatus( &status, CODES( SEQFACTORIESH_EALENGTH ), 1 );
00558 
00559     LALI2CreateArraySequence ( &status, &sequence, NULL );
00560     TestStatus( &status, CODES( SEQFACTORIESH_EINPTR ), 1 );
00561 
00562     LALI2DestroyArraySequence ( &status, NULL );
00563     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00564 
00565     input.dimLength->data = data;
00566     LALI2CreateArraySequence ( &status, NULL, &input );
00567     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00568 
00569     LALI2DestroyArraySequence ( &status, &sequence );
00570     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00571 
00572     sequence = &sstore;
00573     LALI2CreateArraySequence ( &status, &sequence, &input );
00574     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00575 
00576     LALI2DestroyArraySequence ( &status, &sequence );
00577     TestStatus( &status, CODES( SEQFACTORIESH_EDPTR ), 1 );
00578   }
00579 
00580 #endif
00581 
00582   LALCheckMemoryLeaks();
00583   printf( "PASS: tests of LALI2CreateArraySequence and LALI2DestroyArraySequence \n" );
00584 
00585   return;
00586 }
00587 
00588 
00589 
00590 
00591 
00592 
00593 
00594 
00595 
00596 
00597 
00598 
00599 
00600 
00601 
00602 
00603 
00604 
00605 
00606 
00607 static void I4ArraySequenceFactoriesTest ( void )
00608 {
00609   CreateArraySequenceIn input;
00610   UINT4Vector dimLength;
00611   UINT4 data[] = { 2, 3, 2 };
00612   UINT4 dataBad[] = { 2, 3, 0 };
00613   static LALStatus  status;
00614   static INT4ArraySequence  *sequence;
00615   static INT4ArraySequence   sstore;
00616 
00617 
00618   /*
00619    *
00620    * Test ordinary behavior.
00621    *
00622    */
00623 
00624   dimLength.length = 3;
00625   dimLength.data = data;
00626   input.length = 2;
00627   input.dimLength = &dimLength;
00628 
00629   LALI4CreateArraySequence ( &status, &sequence, &input );
00630   TestStatus( &status, CODES( 0 ), 1 );
00631 
00632   memset( sequence->data, 0, sequence->length*sequence->arrayDim*sizeof( INT4 ) );
00633 
00634   LALI4DestroyArraySequence ( &status, &sequence );
00635   TestStatus( &status, CODES( 0 ), 1 );
00636 
00637   LALCheckMemoryLeaks();
00638 
00639 
00640   /*
00641    *
00642    * Test error codes.
00643    *
00644    */
00645 
00646 #ifndef LAL_NDEBUG
00647 
00648   if ( ! lalNoDebug )
00649   {
00650     input.length = 0;
00651     LALI4CreateArraySequence ( &status, &sequence, &input );
00652     TestStatus( &status, CODES( SEQFACTORIESH_ESLENGTH ), 1 );
00653 
00654     input.length = 2;
00655     input.dimLength->data = dataBad;
00656     LALI4CreateArraySequence ( &status, &sequence, &input );
00657     TestStatus( &status, CODES( SEQFACTORIESH_EALENGTH ), 1 );
00658 
00659     LALI4CreateArraySequence ( &status, &sequence, NULL );
00660     TestStatus( &status, CODES( SEQFACTORIESH_EINPTR ), 1 );
00661 
00662     LALI4DestroyArraySequence ( &status, NULL );
00663     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00664 
00665     input.dimLength->data = data;
00666     LALI4CreateArraySequence ( &status, NULL, &input );
00667     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00668 
00669     LALI4DestroyArraySequence ( &status, &sequence );
00670     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00671 
00672     sequence = &sstore;
00673     LALI4CreateArraySequence ( &status, &sequence, &input );
00674     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00675 
00676     LALI4DestroyArraySequence ( &status, &sequence );
00677     TestStatus( &status, CODES( SEQFACTORIESH_EDPTR ), 1 );
00678   }
00679 
00680 #endif
00681 
00682   LALCheckMemoryLeaks();
00683   printf( "PASS: tests of LALI4CreateArraySequence and LALI4DestroyArraySequence \n" );
00684 
00685   return;
00686 }
00687 
00688 
00689 
00690 
00691 
00692 
00693 
00694 
00695 
00696 
00697 
00698 
00699 
00700 
00701 
00702 
00703 
00704 
00705 
00706 
00707 static void I8ArraySequenceFactoriesTest ( void )
00708 {
00709   CreateArraySequenceIn input;
00710   UINT4Vector dimLength;
00711   UINT4 data[] = { 2, 3, 2 };
00712   UINT4 dataBad[] = { 2, 3, 0 };
00713   static LALStatus  status;
00714   static INT8ArraySequence  *sequence;
00715   static INT8ArraySequence   sstore;
00716 
00717 
00718   /*
00719    *
00720    * Test ordinary behavior.
00721    *
00722    */
00723 
00724   dimLength.length = 3;
00725   dimLength.data = data;
00726   input.length = 2;
00727   input.dimLength = &dimLength;
00728 
00729   LALI8CreateArraySequence ( &status, &sequence, &input );
00730   TestStatus( &status, CODES( 0 ), 1 );
00731 
00732   memset( sequence->data, 0, sequence->length*sequence->arrayDim*sizeof( INT8 ) );
00733 
00734   LALI8DestroyArraySequence ( &status, &sequence );
00735   TestStatus( &status, CODES( 0 ), 1 );
00736 
00737   LALCheckMemoryLeaks();
00738 
00739 
00740   /*
00741    *
00742    * Test error codes.
00743    *
00744    */
00745 
00746 #ifndef LAL_NDEBUG
00747 
00748   if ( ! lalNoDebug )
00749   {
00750     input.length = 0;
00751     LALI8CreateArraySequence ( &status, &sequence, &input );
00752     TestStatus( &status, CODES( SEQFACTORIESH_ESLENGTH ), 1 );
00753 
00754     input.length = 2;
00755     input.dimLength->data = dataBad;
00756     LALI8CreateArraySequence ( &status, &sequence, &input );
00757     TestStatus( &status, CODES( SEQFACTORIESH_EALENGTH ), 1 );
00758 
00759     LALI8CreateArraySequence ( &status, &sequence, NULL );
00760     TestStatus( &status, CODES( SEQFACTORIESH_EINPTR ), 1 );
00761 
00762     LALI8DestroyArraySequence ( &status, NULL );
00763     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00764 
00765     input.dimLength->data = data;
00766     LALI8CreateArraySequence ( &status, NULL, &input );
00767     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00768 
00769     LALI8DestroyArraySequence ( &status, &sequence );
00770     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00771 
00772     sequence = &sstore;
00773     LALI8CreateArraySequence ( &status, &sequence, &input );
00774     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00775 
00776     LALI8DestroyArraySequence ( &status, &sequence );
00777     TestStatus( &status, CODES( SEQFACTORIESH_EDPTR ), 1 );
00778   }
00779 
00780 #endif
00781 
00782   LALCheckMemoryLeaks();
00783   printf( "PASS: tests of LALI8CreateArraySequence and LALI8DestroyArraySequence \n" );
00784 
00785   return;
00786 }
00787 
00788 
00789 
00790 
00791 
00792 
00793 
00794 
00795 
00796 
00797 
00798 
00799 
00800 
00801 
00802 
00803 
00804 
00805 
00806 
00807 static void U2ArraySequenceFactoriesTest ( void )
00808 {
00809   CreateArraySequenceIn input;
00810   UINT4Vector dimLength;
00811   UINT4 data[] = { 2, 3, 2 };
00812   UINT4 dataBad[] = { 2, 3, 0 };
00813   static LALStatus  status;
00814   static UINT2ArraySequence  *sequence;
00815   static UINT2ArraySequence   sstore;
00816 
00817 
00818   /*
00819    *
00820    * Test ordinary behavior.
00821    *
00822    */
00823 
00824   dimLength.length = 3;
00825   dimLength.data = data;
00826   input.length = 2;
00827   input.dimLength = &dimLength;
00828 
00829   LALU2CreateArraySequence ( &status, &sequence, &input );
00830   TestStatus( &status, CODES( 0 ), 1 );
00831 
00832   memset( sequence->data, 0, sequence->length*sequence->arrayDim*sizeof( UINT2 ) );
00833 
00834   LALU2DestroyArraySequence ( &status, &sequence );
00835   TestStatus( &status, CODES( 0 ), 1 );
00836 
00837   LALCheckMemoryLeaks();
00838 
00839 
00840   /*
00841    *
00842    * Test error codes.
00843    *
00844    */
00845 
00846 #ifndef LAL_NDEBUG
00847 
00848   if ( ! lalNoDebug )
00849   {
00850     input.length = 0;
00851     LALU2CreateArraySequence ( &status, &sequence, &input );
00852     TestStatus( &status, CODES( SEQFACTORIESH_ESLENGTH ), 1 );
00853 
00854     input.length = 2;
00855     input.dimLength->data = dataBad;
00856     LALU2CreateArraySequence ( &status, &sequence, &input );
00857     TestStatus( &status, CODES( SEQFACTORIESH_EALENGTH ), 1 );
00858 
00859     LALU2CreateArraySequence ( &status, &sequence, NULL );
00860     TestStatus( &status, CODES( SEQFACTORIESH_EINPTR ), 1 );
00861 
00862     LALU2DestroyArraySequence ( &status, NULL );
00863     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00864 
00865     input.dimLength->data = data;
00866     LALU2CreateArraySequence ( &status, NULL, &input );
00867     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00868 
00869     LALU2DestroyArraySequence ( &status, &sequence );
00870     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00871 
00872     sequence = &sstore;
00873     LALU2CreateArraySequence ( &status, &sequence, &input );
00874     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00875 
00876     LALU2DestroyArraySequence ( &status, &sequence );
00877     TestStatus( &status, CODES( SEQFACTORIESH_EDPTR ), 1 );
00878   }
00879 
00880 #endif
00881 
00882   LALCheckMemoryLeaks();
00883   printf( "PASS: tests of LALU2CreateArraySequence and LALU2DestroyArraySequence \n" );
00884 
00885   return;
00886 }
00887 
00888 
00889 
00890 
00891 
00892 
00893 
00894 
00895 
00896 
00897 
00898 
00899 
00900 
00901 
00902 
00903 
00904 
00905 
00906 
00907 static void U4ArraySequenceFactoriesTest ( void )
00908 {
00909   CreateArraySequenceIn input;
00910   UINT4Vector dimLength;
00911   UINT4 data[] = { 2, 3, 2 };
00912   UINT4 dataBad[] = { 2, 3, 0 };
00913   static LALStatus  status;
00914   static UINT4ArraySequence  *sequence;
00915   static UINT4ArraySequence   sstore;
00916 
00917 
00918   /*
00919    *
00920    * Test ordinary behavior.
00921    *
00922    */
00923 
00924   dimLength.length = 3;
00925   dimLength.data = data;
00926   input.length = 2;
00927   input.dimLength = &dimLength;
00928 
00929   LALU4CreateArraySequence ( &status, &sequence, &input );
00930   TestStatus( &status, CODES( 0 ), 1 );
00931 
00932   memset( sequence->data, 0, sequence->length*sequence->arrayDim*sizeof( UINT4 ) );
00933 
00934   LALU4DestroyArraySequence ( &status, &sequence );
00935   TestStatus( &status, CODES( 0 ), 1 );
00936 
00937   LALCheckMemoryLeaks();
00938 
00939 
00940   /*
00941    *
00942    * Test error codes.
00943    *
00944    */
00945 
00946 #ifndef LAL_NDEBUG
00947 
00948   if ( ! lalNoDebug )
00949   {
00950     input.length = 0;
00951     LALU4CreateArraySequence ( &status, &sequence, &input );
00952     TestStatus( &status, CODES( SEQFACTORIESH_ESLENGTH ), 1 );
00953 
00954     input.length = 2;
00955     input.dimLength->data = dataBad;
00956     LALU4CreateArraySequence ( &status, &sequence, &input );
00957     TestStatus( &status, CODES( SEQFACTORIESH_EALENGTH ), 1 );
00958 
00959     LALU4CreateArraySequence ( &status, &sequence, NULL );
00960     TestStatus( &status, CODES( SEQFACTORIESH_EINPTR ), 1 );
00961 
00962     LALU4DestroyArraySequence ( &status, NULL );
00963     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00964 
00965     input.dimLength->data = data;
00966     LALU4CreateArraySequence ( &status, NULL, &input );
00967     TestStatus( &status, CODES( SEQFACTORIESH_EVPTR ), 1 );
00968 
00969     LALU4DestroyArraySequence ( &status, &sequence );
00970     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00971 
00972     sequence = &sstore;
00973     LALU4CreateArraySequence ( &status, &sequence, &input );
00974     TestStatus( &status, CODES( SEQFACTORIESH_EUPTR ), 1 );
00975 
00976     LALU4DestroyArraySequence ( &status, &sequence );
00977