home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / Programming / ICU / src / icu / source / test / intltest / tchcfmt.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-19  |  18.6 KB  |  597 lines

  1.  
  2. /*
  3. ********************************************************************
  4. * COPYRIGHT: 
  5. * (C) Copyright Taligent, Inc., 1997
  6. * (C) Copyright International Business Machines Corporation, 1997 - 1998
  7. * Licensed Material - Program-Property of IBM - All Rights Reserved. 
  8. * US Government Users Restricted Rights - Use, duplication, or disclosure 
  9. * restricted by GSA ADP Schedule Contract with IBM Corp. 
  10. *
  11. ********************************************************************
  12. */
  13.  
  14.  
  15. #include "utypes.h"
  16.  
  17. #include "intltest.h"
  18. #include "tchcfmt.h"
  19.  
  20. #include "msgfmt.h"
  21. #include "choicfmt.h"
  22.  
  23. #include <float.h>
  24.  
  25. // tests have obvious memory leaks!
  26.  
  27. static bool_t chkstatus( UErrorCode &status, char* msg = NULL )
  28. {
  29.     bool_t ok = U_SUCCESS(status);
  30.     if (!ok) it_errln( msg );
  31.     return ok;
  32. }
  33.  
  34. void
  35. TestChoiceFormat::TestSimpleExample( void )
  36. {
  37.     double limits[] = {1,2,3,4,5,6,7};
  38.     UnicodeString monthNames[] = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
  39.     ChoiceFormat* form = new ChoiceFormat(limits, monthNames, 7);
  40.     ParsePosition parse_pos;
  41.     // TODO Fix this ParsePosition stuff...
  42.     UnicodeString str;
  43.     UnicodeString res1, res2;
  44.     UErrorCode status;
  45.     FieldPosition fpos(0);
  46.     Formattable f;
  47.     //for (double i = 0.0; i <= 8.0; ++i) {
  48.     for (int32_t ix = 0; ix <= 8; ++ix) {
  49.         double i = ix; //nos
  50.         status = U_ZERO_ERROR;
  51.         fpos = 0;
  52.         str = "";
  53.         res1 = form->format(i, str, fpos, status );
  54.         if (!chkstatus( status, "***  test_simple_example format" )) {
  55.             delete form;
  56.             return;
  57.         }
  58.         //form->parse(res1, f, parse_pos);
  59.         res2 = " ??? ";
  60.         it_out << ix << " -> " << res1 << " -> " << res2 << endl;
  61.     }
  62.     delete form;
  63. }
  64.  
  65. void
  66. TestChoiceFormat::TestComplexExample( void )
  67. {
  68.     UErrorCode status = U_ZERO_ERROR;
  69.     const double filelimits[] = {0,1,2};
  70.     const UnicodeString filepart[] = {"are no files","is one file","are {2} files"};
  71.  
  72.     ChoiceFormat* fileform = new ChoiceFormat( filelimits, filepart, 3);
  73.  
  74.     if (!fileform) { 
  75.         it_errln("***  test_complex_example fileform"); 
  76.         return; 
  77.     }
  78.  
  79.     Format* filenumform = NumberFormat::createInstance( status );
  80.     if (!filenumform) { 
  81.         it_errln("***  test_complex_example filenumform"); 
  82.         delete fileform;
  83.         return; 
  84.     }
  85.     if (!chkstatus( status, "***  test_simple_example filenumform" )) {
  86.         delete fileform;
  87.         delete filenumform;
  88.         return;
  89.     }
  90.  
  91.     //const Format* testFormats[] = { fileform, NULL, filenumform };
  92.     //pattform->setFormats( testFormats, 3 );
  93.  
  94.     MessageFormat* pattform = new MessageFormat("There {0} on {1}", status );
  95.     if (!pattform) { 
  96.         it_errln("***  test_complex_example pattform"); 
  97.         delete fileform;
  98.         delete filenumform;
  99.         return; 
  100.     }
  101.     if (!chkstatus( status, "***  test_complex_example pattform" )) {
  102.         delete fileform;
  103.         delete filenumform;
  104.         delete pattform;
  105.         return;
  106.     }
  107.  
  108.     pattform->setFormat( 0, *fileform );
  109.     pattform->setFormat( 2, *filenumform );
  110.  
  111.  
  112.     Formattable testArgs[] = {T_INT32(0), "Disk_A", T_INT32(0)};
  113.     UnicodeString str;
  114.     UnicodeString res1, res2;
  115.     pattform->toPattern( res1 );
  116.     it_out << "MessageFormat toPattern: " << res1 << endl;
  117.     fileform->toPattern( res1 );
  118.     it_out << "ChoiceFormat toPattern: " << res1 << endl;
  119.     if (res1 == "0.0#are no files|1.0#is one file|2.0#are {2} files") {
  120.         it_out << "toPattern tested!" << endl;
  121.     }else{
  122.         it_errln("***  ChoiceFormat to Pattern result!");
  123.     }
  124.  
  125.     FieldPosition fpos(0);
  126.  
  127.     UnicodeString checkstr[] = { 
  128.         "There are no files on Disk_A",
  129.         "There is one file on Disk_A",
  130.         "There are 2 files on Disk_A",
  131.         "There are 3 files on Disk_A"
  132.     };
  133.  
  134.     if (status != U_ZERO_ERROR) return;
  135.  
  136.     int32_t i;
  137.     for (i = 0; i < 4; ++i) {
  138.         str = "";
  139.         status = U_ZERO_ERROR;
  140.         testArgs[0] = Formattable((int32_t)i);
  141.         testArgs[2] = testArgs[0];
  142.         res2 = pattform->format(testArgs, 3, str, fpos, status );
  143.         if (!chkstatus( status, "***  test_complex_example format" )) {
  144.             delete fileform;
  145.             delete filenumform;
  146.             delete pattform;
  147.             return;
  148.         }
  149.         it_out << i << " -> " << res2 << endl;
  150.         if (res2 != checkstr[i]) {
  151.             it_errln("***  test_complex_example res string");
  152.             it_out << "*** " << i << " -> '" << res2 << "' unlike '" << checkstr[i] << "' ! " << endl;
  153.         }
  154.     }
  155.     it_out << endl;
  156.  
  157.     it_out << "------ additional testing in complex test ------" << endl << endl;
  158.     //
  159.     int32_t retCount;
  160.     const double* retLimits = fileform->getLimits( retCount );
  161.     if ((retCount == 3) && (retLimits)
  162.     && (retLimits[0] == 0.0)
  163.     && (retLimits[1] == 1.0)
  164.     && (retLimits[2] == 2.0)) {
  165.         it_out << "getLimits tested!" << endl;
  166.     }else{
  167.         it_errln("***  getLimits unexpected result!");
  168.     }
  169.  
  170.     const UnicodeString* retFormats = fileform->getFormats( retCount );
  171.     if ((retCount == 3) && (retFormats)
  172.     && (retFormats[0] == "are no files") 
  173.     && (retFormats[1] == "is one file")
  174.     && (retFormats[2] == "are {2} files")) {
  175.         it_out << "getFormats tested!" << endl;
  176.     }else{
  177.         it_errln("***  getFormats unexpected result!");
  178.     }
  179.  
  180.     UnicodeString checkstr2[] = { 
  181.         "There is no folder on Disk_A",
  182.         "There is one folder on Disk_A",
  183.         "There are many folders on Disk_A",
  184.         "There are many folders on Disk_A"
  185.     };
  186.  
  187.     fileform->applyPattern("0#is no folder|1#is one folder|2#are many folders", status );
  188.     if (status == U_ZERO_ERROR) it_out << "status applyPattern OK!" << endl;
  189.     if (!chkstatus( status, "***  test_complex_example pattform" )) {
  190.         delete fileform;
  191.         delete filenumform;
  192.         delete pattform;
  193.         return;
  194.     }
  195.     pattform->setFormat( 0, *fileform );
  196.     fpos = 0;
  197.     for (i = 0; i < 4; ++i) {
  198.         str = "";
  199.         status = U_ZERO_ERROR;
  200.         testArgs[0] = Formattable((int32_t)i);
  201.         testArgs[2] = testArgs[0];
  202.         res2 = pattform->format(testArgs, 3, str, fpos, status );
  203.         if (!chkstatus( status, "***  test_complex_example format 2" )) {
  204.             delete fileform;
  205.             delete filenumform;
  206.             delete pattform;
  207.             return;
  208.         }
  209.         it_out << i << " -> " << res2 << endl;
  210.         if (res2 != checkstr2[i]) {
  211.             it_errln("***  test_complex_example res string");
  212.             it_out << "*** " << i << " -> '" << res2 << "' unlike '" << checkstr2[i] << "' ! " << endl;
  213.         }
  214.     }
  215.  
  216.     double nd = ChoiceFormat::nextDouble( 1.0 );
  217.     double pd = ChoiceFormat::previousDouble( 1.0 );
  218.     if ((ChoiceFormat::nextDouble( 1.0, TRUE ) == nd)
  219.      && (ChoiceFormat::nextDouble( 1.0, FALSE ) == pd)) {
  220.         it_out << "nextDouble(x, TRUE) and nextDouble(x, FALSE) tested" << endl;
  221.     }else{
  222.         it_errln("***  nextDouble( x, BOOL )");
  223.     }
  224.     if ((nd > 1.0) && (nd < 1.0001)) {
  225.         it_out << "nextDouble(x) tested" << endl;
  226.     }else{
  227.         it_errln("***  nextDouble");
  228.     }
  229.     if ((pd < 1.0) && (pd > 0.9999)) {
  230.         it_out << "prevDouble(x) tested" << endl;
  231.     }else{
  232.         it_errln("***  prevDouble");
  233.     }
  234.  
  235.  
  236.     const double limits_A[] = {1,2,3,4,5,6,7};
  237.     const UnicodeString monthNames_A[] = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat"};
  238.     ChoiceFormat* form_A = new ChoiceFormat(limits_A, monthNames_A, 7);
  239.     ChoiceFormat* form_A2 = new ChoiceFormat(limits_A, monthNames_A, 7);
  240.     const double limits_B[] = {1,2,3,4,5,6,7};
  241.     const UnicodeString monthNames_B[] = {"Sun","Mon","Tue","Wed","Thur","Fri","Sat_BBB"};
  242.     ChoiceFormat* form_B = new ChoiceFormat(limits_B, monthNames_B, 7);
  243.     if (!form_A || !form_B || !form_A2) {
  244.         it_errln("***  test-choiceFormat not allocatable!");
  245.     }else{
  246.         if (*form_A == *form_A2) {
  247.             it_out << "operator== tested." << endl;
  248.         }else{
  249.             it_errln("***  operator==");
  250.         }
  251.  
  252.         if (*form_A != *form_B) {
  253.             it_out << "operator!= tested." << endl;
  254.         }else{
  255.             it_errln("***  operator!=");
  256.         }
  257.  
  258.         ChoiceFormat* form_A3 = (ChoiceFormat*) form_A->clone();
  259.         if (!form_A3) {
  260.             it_errln("***  ChoiceFormat->clone is nil.");
  261.         }else{
  262.             if ((*form_A3 == *form_A) && (*form_A3 != *form_B)) {
  263.                 it_out << "method clone tested." << endl;
  264.             }else{
  265.                 it_errln("***  ChoiceFormat clone or operator==, or operator!= .");
  266.             }
  267.         }
  268.  
  269.         ChoiceFormat form_Assigned( *form_A );
  270.         bool_t ok = (form_Assigned == *form_A) && (form_Assigned != *form_B);
  271.         form_Assigned = *form_B;
  272.         ok = ok && (form_Assigned != *form_A) && (form_Assigned == *form_B);
  273.         if (ok) {
  274.             it_out << "copy constructor and operator= tested." << endl;
  275.         }else{
  276.             it_errln("***  copy constructor or operator= or operator == or operator != .");
  277.         }
  278.         delete form_A3;
  279.     }
  280.     
  281.  
  282.     delete form_A; delete form_A2; delete form_B; 
  283.  
  284.     char* testPattern = "0#none|1#one|2#many";
  285.     ChoiceFormat form_pat( testPattern, status );
  286.     if (!chkstatus( status, "***  ChoiceFormat contructor( newPattern, status)" )) {
  287.         delete fileform;
  288.         delete filenumform;
  289.         delete pattform;
  290.         return;
  291.     }
  292.  
  293.     form_pat.toPattern( res1 );
  294.     if (res1 == "0.0#none|1.0#one|2.0#many") {
  295.         it_out << "ChoiceFormat contructor( newPattern, status) tested" << endl;
  296.     }else{
  297.         it_errln("***  ChoiceFormat contructor( newPattern, status) or toPattern result!");
  298.     }
  299.  
  300.     double* d_a = new double[2];
  301.     if (!d_a) { it_errln("*** allocation error."); return; }
  302.     d_a[0] = 1.0; d_a[1] = 2.0;
  303.  
  304.     UnicodeString* s_a = new UnicodeString[2];
  305.     if (!s_a) { it_errln("*** allocation error."); return; }
  306.     s_a[0] = "first"; s_a[1] = "second";
  307.  
  308.     form_pat.adoptChoices( d_a, s_a, 2 );
  309.     form_pat.toPattern( res1 );
  310.     it_out << "ChoiceFormat adoptChoices toPattern: " << res1 << endl;
  311.     if (res1 == "1.0#first|2.0#second") {
  312.         it_out << "ChoiceFormat adoptChoices tested" << endl;
  313.     }else{
  314.         it_errln("***  ChoiceFormat adoptChoices result!");
  315.     }
  316.  
  317.     double d_a2[] = { 3.0, 4.0 };
  318.     UnicodeString s_a2[] = { "third", "forth" };
  319.  
  320.     form_pat.setChoices( d_a2, s_a2, 2 );
  321.     form_pat.toPattern( res1 );
  322.     it_out << "ChoiceFormat adoptChoices toPattern: " << res1 << endl;
  323.     if (res1 == "3.0#third|4.0#forth") {
  324.         it_out << "ChoiceFormat adoptChoices tested" << endl;
  325.     }else{
  326.         it_errln("***  ChoiceFormat adoptChoices result!");
  327.     }
  328.  
  329.     str = "";
  330.     fpos = 0;
  331.     status = U_ZERO_ERROR;
  332.     double arg_double = 3.0;
  333.     res1 = form_pat.format( arg_double, str, fpos );
  334.     it_out << "ChoiceFormat format:" << res1 << endl;
  335.     if (res1 != "third") it_errln("***  ChoiceFormat format (double, ...) result!");
  336.  
  337.     str = "";
  338.     fpos = 0;
  339.     status = U_ZERO_ERROR;
  340.     int32_t arg_long = 3;
  341.     res1 = form_pat.format( arg_long, str, fpos );
  342.     it_out << "ChoiceFormat format:" << res1 << endl;
  343.     if (res1 != "third") it_errln("***  ChoiceFormat format (int32_t, ...) result!");
  344.  
  345.     Formattable ft( T_INT32(3) );
  346.     str = "";
  347.     fpos = 0;
  348.     status = U_ZERO_ERROR;
  349.     res1 = form_pat.format( ft, str, fpos, status );
  350.     if (!chkstatus( status, "***  test_complex_example format (int32_t, ...)" )) {
  351.         delete fileform;
  352.         delete filenumform;
  353.         delete pattform;
  354.         return;
  355.     }
  356.     it_out << "ChoiceFormat format:" << res1 << endl;
  357.     if (res1 != "third") it_errln("***  ChoiceFormat format (Formattable, ...) result!");
  358.  
  359.     Formattable fta[] = { T_INT32(3) };
  360.     str = "";
  361.     fpos = 0;
  362.     status = U_ZERO_ERROR;
  363.     res1 = form_pat.format( fta, 1, str, fpos, status );
  364.     if (!chkstatus( status, "***  test_complex_example format (int32_t, ...)" )) {
  365.         delete fileform;
  366.         delete filenumform;
  367.         delete pattform;
  368.         return;
  369.     }
  370.     it_out << "ChoiceFormat format:" << res1 << endl;
  371.     if (res1 != "third") it_errln("***  ChoiceFormat format (Formattable[], cnt, ...) result!");
  372.  
  373.     ParsePosition parse_pos = 0;
  374.     Formattable result;
  375.     UnicodeString parsetext("third");
  376.     form_pat.parse( parsetext, result, parse_pos );
  377.     double rd = (result.getType() == Formattable::kLong) ? result.getLong() : result.getDouble();
  378.     if (rd == 3.0) {
  379.         it_out << "parse( ..., ParsePos ) tested." << endl;
  380.     }else{
  381.         it_errln("*** ChoiceFormat parse( ..., ParsePos )!");
  382.     }
  383.  
  384.     form_pat.parse( parsetext, result, status );
  385.     rd = (result.getType() == Formattable::kLong) ? result.getLong() : result.getDouble();
  386.     if (rd == 3.0) {
  387.         it_out << "parse( ..., UErrorCode ) tested." << endl;
  388.     }else{
  389.         it_errln("*** ChoiceFormat parse( ..., UErrorCode )!");
  390.     }
  391.  
  392.     /*
  393.     UClassID classID = ChoiceFormat::getStaticClassID();
  394.     if (classID == form_pat.getDynamicClassID()) {
  395.         it_out << "getStaticClassID and getDynamicClassID tested." << endl;
  396.     }else{
  397.         it_errln("*** getStaticClassID and getDynamicClassID!");
  398.     }
  399.     */
  400.  
  401.     it_out << endl;
  402.  
  403.     delete fileform; 
  404.     delete filenumform;
  405.     delete pattform;
  406. }
  407.  
  408. /**
  409.  * test the use of next_Double with ChoiceFormat
  410.  **/
  411. void
  412. TestChoiceFormat::TestChoiceNextDouble()
  413. {
  414.  
  415.     double limit[] = {0.0, 1.0, 2.0};
  416.     const UnicodeString formats[] = {"0.0<=Arg<=1.0",
  417.                                "1.0<Arg<2.0",
  418.                                "2.0<Arg"};
  419.     limit[1] = ChoiceFormat::nextDouble( limit[1] );
  420.     ChoiceFormat *cf = new ChoiceFormat(limit, formats, 3);
  421.     FieldPosition status(0);
  422.     UnicodeString toAppendTo;
  423.     cf->format(T_INT32(1.0), toAppendTo, status);
  424.     if (toAppendTo != "0.0<=Arg<=1.0") {
  425.         it_errln("ChoiceFormat cmp in testBug1");
  426.     }
  427.     it_out <<  toAppendTo << endl;
  428.     delete cf;
  429. }
  430.  
  431.  
  432. /*
  433.  * Return a random double (---Copied here from tsnmfmt.h---)
  434.  **/
  435. static double randDouble()
  436. {
  437.     // Assume 8-bit (or larger) rand values.  Also assume
  438.     // that the system rand() function is very poor, which it always is.
  439.     double d;
  440.     int32_t i;
  441.     for (i=0; i < sizeof(double); ++i)
  442.     {
  443.         char* poke = (char*)&d;
  444.         poke[i] = (rand() & 0xFF);
  445.     }
  446.     return d;
  447. }
  448.  
  449. /** 
  450.  * test the numerical results of next_Double and previous_Double
  451.  **/
  452. void
  453. TestChoiceFormat::TestGapNextDouble()
  454. {
  455.  
  456.     double val;
  457.     int32_t i;
  458.     
  459.     //test area between -15 and 15
  460.     logln("TestChoiceFormat::TestGapNextDouble: ----- testing area between -15 and 15...");
  461.     val = -15.0;
  462.     while (val < 15.0) {
  463.         testValue( val );
  464.         val += 0.31;
  465.     }
  466.     
  467.     //test closely +/- n values around zero
  468.     logln("TestChoiceFormat::TestGapNextDouble: ----- testing closely +/- n values around zero...");
  469.     int32_t test_n;
  470.     if (quick) {
  471.         test_n = 25;
  472.     } else {
  473.         test_n = 1000;
  474.     }
  475.     val = 0.0;
  476.     for (i = 0; i < test_n; i++ ) {
  477.         testValue( val );
  478.         val = ChoiceFormat::nextDouble( val );
  479.     }
  480.     for (i = 0; i < (test_n + test_n); i++ ) {
  481.         testValue( val );
  482.         val = ChoiceFormat::previousDouble( val );
  483.     }
  484.     for (i = 0; i < test_n; i++ ) {
  485.         testValue( val );
  486.         val = ChoiceFormat::nextDouble( val );
  487.     }
  488.     if (val != 0.0) {
  489.         errln("*** TestMessageFormat::TestGapNextDouble didn't come back to zero!");
  490.     }
  491.  
  492.     // random numbers
  493.     logln("TestChoiceFormat::TestGapNextDouble: ----- testing random numbers...");
  494.     if (quick) {
  495.         test_n = 25;
  496.     } else {
  497.         test_n = 5000;
  498.     }
  499.     srand(0);           // use common starting point to make test reproducable
  500.     double negTestLimit = -DBL_MAX / 2.0; // has to be larger than this (not larger or  equal)
  501.     double posTestLimit = DBL_MAX / 2.0; // has to be smaller than this (not smaller or equal)
  502.     for (i = 0; i < test_n; i++) {
  503.         val = randDouble();
  504.         if ((val > negTestLimit) && (val < posTestLimit)) {
  505.             testValue( val );
  506.         }
  507.     }
  508.  
  509.     // extreme positive values
  510.     logln("TestChoiceFormat::TestGapNextDouble: ----- testing extreme positive values...");
  511.     val = ChoiceFormat::previousDouble( posTestLimit );
  512.     testValue( val );
  513.     val = ChoiceFormat::nextDouble( DBL_MIN );
  514.     testValue( val );
  515.     val = ChoiceFormat::previousDouble( DBL_MIN );
  516.     //logln((UnicodeString) "prev MIN: " + val );
  517.     testValue( val );
  518.     val = DBL_MIN;
  519.     testValue( val );
  520.  
  521.  
  522.     // extreme negative values
  523.     logln("TestChoiceFormat::TestGapNextDouble: ----- testing extreme negative values...");
  524.     val = ChoiceFormat::nextDouble( negTestLimit );
  525.     testValue( val );
  526.     val = ChoiceFormat::previousDouble( -DBL_MIN );
  527.     testValue( val );
  528.     val = ChoiceFormat::nextDouble( -DBL_MIN );
  529.     //logln((UnicodeString) "next -MIN: " + val );
  530.     testValue( val );
  531.     val = -DBL_MIN;
  532.     testValue( val );
  533.  
  534.     it_out << "MSG: nextDouble & previousDouble tested." << endl;
  535. }
  536.  
  537. void foo (double* bar) {}
  538.  
  539. /** 
  540.  * test a value for TestGapNextDouble
  541.  **/
  542. void
  543. TestChoiceFormat::testValue( double val )
  544. {
  545.     double valnext = ChoiceFormat::nextDouble( val );
  546.     double valprev = ChoiceFormat::previousDouble( val );
  547.  
  548.     if (val >= valnext) {
  549.         errln( (UnicodeString)
  550.             "*** TestChoiceFormat::testValue #1 nextDouble returns same or smaller value for:" + val );
  551.         return;
  552.     }
  553.  
  554.     if (val <= valprev) {
  555.         errln( (UnicodeString)
  556.             "*** TestChoiceFormat::testValue #2 PreviousDouble returns same or larger value for:" + val );
  557.         return;
  558.     }
  559.  
  560.     double middle;    
  561.     double *middlePtr = &middle;
  562.     *middlePtr = (val + valnext) / 2.0;
  563.     foo(middlePtr); 
  564.     if ((*middlePtr != val) && (*middlePtr != valnext)) {
  565.         errln( (UnicodeString)
  566.             "*** TestChoiceFormat::testValue #3 WARNING: There seems to be a gap for:" + val );
  567.         return;
  568.     }
  569.  
  570.     *middlePtr = (val + valprev) / 2.0;
  571.     foo(middlePtr);
  572.  
  573.     if ((*middlePtr != val) && (*middlePtr != valprev)) {
  574.          errln( (UnicodeString)
  575.             "*** TestChoiceFormat::testValue #4 WARNING: There seems to be a gap for:" + val );
  576.         return;
  577.     }
  578. }
  579.  
  580.  
  581. void TestChoiceFormat::runIndexedTest( int32_t index, bool_t exec, char* &name, char* par )
  582. {
  583.     switch (index) {
  584.         case 0: name = "TestSimpleExample"; 
  585.                 if (exec) logln("TestSuite Format/ChoiceFormat/Simple (f/chc/simple): ");
  586.                 if (exec) TestSimpleExample(); 
  587.                 break;
  588.         case 1: name = "TestComplexExample"; 
  589.                 if (exec) logln("TestSuite Format/ChoiceFormat/Complex (f/chc/complex): ");
  590.                 if (exec) TestComplexExample(); 
  591.                 break;
  592.         case 2: name = "TestChoiceNextDouble"; if (exec) TestChoiceNextDouble(); break;
  593.         case 3: name = "TestGapNextDouble"; if (exec) TestGapNextDouble(); break;
  594.         default: name = ""; break; //needed to end loop
  595.     }
  596. }
  597.