"Fossies" - the Fresh Open Source Software Archive

Member "PerlCDF38_0/testPerlCDFsi.pl" (19 Nov 2019, 20499 Bytes) of package /linux/misc/PerlCDF38_0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "testPerlCDFsi.pl" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 36_4_vs_37_0.

    1 #!/usr/bin/perl -w
    2 #
    3 # testPerlCDFsi
    4 #
    5 #   This program tests the PerlCDF standard interface.  PerlCDF must be installed.
    6 #   See README.
    7 #
    8 #  Usage:
    9 #     perl testPerlCDFsi.pl
   10 #
   11 # Written By:
   12 #
   13 #    Version 1.0
   14 #    Modified by: Michael Liu  - 08 August, 1998
   15 #    Version 2.0
   16 #    Modified by: Michael Liu  - 07 January, 2005
   17 #
   18 #############################################################################
   19 #
   20 #  Translated from qst2c.c v. 1.10 by J. Love
   21 #
   22 #  Differences include:
   23 #     maxiumum records written is a variable
   24 #     Arrays are all 1 Dimensional.  2 dimensionality handled within CDF.
   25 #     Added section confirming rVARs recCount, etc.
   26 #     Added a few informational messages
   27 #     Tests Epoch routines
   28 # Note: As Perl uses double, a variable of data type CDF_REAL4/FLOAT will 
   29 #   cause some minor value deviation due to different floating-point type 
   30 #   representations. If the value is returned from the CDF's C routine 
   31 #   and compared with Perl value, an epsilon is used for checkng their
   32 #   equality. 10**(-9) is used for double and 10**(-5) for 
   33 #   float/real. No problem for CDF_REAL8 data type.
   34 #     
   35 #############################################################################
   36 
   37 use strict;
   38 use Math::BigInt;
   39 
   40 BEGIN { unshift @INC,'/home/liu/PerlCDF38_0/blib/arch',
   41                      '/home/liu/PerlCDF38_0/blib/lib'; }
   42 use CDF;
   43 
   44 my $N_DIMS = 2;
   45 my $DIM_0_SIZE = 2;
   46 my $DIM_1_SIZE = 3;
   47 
   48 my $encoding = &NETWORK_ENCODING;
   49 my $actual_encoding = &NETWORK_ENCODING;
   50 my $majority = &ROW_MAJOR;
   51 my $numDims = $N_DIMS;
   52 my @dimSizes = ( $DIM_0_SIZE, $DIM_1_SIZE );
   53 my $varDataType = &CDF_INT2;
   54 my $varNumElements = 1 ;
   55 my @varValues = (1,2,3,4,5,6);
   56 my $recNum = 0 ;
   57 my $recStart = 0 ;
   58 my $recCount = 1 ;
   59 my $recInterval = 1 ;
   60 my @counts = ( $DIM_0_SIZE, $DIM_1_SIZE );
   61 my @intervals = ( 1, 1 );
   62 my $entryNum = 2 ;
   63 my $attrScope = &GLOBAL_SCOPE ;
   64 my $entryDataType = &CDF_INT2 ;
   65 my $entryDataTypeNew = &CDF_UINT2 ;
   66 my $entryNumElems = 1 ;
   67 my $entry1NumElems = 6 ;
   68 my $entryValue = 1 ;
   69 my @entry1Values = (1,2,3,4,5,6);
   70 my $varRecVariance = &VARY ;
   71 my @varDimVariances = ( &VARY, &VARY );
   72 my $varName = "VAR1a";
   73 my $new_varName = "VAR1b";
   74 my $attrName = "ATTR1";
   75 my $attr2Name = "ATTR2";
   76 my $new_attrName = "ATTR1a";
   77 my $rEntryValue =  4 ;
   78 
   79 #############################################################################
   80 # Display title.
   81 #############################################################################
   82 
   83 print "\nTesting Perl-CDF Standard/C interface\n\n";
   84 
   85 #############################################################################
   86 # Create CDF.
   87 #############################################################################
   88 # Uncomment the following line if you want to create a V2.7 CDF file.
   89 # CDF::CDFsetFileBackward(1);
   90 
   91 my $id; my $status;
   92 $status = CDF::CDFcreate("YEST",$numDims,\@dimSizes,$encoding,$majority,\$id);
   93 if ($status < &CDF_OK) {
   94   if ($status == &CDF_EXISTS) {
   95     $status = CDF::CDFopen("YEST", \$id);
   96     QuitCDF("1.0", $status) if ($status < &CDF_OK) ;
   97 
   98     $status = CDF::CDFdelete($id);
   99     QuitCDF ("1.1", $status) if ($status < &CDF_OK) ;
  100     $status = CDF::CDFcreate("YEST",$numDims,\@dimSizes,$encoding,$majority,
  101                                 \$id);
  102     QuitCDF ("1.2", $status) if ($status < &CDF_OK) ;
  103   }
  104   else {
  105     QuitCDF ("1.3", $status);
  106     }
  107 }
  108 
  109 # Uncomment the following line if the MD5 checksum option is needed.
  110 # CDF::CDFsetChecksum($id, MD5_CHECKSUM);
  111 
  112 #############################################################################
  113 # Create variables and set/confirm cache sizes, etc.
  114 #############################################################################
  115 
  116 my $varNum_out;
  117 $status = CDF::CDFvarCreate($id,$varName,$varDataType,$varNumElements,
  118                   $varRecVariance,\@varDimVariances,
  119                   \$varNum_out); 
  120 QuitCDF ("2.0a", $status) if ($status < &CDF_OK) ;
  121 
  122 #############################################################################
  123 # PUT to variables.
  124 #############################################################################
  125 my $var_num = CDF::CDFvarNum($id,$varName);
  126 my ($x0, $x1, $i, @indices, $temp1);
  127 for ($x0 = 0; $x0 < $DIM_0_SIZE; $x0++) {
  128    for ($x1 = 0; $x1 < $DIM_1_SIZE; $x1++) {
  129       $indices[0] = $x0;
  130       $indices[1] = $x1;
  131       $temp1 = $varValues[$x0*$DIM_1_SIZE + $x1];
  132       $status = CDF::CDFvarPut($id,$var_num,$recNum,\@indices,\$temp1);
  133       QuitCDF ("8.1", $status) if ($status < &CDF_OK) ;
  134 
  135    }
  136 }
  137 
  138 #############################################################################
  139 # GET from the variables.
  140 #############################################################################
  141 
  142 my $varValue_out;
  143 for ($x0 = 0; $x0 < $DIM_0_SIZE; $x0++) {
  144    for ($x1 = 0; $x1 < $DIM_1_SIZE; $x1++) {
  145       $indices[0] = $x0;
  146       $indices[1] = $x1;
  147       $status = CDF::CDFvarGet($id,$var_num,$recNum,\@indices,
  148                      \$varValue_out);
  149       QuitCDF ("9.0", $status) if ($status < &CDF_OK) ;
  150 
  151       QuitCDF ("9.1", $status) if ($varValue_out != $varValues[$x0*$DIM_1_SIZE + $x1]) ;
  152    }
  153  }
  154 
  155 #############################################################################
  156 # HyperPUT to the variables.
  157 #############################################################################
  158 
  159 for ($x0 = 0; $x0 < $DIM_0_SIZE; $x0++) {
  160    for ($x1 = 0; $x1 < $DIM_1_SIZE; $x1++) {
  161       $varValues[$x0*$DIM_1_SIZE + $x1] = -$varValues[$x0*$DIM_1_SIZE + $x1];
  162    }
  163  }
  164 
  165 $indices[0] = 0;
  166 $indices[1] = 0;
  167 $status = CDF::CDFvHpPut($id,$var_num,$recStart,$recCount,$recInterval,
  168                 \@indices,\@counts,\@intervals,\@varValues);
  169 QuitCDF ("10.0", $status) if ($status < &CDF_OK) ;
  170 
  171 ############################################################################g
  172 # HyperGET from variables.
  173 #############################################################################
  174 
  175 my @varBuffer_out;
  176 $status = CDF::CDFvHpGet($id,$var_num,$recStart,$recCount,$recInterval,
  177                                 \@indices,\@counts,\@intervals,\@varBuffer_out);
  178 QuitCDF ("11.0", $status) if ($status < &CDF_OK) ;
  179 
  180 for ($x0 = 0; $x0 < $DIM_0_SIZE; $x0++) {
  181    for ($x1 = 0; $x1 < $DIM_1_SIZE; $x1++) {
  182     QuitCDF ("11.1", $status) if ($varBuffer_out[$x0*$DIM_1_SIZE + $x1] != $varValues[$x0*$DIM_1_SIZE + $x1]);
  183    }
  184   }
  185   
  186 #############################################################################
  187 # Create attributes.
  188 #############################################################################
  189 
  190 my $attrNum_out;
  191 $status = CDF::CDFattrCreate($id,$attrName, $attrScope, \$attrNum_out);
  192 QuitCDF ("12.0", $status) if ($status < &CDF_OK) ;
  193 
  194 $status = CDF::CDFattrCreate($id,$attr2Name, $attrScope, \$attrNum_out);
  195 QuitCDF ("12.1", $status) if ($status < &CDF_OK) ;
  196 
  197 #############################################################################
  198 # PUT to attributes.
  199 #############################################################################
  200 my $attr_num;
  201 $attr_num = CDF::CDFattrNum($id,$attrName);
  202 $status = CDF::CDFattrPut($id,$attr_num,$entryNum,$entryDataType,
  203                             $entryNumElems,\$entryValue);
  204 QuitCDF ("13.0", $status) if ($status < &CDF_OK) ;
  205 
  206 $attr_num = CDF::CDFattrNum($id,$attr2Name);
  207 $status = CDF::CDFattrPut($id,$attr_num,$entryNum,$entryDataType,
  208                             $entry1NumElems,\@entry1Values);
  209 QuitCDF ("13.5", $status) if ($status < &CDF_OK) ;
  210 
  211 #############################################################################
  212 # GET from attributes.
  213 #############################################################################
  214 
  215 my ($entryValue_out, @entry_out_Values);
  216 $attr_num = CDF::CDFattrNum($id,$attrName);
  217 $status = CDF::CDFattrGet($id,$attr_num,$entryNum,\$entryValue_out);
  218 
  219 QuitCDF ("14.0", $status) if ($status < &CDF_OK) ;
  220 
  221 QuitCDF ("14.1", $status) if ($entryValue != $entryValue_out) ;
  222 $attr_num = CDF::CDFattrNum($id,$attr2Name);
  223 $status = CDF::CDFattrGet($id,$attr_num,$entryNum,\@entry_out_Values);
  224 for ($i=0; $i<$entry1NumElems; $i++) {
  225   QuitCDF ("13.5a", $status) if ($entry1Values[$i] != $entry_out_Values[$i]);
  226 }
  227 
  228 #############################################################################
  229 # Get CDF documentation.
  230 #############################################################################
  231 
  232 my ($version_out, $release_out, $CopyRightText);
  233 $status = CDF::CDFdoc ($id,\$version_out,\$release_out,\$CopyRightText);
  234 QuitCDF ("15.0", $status) if ($status < &CDF_OK) ;
  235 print "CDF Library Version $version_out, Release $release_out
  236 $CopyRightText\n";
  237 
  238 #############################################################################
  239 # Inquire CDF.
  240 #############################################################################
  241 
  242 my ($formatOut, $numDims_out, @dimSizes_out, $encoding_out, $majority_out);
  243 my ($maxRec_out, $numRvars, $numZvars, $numAttrs_out);
  244 $status = CDF::CDFinquire($id,\$numDims_out,\@dimSizes_out,\$encoding_out,
  245                 \$majority_out,\$maxRec_out,\$numRvars,
  246                             \$numAttrs_out);
  247 QuitCDF ("16.0", $status) if ($status < &CDF_OK) ;
  248 
  249 QuitCDF ("16.1", $status) if ($numDims_out != $numDims) ;
  250 
  251 my $x;
  252 for ($x = 0; $x < $N_DIMS; $x++) {
  253    QuitCDF ("16.2", $status) if ($dimSizes_out[$x] != $dimSizes[$x]) ;
  254    }
  255 QuitCDF ("16.3", $status) if ($encoding_out != $actual_encoding) ;
  256 QuitCDF ("16.4", $status) if ($majority_out != $majority) ;
  257 QuitCDF ("16.5", $status) if ($maxRec_out != 0) ;
  258 QuitCDF ("16.6", $status) if ($numRvars != 1) ;
  259 QuitCDF ("16.7", $status) if ($numAttrs_out != 2) ;
  260 
  261 #############################################################################
  262 # Rename variables.
  263 #############################################################################
  264 
  265 $status = CDF::CDFvarRename($id,$var_num,$new_varName);
  266 QuitCDF ("17.0a", $status) if ($status < &CDF_OK) ;
  267 
  268 #
  269 #############################################################################
  270 # Inquire variables.
  271 #############################################################################
  272 $var_num = CDF::CDFvarNum($id,$new_varName);
  273 my ($varName_out, $varDataType_out, $varNumElements_out, $varRecVariance_out);
  274 my (@varDimVariances_out);
  275 $status = CDF::CDFvarInquire($id,$var_num,\$varName_out,
  276                    \$varDataType_out,\$varNumElements_out,
  277                    \$varRecVariance_out,\@varDimVariances_out);
  278 QuitCDF ("18.0", $status) if ($status < &CDF_OK) ;
  279 
  280 QuitCDF ("18.1", $status) if ($varName_out ne $new_varName) ;
  281 QuitCDF ("18.2", $status) if ($varDataType_out != $varDataType) ;
  282 B
  283 QuitCDF ("18.3", $status) if ($varNumElements_out != $varNumElements) ;
  284 QuitCDF ("18.4", $status) if ($varRecVariance_out != $varRecVariance) ;
  285 
  286 my $dim_n;
  287 for ($dim_n = 0; $dim_n < $numDims; $dim_n++) {
  288    if ($varDimVariances_out[$dim_n] != $varDimVariances[$dim_n]) {
  289      QuitCDF ("18.5", $status);
  290    }
  291 }
  292 
  293 #############################################################################
  294 # Close variable
  295 #############################################################################
  296 $status = CDF::CDFvarClose ($id, $var_num);
  297 QuitCDF ("19.0", $status) if ($status < &CDF_OK);
  298 
  299 #############################################################################
  300 # Rename attribute.
  301 #############################################################################
  302 $attr_num = CDF::CDFattrNum($id,$attrName);
  303 $status = CDF::CDFattrRename($id,$attr_num,$new_attrName);
  304 QuitCDF ("20.0", $status) if ($status < &CDF_OK) ;
  305 
  306 #############################################################################
  307 # Inquire attribute.
  308 #############################################################################
  309 
  310 my ($attrName_out, $attrScope_out, $maxEntry_out);
  311 $attr_num = CDF::CDFattrNum($id,$new_attrName);
  312 $status = CDF::CDFattrInquire($id,$attr_num,\$attrName_out,\$attrScope_out,
  313                     \$maxEntry_out);
  314 QuitCDF ("22.0", $status) if ($status < &CDF_OK) ;
  315 
  316 QuitCDF ("22.1", $status) if ($attrName_out ne $new_attrName) ;
  317 QuitCDF ("22.2", $status) if ($attrScope_out != $attrScope) ;
  318 QuitCDF ("22.3", $status) if ($maxEntry_out != $entryNum) ;
  319 QuitCDF ("22.4", $status) if ($attrNum_out != 1) ;
  320 
  321 #############################################################################
  322 # Inquire attribute entries.
  323 #############################################################################
  324 
  325 my ($entryDataType_out, $entryNumElems_out);
  326 $status = CDF::CDFattrEntryInquire($id,$attr_num,$entryNum,
  327                          \$entryDataType_out,\$entryNumElems_out);
  328 QuitCDF ("23.0", $status) if ($status < &CDF_OK) ;
  329 
  330 QuitCDF ("23.1", $status) if ($entryDataType_out != $entryDataType) ;
  331 QuitCDF ("23.2", $status) if ($entryNumElems_out != $entryNumElems) ;
  332 
  333 #############################################################################
  334 # Get error text.
  335 #############################################################################
  336 
  337 my $errorText;
  338 $status = CDF::CDFerror(CDF_OK,\$errorText);
  339          
  340 QuitCDF ("24.0", $status) if ($status < &CDF_OK) ;
  341 
  342 #############################################################################
  343 # Close CDF.
  344 #############################################################################
  345 
  346 $status = CDF::CDFclose($id);
  347 QuitCDF ("25.0", $status) if ($status < &CDF_OK) ;
  348 
  349 #############################################################################
  350 # Test Epoch Routines
  351 #############################################################################
  352 print "Test Epoch...\n";
  353 
  354 my $year = 1994;
  355 my $month = 10;
  356 my $day = 13;
  357 my $hour = 1;
  358 my $minute = 2;
  359 my $second = 3;
  360 my $msec = 987;
  361 my $epoch = CDF::computeEPOCH ($year, $month, $day, $hour, $minute, $second, $msec);
  362 
  363 my $epString0True = '13-Oct-1994 01:02:03.987';
  364 my $epString1True = '19941013.0431017';
  365 my $epString2True = '19941013010203';
  366 my $epString3True = '1994-10-13T01:02:03.987Z';
  367 my $epString4True = '1994-10-13T01:02:03.987';
  368 
  369 my ($epString, $epString1, $epString2, $epString3, $epString4);
  370 #CDF::encodeEPOCH ($epoch, $epString);
  371 CDF::toEncodeEPOCH ($epoch, 0, $epString);
  372 QuitEPOCH ("30.0") if ($epString ne $epString0True);
  373 
  374 #CDF::encodeEPOCH1 ($epoch, $epString1);
  375 CDF::toEncodeEPOCH ($epoch, 1, $epString1);
  376 QuitEPOCH ("30.1") if ($epString1 ne $epString1True);
  377 
  378 #CDF::encodeEPOCH2 ($epoch, $epString2);
  379 CDF::toEncodeEPOCH ($epoch, 2, $epString2);
  380 QuitEPOCH ("30.2") if ($epString2 ne $epString2True);
  381 
  382 #CDF::encodeEPOCH3 ($epoch, $epString3);
  383 CDF::toEncodeEPOCH ($epoch, 3, $epString3);
  384 QuitEPOCH ("30.3") if ($epString3 ne $epString3True);
  385 
  386 #CDF::encodeEPOCH4 ($epoch, $epString4);
  387 CDF::toEncodeEPOCH ($epoch, 4, $epString4);
  388 QuitEPOCH ("30.4") if ($epString4 ne $epString4True);
  389 
  390 my $epochOut = CDF::parseEPOCH ($epString);
  391 QuitEPOCH ("31.0") if ($epochOut != $epoch) ;
  392 
  393 my ($yearOut, $monthOut, $dayOut, $hourOut, $minuteOut, $secondOut, $msecOut);
  394 CDF::EPOCHbreakdown ($epoch, $yearOut, $monthOut, $dayOut, $hourOut, $minuteOut,
  395         $secondOut, $msecOut);
  396 QuitEPOCH ("32.1") if ($yearOut != $year) ;
  397 QuitEPOCH ("32.2") if ($monthOut != $month) ;
  398 QuitEPOCH ("32.3") if ($dayOut != $day) ;
  399 QuitEPOCH ("32.4") if ($hourOut != $hour) ;
  400 QuitEPOCH ("32.5") if ($minuteOut != $minute) ;
  401 QuitEPOCH ("32.6") if ($secondOut != $second) ;
  402 QuitEPOCH ("32.7") if ($msecOut != $msec) ;
  403 
  404 #############################################################################
  405 # Test Epoch16 Routines
  406 #############################################################################
  407 print "Test Epoch16...\n";
  408 
  409 my $usec = 876;
  410 my $nsec = 765;
  411 my $psec = 654;
  412 my @epoch16;
  413 my $retco = CDF::computeEPOCH16 ($year, $month, $day, $hour, $minute, $second,
  414                                  $msec, $usec, $nsec, $psec, \@epoch16);
  415 
  416 my $ep16String0True = '13-Oct-1994 01:02:03.987.876.765.654';
  417 my $ep16String1True = '19941013.043101711536640';
  418 my $ep16String2True = '19941013010203';
  419 my $ep16String3True = '1994-10-13T01:02:03.987.876.765.654Z';
  420 my $ep16String4True = '1994-10-13T01:02:03.987876765654';
  421 
  422 my ($ep16String, $ep16String1, $ep16String2, $ep16String3, $ep16String4);
  423 
  424 #CDF::encodeEPOCH16 (\@epoch16, $ep16String);
  425 CDF::toEncodeEPOCH16 (\@epoch16, 0, $ep16String);
  426 QuitEPOCH ("40.0") if ($ep16String ne $ep16String0True);
  427 
  428 #CDF::encodeEPOCH16_1 (\@epoch16, $ep16String1);
  429 CDF::toEncodeEPOCH16 (\@epoch16, 1, $ep16String1);
  430 #print "encodeEPOCH16_1:$ep16String1";
  431 QuitEPOCH ("40.1") if ($ep16String1 ne $ep16String1True);
  432 
  433 #CDF::encodeEPOCH16_2 (\@epoch16, $ep16String2);
  434 CDF::toEncodeEPOCH16 (\@epoch16, 2, $ep16String2);
  435 QuitEPOCH ("40.2") if ($ep16String2 ne $ep16String2True);
  436 
  437 #CDF::encodeEPOCH16_3 (\@epoch16, $ep16String3);
  438 CDF::toEncodeEPOCH16 (\@epoch16, 3, $ep16String3);
  439 QuitEPOCH ("40.3") if ($ep16String3 ne $ep16String3True);
  440 
  441 #CDF::encodeEPOCH16_4 (\@epoch16, $ep16String4);
  442 CDF::toEncodeEPOCH16 (\@epoch16, 4, $ep16String4);
  443 QuitEPOCH ("40.4") if ($ep16String4 ne $ep16String4True);
  444 
  445 my @epoch16Out;
  446 $retco = CDF::parseEPOCH16 ($ep16String, \@epoch16Out);
  447 QuitEPOCH ("41.0") if ($epoch16Out[0] != $epoch16[0]) ;
  448 QuitEPOCH ("41.1") if ($epoch16Out[1] != $epoch16[1]) ;
  449 
  450 my ($year16Out, $month16Out, $day16Out, $hour16Out, $minute16Out,
  451     $second16Out, $msec16Out, $usec16Out, $nsec16Out, $psec16Out);
  452 
  453 CDF::EPOCH16breakdown (\@epoch16, $year16Out, $month16Out, $day16Out,
  454                        $hour16Out, $minute16Out, $second16Out, $msec16Out,
  455                        $usec16Out, $nsec16Out, $psec16Out);
  456 
  457 QuitEPOCH ("42.0") if ($year16Out != $year) ;
  458 QuitEPOCH ("42.1") if ($month16Out != $month) ;
  459 QuitEPOCH ("42.2") if ($day16Out != $day) ;
  460 QuitEPOCH ("42.3") if ($hour16Out != $hour) ;
  461 QuitEPOCH ("42.4") if ($minute16Out != $minute) ;
  462 QuitEPOCH ("42.5") if ($second16Out != $second) ;
  463 QuitEPOCH ("42.6") if ($msec16Out != $msec) ;
  464 QuitEPOCH ("42.7") if ($usec16Out != $usec) ;
  465 QuitEPOCH ("42.8") if ($nsec16Out != $nsec) ;
  466 QuitEPOCH ("42.9") if ($psec16Out != $psec) ;
  467 
  468 #############################################################################
  469 # Test TT2000 Routines
  470 #############################################################################
  471 print "Test TT2000...\n";
  472 $year = 2010;
  473 
  474 my $tt2000 = CDF::computeTT2000 ($year, $month, $day, $hour, $minute,  
  475                                  $second, $msec, $usec, $nsec);
  476 my $ttString0True = '13-Oct-2010 01:02:03.987876765';
  477 my $ttString3True = '2010-10-13T01:02:03.987876765';
  478 my $ttString4True = '2010-10-13T01:02:03.987876765Z';
  479 my ($ttString, $ttString3, $ttString4, $tt2000Out);
  480 
  481 #CDF::encodeTT2000 ($tt2000, $ttString, 0);
  482 CDF::toEncodeTT2000 ($tt2000, 0, $ttString);
  483 QuitEPOCH ("50.0") if ($ttString ne $ttString0True);
  484 #CDF::encodeTT2000 ($tt2000, $ttString3);
  485 CDF::toEncodeTT2000 ($tt2000, 3, $ttString3);
  486 QuitEPOCH ("50.1") if ($ttString3 ne $ttString3True);
  487 #CDF::encodeTT2000 ($tt2000, $ttString3, 4);
  488 CDF::toEncodeTT2000 ($tt2000, 4, $ttString4);
  489 QuitEPOCH ("50.2") if ($ttString4 ne $ttString4True);
  490 
  491 #$tt2000Out = CDF::parseTT2000 ($ttString3);
  492 $tt2000Out = CDF::toParseTT2000 ($ttString);
  493 QuitEPOCH ("51.0") if ($tt2000Out != $tt2000) ;
  494 $tt2000Out = CDF::toParseTT2000 ($ttString3);
  495 QuitEPOCH ("51.1") if ($tt2000Out != $tt2000) ;
  496 $tt2000Out = CDF::toParseTT2000 ($ttString4);
  497 QuitEPOCH ("51.2") if ($tt2000Out != $tt2000) ;
  498 
  499 my ($usecOut, $nsecOut);
  500 CDF::TT2000breakdown ($tt2000, $yearOut, $monthOut, $dayOut, $hourOut, 
  501                       $minuteOut, $secondOut, $msecOut, $usecOut, $nsecOut);
  502 QuitEPOCH ("52.1") if ($yearOut != $year) ;
  503 QuitEPOCH ("52.2") if ($monthOut != $month) ;
  504 QuitEPOCH ("52.3") if ($dayOut != $day) ;
  505 QuitEPOCH ("52.4") if ($hourOut != $hour) ;
  506 QuitEPOCH ("52.5") if ($minuteOut != $minute) ;
  507 QuitEPOCH ("52.6") if ($secondOut != $second) ;
  508 QuitEPOCH ("52.7") if ($msecOut != $msec) ;
  509 QuitEPOCH ("52.8") if ($usecOut != $usec) ;
  510 QuitEPOCH ("52.9") if ($nsecOut != $nsec) ;
  511 
  512 #############################################################################
  513 # Successful completion.
  514 #############################################################################
  515 print "All tests completed successfully\n";
  516 exit;
  517 
  518 
  519 
  520 #############################################################################
  521 # QuitCDF.
  522 #############################################################################
  523 sub QuitCDF {
  524     my ($where, $status)=@_;
  525 
  526   print "Aborting at $where ...\n";
  527   if ($status < &CDF_OK) {
  528     my $text;
  529     CDF::CDFlib (&SELECT_, &CDF_STATUS_, $status,
  530            &GET_, &STATUS_TEXT_, \$text,
  531            &NULL_);
  532     print $text;
  533   }
  534   CDF::CDFlib (&CLOSE_, &CDF_,
  535       &NULL_);
  536   print "...test aborted.\n";
  537   exit;
  538     
  539 }#endsub QuitCDF
  540 
  541 #############################################################################
  542 #  QuitEPOCH
  543 #############################################################################
  544 sub QuitEPOCH {
  545     my ($where)=@_;
  546   print "Aborting at $where...test aborted.\n";
  547   exit;
  548 
  549 }#endsub QuitEPOCH