Exemplo n.º 1
0
  void main()
  {
    test_shared_ptr();
    test01();
    test02();
    test03();
    test04();
    
    #ifdef NTL_CXX_RV
    test05();
    #endif
    test06();
    test07();
    test08();
    test09();
    test10();
    test11();
    test12();
    test14();
    test15();
    test16();
    test17();
    test18();
    test19();
    test20();
    test21();
    test22();
    test23();
    test24();
    test25();
#ifdef _CPPUNWIND
    test26();
#endif
    // TODO: "libstdc++-v3\testsuite\20_util\shared_ptr\creation" и далее
  }
int main ( )

/****************************************************************************/
/*
  Purpose:

    MAIN is the main program for CHEBYSHEV_POLYNOMIAL_PRB.

  Discussion:

    CHEBYSHEV_POLYNOMIAL_PRB tests the CHEBYSHEV_POLYNOMIAL library.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    09 August 2013

  Author:

    John Burkardt
*/
{
  timestamp ( );
  printf ( "\n" );
  printf ( "CHEBYSHEV_POLYNOMIAL_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the CHEBYSHEV_POLYNOMIAL library.\n" );

  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
  test06 ( );
  test07 ( );
  test08 ( );
  test09 ( );

  test10 ( );
  test11 ( );
  test12 ( );
  test13 ( );
  test14 ( );
  test15 ( );
  test16 ( );
  test17 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "CHEBYSHEV_POLYNOMIAL_PRB\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
Exemplo n.º 3
0
int main(int argc,char **argv)
{
   // Create a test molecule
   OpenBabel::OBMol mol;
   OpenBabel::OBAtom* a[5];
   a[0] = mol.NewAtom(); a[0]->SetAtomicNum(6);  a[0]->SetVector(-0.013,  1.086,  0.008);
   a[1] = mol.NewAtom(); a[1]->SetAtomicNum(1);  a[1]->SetVector( 0.002, -0.004,  0.002);
   a[2] = mol.NewAtom(); a[2]->SetAtomicNum(9);  a[2]->SetVector( 1.300,  1.570, -0.002);
   a[3] = mol.NewAtom(); a[3]->SetAtomicNum(35); a[3]->SetVector(-0.964,  1.737, -1.585);
   a[4] = mol.NewAtom(); a[4]->SetAtomicNum(17); a[4]->SetVector(-0.857,  1.667,  1.491);
   OpenBabel::OBBond* b;
   for (int i(1); i < 5; ++i)
   {
      b = mol.NewBond();
      b->SetBegin(a[0]); b->SetEnd(a[i]); b->SetBondOrder(1);
   }
   
   // Run the tests
   test01(&mol);
   test02(&mol);
   test03(&mol);
   test04(&mol);
   test05(&mol);
   test06(&mol);
   test07(&mol);
   test08(&mol);
   test09(&mol);
   
   // End
   return 0;
}
Exemplo n.º 4
0
void _test (CIMClient & client)
{
  try
  {
    test01 (client);
    test02 (client);
    test03 (client);
    test04 (client);
    test05 (client);
    test06 (client);
    test07 (client);
    test08 (client);
    test10 (client);
    test11 (client);
    test12 (client);
    test13 (client);
    // Don't run against the remote-namespace, not yet suppoted. 
    if (providerNamespace == "test/TestProvider")
    {
        test09 (client); // Embedded Instance Test
        test14(client); // Embedded Instance Array Test
    }
  }
  catch (Exception & e)
  {
    cerr << "test failed: " << e.getMessage () << endl;
    exit (-1);
  }
}
int main ( )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for FEM1D_BVP_LINEAR_PRB.

  Location:

    http://people.sc.fsu.edu/~jburkardt/c_src/fem1d_bvp_linear/fem1d_bvp_linear_prb.c

  Discussion:

    FEM1D_BVP_LINEAR_PRB tests the FEM1D_BVP_LINEAR library.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    16 June 2014

  Author:

    John Burkardt
*/
{
  timestamp ( );
  printf ( "\n" );
  printf ( "FEM1D_BVP_LINEAR_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the FEM1D_BVP_LINEAR library.\n" );

  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
  test06 ( );
  test07 ( );
  test08 ( );
  test09 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "FEM1D_BVP_LINEAR_PRB\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
Exemplo n.º 6
0
int spectrophoretest(int argc, char* argv[])
{
  int defaultchoice = 1;
  
  int choice = defaultchoice;

  if (argc > 1) {
    if(sscanf(argv[1], "%d", &choice) != 1) {
      printf("Couldn't parse that input as a number\n");
      return -1;
    }
  }

   // Create a test molecule
   OpenBabel::OBMol mol;
   OpenBabel::OBAtom* a[5];
   a[0] = mol.NewAtom(); a[0]->SetAtomicNum(6);  a[0]->SetVector(-0.013,  1.086,  0.008);
   a[1] = mol.NewAtom(); a[1]->SetAtomicNum(1);  a[1]->SetVector( 0.002, -0.004,  0.002);
   a[2] = mol.NewAtom(); a[2]->SetAtomicNum(9);  a[2]->SetVector( 1.300,  1.570, -0.002);
   a[3] = mol.NewAtom(); a[3]->SetAtomicNum(35); a[3]->SetVector(-0.964,  1.737, -1.585);
   a[4] = mol.NewAtom(); a[4]->SetAtomicNum(17); a[4]->SetVector(-0.857,  1.667,  1.491);
   OpenBabel::OBBond* b;
   for (int i(1); i < 5; ++i)
   {
      b = mol.NewBond();
      b->SetBegin(a[0]); b->SetEnd(a[i]); b->SetBondOrder(1);
   }
   
  switch(choice) {
  case 1:
    test01(&mol);
    test02(&mol);
    break;
  case 2:
    test03(&mol);
    test04(&mol);
    break;
  case 3:
    test05(&mol);
    test06(&mol);
    break;
  case 4:
    test07(&mol);
    test08(&mol);
    break;
  case 5:
    test09(&mol);
    break;
  default:
    std::cout << "Test number " << choice << " does not exist!\n";
    return -1;
  }

  return 0;
}
Exemplo n.º 7
0
int main ( void )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for RAND48_PRB.

  Discussion:

    RAND48_PRB calls sample problems for the RAND48 routines.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    18 August 2008

  Author:

    John Burkardt
*/
{
  timestamp ( );

  printf ( "\n" );
  printf ( "RAND48_PRB\n" );
  printf ( "  C version:\n" );
  printf ( "  Test the RAND48 library.\n" );

  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
  test06 ( );
  test07 ( );
  test08 ( );
  test09 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "RAND48_PRB\n" );
  printf ( "  Normal end of execution.\n" );

  printf ( "\n" );
  timestamp ( );

  return 0;
}
Exemplo n.º 8
0
void runCIMNameConstructorTests()
{
    // valid constructor calls
    test01();
    // UTF-8 related tests, circumvent if UTF-8 support disabled
    test02();
    test03();
    // invalid constructor calls
    test04();
    test05();
    test06();
}
Exemplo n.º 9
0
int main ( )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for WAVELET_PRB.

  Discussion:

    WAVELET_PRB tests the WAVELET library.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    09 May 2012

  Author:

    John Burkardt
*/
{
  timestamp ( );
  printf ( "\n" );
  printf ( "WAVELET_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the WAVELET library.\n" );

  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
  test06 ( );
  test07 ( );
  test08 ( );
  test09 ( );

  test10 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "WAVELET_PRB\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
Exemplo n.º 10
0
int main ( void )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for SUPER_BLAS1_S_PRB.

  Discussion:

    SUPER_BLAS1_S_PRB tests the BLAS1 single precision real routines.

  Modified:

    29 March 2007

  Author:

    John Burkardt
*/
{
  timestamp ( );

  printf ( "\n" );
  printf ( "SUPER_BLAS1_S_PRB:\n" );
  printf ( "  C version\n" );
  printf ( "  Single precision real arithmetic.\n" );
  printf ( "  Test routines in the SUPER_BLAS library,\n" );
  printf ( "  the Level 1 Basic Linear Algebra Subprograms.\n" );
 
  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
  test06 ( );
  test07 ( );
  test08 ( );
  test09 ( );

  test11 ( );

  printf ( "\n" );
  printf ( "SUPER_BLAS1_S_PRB:\n" );
  printf ( "  Normal end of execution.\n" );

  printf ( "\n" );
  timestamp ( );

  return 0;
}
Exemplo n.º 11
0
int main ( )

/******************************************************************************/
/*
  Purpose:

    COMPLEX_NUMBERS is a program which demonstrates the use of complex numbers.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    06 November 2010

  Author:

    John Burkardt
*/
{
    timestamp ( );
    printf ( "\n" );
    printf ( "COMPLEX_NUMBERS\n" );
    printf ( "  C version\n" );
    printf ( "  Demonstrate complex number usage.\n" );
    /*
      Single precision complex numbers: "complex".
    */
    test01 ( );
    test02 ( );
    test03 ( );
    /*
      Double precision complex numbers: "double complex".
    */
    test04 ( );
    test05 ( );
    test06 ( );
    /*
      Terminate.
    */
    printf ( "\n" );
    printf ( "COMPLEX_NUMBERS\n" );
    printf ( "  Normal end of execution.\n" );

    printf ( "\n" );
    timestamp ( );

    return 0;
}
Exemplo n.º 12
0
int main ( void )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for SUPER_BLAS1_S_PRB.

  Discussion:

    SUPER_BLAS1_S_PRB tests the SUPER_BLAS library.

  Modified:

    29 March 2007

  Author:

    John Burkardt
*/
{
  timestamp ( );
  printf ( "\n" );
  printf ( "SUPER_BLAS1_S_PRB:\n" );
  printf ( "  C version\n" );
  printf ( "  Single precision real arithmetic.\n" );
  printf ( "  Test the SUPER_BLAS library.\n" );
 
  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
  test06 ( );
  test07 ( );
  test08 ( );
  test09 ( );

  test11 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "SUPER_BLAS1_S_PRB:\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
Exemplo n.º 13
0
int main ( )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for FEM_BASIS_PRB.

  Discussion:

    FEM_BASIS_PRB tests the FEM_BASIS library.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    26 June 2013

  Author:

    John Burkardt
*/
{
  timestamp ( );
  printf ( "\n" );
  printf ( "FEM_BASIS_PRB:\n" );
  printf ( "  C version.\n" );
  printf ( "  Test the FEM_BASIS library.\n" );

  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
  test06 ( );
  test07 ( );
  test08 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "FEM_BASIS_PRB:\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
Exemplo n.º 14
0
int main ( void )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for TEST_MIN_PRB.

  Discussion:

    TEST_MIN_PRB calls the TEST_MIN tests.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    03 February 2012

  Author:

    John Burkardt
*/
{
  timestamp (  );

  printf ( "\n" );
  printf ( "TEST_MIN_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the TEST_MIN library.\n" );

  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
  test06 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "TEST_MIN_PRB\n" );
  printf ( "  Normal end of execution.\n" );

  printf ( "\n" );
  timestamp ( );

  return 0;
}
Exemplo n.º 15
0
void parse_cmd(String str)
{
  if(str == "help") {printHelp();}
  else if(str == "t1") {test01(RUNTEST);}
  else if(str == "t2") {test02(RUNTEST);}
  else if(str == "t3") {test03(RUNTEST);}
  else if(str == "t4") {test04(RUNTEST);}
  else if(str == "t5") {test05(RUNTEST);}
  else if(str == "t6") {test06(RUNTEST);}
  else if(str == "t7") {test07(RUNTEST);}
  else if(str == "t8") {test08(RUNTEST);}
  else if(str == "t9") {test09(RUNTEST);}
  else if(str == "ta") {test10(RUNTEST);}
  else if(str == "tb") {test11(RUNTEST);}
  else if(str == "tc") {test12(RUNTEST);}
  else if(str == "td") {test13(RUNTEST);}
  else if(str == "te") {test14(RUNTEST);}
  else if(str == "tf") {test15(RUNTEST);}

  else if(str == "d1") {test01(DESCRIPTION);}
  else if(str == "d2") {test02(DESCRIPTION);}
  else if(str == "d3") {test03(DESCRIPTION);}
  else if(str == "d4") {test04(DESCRIPTION);}
  else if(str == "d5") {test05(DESCRIPTION);}
  else if(str == "d6") {test06(DESCRIPTION);}
  else if(str == "d7") {test07(DESCRIPTION);}
  else if(str == "d8") {test08(DESCRIPTION);}
  else if(str == "d9") {test09(DESCRIPTION);}
  else if(str == "da") {test10(DESCRIPTION);}
  else if(str == "db") {test11(DESCRIPTION);}
  else if(str == "dc") {test12(DESCRIPTION);}
  else if(str == "dd") {test13(DESCRIPTION);}
  else if(str == "de") {test14(DESCRIPTION);}
  else if(str == "df") {test15(DESCRIPTION);}

  else {Serial.print("\n\rBad Command: "); Serial.println(str);}
}
Exemplo n.º 16
0
int main ( )

/******************************************************************************/
/*
  Purpose:

    GEOMPACK_PRB tests routines from the GEOMPACK library.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    23 October 2012

  Author:

    John Burkardt
*/
{
  timestamp ( );

  printf ( "\n" );
  printf ( "GEOMPACK_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the GEOMPACK library.\n" );

  test005 ( );
  test01 ( );
  test02 ( );
  test03 ( );
  test05 ( );
  test06 ( );
  test07 ( );
  test08 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "GEOMPACK_PRB\n" );
  printf ( "  Normal end of execution.\n" );

  printf ( "\n" );
  timestamp ( );

  return 0;
}
int main ( )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for BERNSTEIN_POLYNOMIAL_PRB.

  Discussion:

    BERNSTEIN_POLYNOMIAL_PRB tests the BERNSTEIN_POLYNOMIAL library.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    13 May 2013

  Author:

    John Burkardt
*/
{
  timestamp ( );
  printf ( "\n" );
  printf ( "BERNSTEIN_POLYNOMIAL_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the BERNSTEIN_POLYNOMIAL library.\n" );

  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
  test06 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "BERNSTEIN_POLYNOMIAL_PRB\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( " \n" );
  timestamp ( );

  return 0;
}
int main ( )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for HERMITE_TEST_INT_PRB.

  Discussion:

    HERMITE_TEST_INT_PRB tests the HERMITE_TEST_INT library.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    11 September 2012

  Author:

    John Burkardt
*/
{
  timestamp ( );
  printf ( "\n" );
  printf ( "HERMITE_TEST_INT_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the HERMITE_TEST_INT library.\n" );

  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
  test06 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "HERMITE_TEST_INT_PRB\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
Exemplo n.º 19
0
int main ( void )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for SUPER_BLAS1_Z_PRB.

  Discussion:

    SUPER_BLAS1_Z_PRB tests the SUPER_BLAS library.

  Modified:

    01 April 2007

  Author:

    John Burkardt
*/
{
    timestamp ( );
    printf ( "\n" );
    printf ( "SUPER_BLAS1_Z_PRB:\n" );
    printf ( "  Z version\n" );
    printf ( "  Double precision complex arithmetic,\n" );
    printf ( "  Test the SUPER_BLAS library.\n" );

    test03 ( );
    test04 ( );
    test05 ( );
    test08 ( );

    test15 ( );
    test16 ( );
    test17 ( );
    /*
      Terminate.
    */
    printf ( "\n" );
    printf ( "SUPER_BLAS1_Z_PRB:\n" );
    printf ( "  Normal end of execution.\n" );
    printf ( "\n" );
    timestamp ( );

    return 0;
}
Exemplo n.º 20
0
int main ( )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for BISECTION_RC_PRB.

  Discussion:

    BISECTION_RC_PRB tests the BISECTION_RC library.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    17 January 2015

  Author:

    John Burkardt
*/
{
  timestamp ( );
  printf ( "\n" );
  printf ( "BISECTION_RC_PRB:\n" );
  printf ( "  C version.\n" );
  printf ( "  Test the BISECTION_RC library.\n" );

  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "BISECTION_RC_PRB:\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
Exemplo n.º 21
0
int main(void)
{
   test01();
   test02();
   test03();
   test04();
   test05();
   test06();
   test07();
   test08();
   test09();
   test10();
   test11();
   test12();
   test13();
   test14();
   test15();
   test16();
   test17();
   return 0;
}
Exemplo n.º 22
0
void printHelp(void)
{
  Serial.println("Tests:");
   Serial.print("  "); test01(TESTHELP); Serial.println();
   Serial.print("  "); test02(TESTHELP); Serial.println();
   Serial.print("  "); test03(TESTHELP); Serial.println();
   Serial.print("  "); test04(TESTHELP); Serial.println();
   Serial.print("  "); test05(TESTHELP); Serial.println();
   Serial.print("  "); test06(TESTHELP); Serial.println();
   Serial.print("  "); test07(TESTHELP); Serial.println();
   Serial.print("  "); test08(TESTHELP); Serial.println();
   Serial.print("  "); test09(TESTHELP); Serial.println();
   Serial.print("  "); test10(TESTHELP); Serial.println();
   Serial.print("  "); test11(TESTHELP); Serial.println();
   Serial.print("  "); test12(TESTHELP); Serial.println();
   Serial.print("  "); test13(TESTHELP); Serial.println();
   Serial.print("  "); test14(TESTHELP); Serial.println();
   Serial.print("  "); test15(TESTHELP); Serial.println();
   Serial.print("  "); test16(TESTHELP); Serial.println();
   Serial.println();
}
Exemplo n.º 23
0
int main(int argc, char** argv)
{
    verbose = getenv("PEGASUS_TEST_VERBOSE");
    try
    {
        test01();
        test02();
        test03();
        test04();
        test05();
    }
    catch (Exception& e)
    {
        cout << "Exception: " << e.getMessage() << endl;
        exit(1);
    }

    cout << argv[0] << " +++++ passed all tests" << endl;

    return 0;
}
Exemplo n.º 24
0
int main(int, char** argv)
{
    verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false;

    try
    {
        test01();
        test02();
        test03();
        test04();
        test05();
        test06();
        test07();
        test08();

        cout << argv[0] << " +++++ passed all tests" << endl;
    }
    catch (Exception& e)
    {
        cerr << argv[0] << " Exception " << e.getMessage() << endl;
        exit(1);
    }
    return 0;
}
Exemplo n.º 25
0
int main ( void )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for TOMS655_PRB.

  Discussion:

    TOMS655_PRB calls a set of problems for DIVDIF.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    11 January 2010

  Author:

    John Burkardt
*/
{
  double alpha;
  double beta;
  int kind;
  int nt;

  timestamp ( );

  printf ( "\n" );
  printf ( "TOMS655_PRB\n" );
  printf ( "  C version\n" );
  printf ( "\n" );
  printf ( "  Tests for the routines in the TOMS655 library.\n" );
 
  test01 ( );
  test02 ( );
  test03 ( );
  test04 ( );
  test05 ( );
  test06 ( );
  test07 ( );
  test08 ( );
  test09 ( );
/*
  Compute 15 points of an example of each rule.
*/
  for ( kind = 1; kind <= 8; kind++ )
  {
    nt = 15;
    if ( kind == 8 )
    {
      alpha = 1.0;
      beta = - alpha - 2 * nt - 2;
    }
    else
    {
      alpha = 0.0;
      beta = 0.0;
    }
    test10 ( nt, kind, alpha, beta );
  }

  printf ( "\n" );
  printf ( "TOMS655_PRB\n" );
  printf ( "  Normal end of execution.\n" );

  printf ( "\n" );
  timestamp ( );

  return 0;
}
Exemplo n.º 26
0
int main(void)
{
    test05();
    
    return 0;
}
Exemplo n.º 27
0
int main ( )

/******************************************************************************/
/*
  Purpose:

    MAIN is the main program for SPARSE_GRID_CC_PRB.

  Discussion:

    SPARSE_GRID_CC_PRB tests the SPARSE_GRID_CC library.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    12 March 2013

  Author:

    John Burkardt

  Reference:

    Fabio Nobile, Raul Tempone, Clayton Webster,
    A Sparse Grid Stochastic Collocation Method for Partial Differential
    Equations with Random Input Data,
    SIAM Journal on Numerical Analysis,
    Volume 46, Number 5, 2008, pages 2309-2345.
*/
{
  int dim_max;
  int dim_min;
  int dim_num;
  int level_max;
  int level_max_max;
  int level_max_min;

  timestamp ( );
  printf ( "\n" );
  printf ( "SPARSE_GRID_CC_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the SPARSE_GRID_CC library.\n" );
/*
  Count number of points in sparse rule from DIM_MIN to DIM_MAX, LEVEL_MAX_MAX.
*/
  dim_min = 1;
  dim_max = 5;
  level_max_min = 0;
  level_max_max = 10;
  test01 ( dim_min, dim_max, level_max_min, level_max_max );

  printf ( "\n" );
  timestamp ( );

  dim_min = 6;
  dim_max = 10;
  level_max_min = 0;
  level_max_max = 10;
  test01 ( dim_min, dim_max, level_max_min, level_max_max );

  printf ( "\n" );
  timestamp ( );

  dim_min = 100;
  dim_max = 100;
  level_max_min = 0;
  level_max_max = 4;
  test01 ( dim_min, dim_max, level_max_min, level_max_max );

  printf ( "\n" );
  timestamp ( );
/*
  Count number of points in sparse rule from DIM_MIN to DIM_MAX, LEVEL_MAX_MAX.
*/
  dim_min = 1;
  dim_max = 5;
  level_max_min = 0;
  level_max_max = 10;
  test015 ( dim_min, dim_max, level_max_min, level_max_max );

  printf ( "\n" );
  timestamp ( );

  dim_min = 6;
  dim_max = 10;
  level_max_min = 0;
  level_max_max = 10;
  test015 ( dim_min, dim_max, level_max_min, level_max_max );

  printf ( "\n" );
  timestamp ( );

  dim_min = 100;
  dim_max = 100;
  level_max_min = 0;
  level_max_max = 4;
  test015 ( dim_min, dim_max, level_max_min, level_max_max );

  printf ( "\n" );
  timestamp ( );
/*
  Compute abstract grid indices of sparse grid points as selected from product grid
  for DIMENSION, LEVEL_MAX.
*/
  test02 ( 2, 3 );
  test02 ( 2, 4 );
  test02 ( 3, 0 );
  test02 ( 3, 2 );
  test02 ( 6, 2 );
/*
  Compute sparse Clenshaw-Curtis rule for DIMENSION, LEVEL_MAX.
*/
  test03 ( 2, 3 );
  test03 ( 3, 0 );
  test03 ( 3, 1 );
/*
  Test sum of weights for DIMENSION, LEVEL_MAX.
*/
  test04 ( 2, 4 );
  test04 ( 3, 0 );
  test04 ( 3, 1 );
  test04 ( 3, 6 );
  test04 ( 10, 3 );
/*
  Test monomial exactness for DIMENSION, LEVEL_MAX, DEGREE_MAX.
*/ 
  test05 ( 2, 0, 3 );
  test05 ( 2, 1, 5 );
  test05 ( 2, 2, 7 );
  test05 ( 2, 3, 9 );
  test05 ( 2, 4, 11 );
  test05 ( 2, 5, 13 );
  
  test05 ( 3, 0, 2 );
  test05 ( 3, 1, 4 );
  test05 ( 3, 2, 6 );
  test05 ( 3, 3, 8 );
/*
  Show how to write a rule to a file.
*/
  dim_num = 2;
  level_max = 3;

  test06 ( dim_num, level_max );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "SPARSE_GRID_CC_PRB\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );
  
  return 0;
}
Exemplo n.º 28
0
int main(int argc, char *argv[])
{
#define BITMAP_BLOCKS	10

	struct dev *dev = &(struct dev){ .bits = 3 };
	/* This expect buffer is never reclaimed */
	init_buffers(dev, 1 << 20, 1);

	block_t volblocks = BITMAP_BLOCKS << (dev->bits + 3);
	struct sb *sb = rapid_sb(dev);
	sb->super = INIT_DISKSB(dev->bits, volblocks);
	setup_sb(sb, &sb->super);

	test_init(argv[0]);

	struct inode *bitmap = rapid_open_inode(sb, NULL, 0);
	sb->bitmap = bitmap;

	/* Setup buffers for bitmap */
	for (int block = 0; block < BITMAP_BLOCKS; block++) {
		struct buffer_head *buffer = blockget(bitmap->map, block);
		memset(bufdata(buffer), 0, sb->blocksize);
		set_buffer_clean(buffer);
		blockput(buffer);
	}

	/* Set fake backend mark to modify backend objects. */
	tux3_start_backend(sb);

	if (test_start("test01"))
		test01(sb, BITMAP_BLOCKS);
	test_end();

	if (test_start("test02"))
		test02(sb, BITMAP_BLOCKS);
	test_end();

	if (test_start("test03"))
		test03(sb, BITMAP_BLOCKS);
	test_end();

	if (test_start("test04"))
		test04(sb, BITMAP_BLOCKS);
	test_end();

	if (test_start("test05"))
		test05(sb, BITMAP_BLOCKS);
	test_end();

	if (test_start("test06"))
		test06(sb, BITMAP_BLOCKS);
	test_end();

	if (test_start("test07"))
		test07(sb, BITMAP_BLOCKS);
	test_end();

	if (test_start("test08"))
		test08(sb, BITMAP_BLOCKS);
	test_end();

	tux3_end_backend();

	clean_main(sb);

	return test_failures();
}
Exemplo n.º 29
0
int main()
{
    templtextkeeper::TemplTextKeeper tt;

    tt.init( "templates.csv" );

    auto info = tt.get_templates();

    std::cout << "all templates:\n" << std::endl;

    for( auto & e : info )
    {
        for( auto & l : e.second.localized_templ_info )
        {
            std::cout << e.first << ";" << e.second.name << ";" << lang_tools::to_string_iso( l.first ) << ";" << l.second.id << ";" << l.second.name << ";" << std::endl;
        }

        if( e.second.localized_templ_info.empty() )
        {
            std::cout << e.first << ";" << e.second.name << ";" << std::endl;
        }
    }

    std::cout << "\ntests:\n" << std::endl;

    for( unsigned int i = 1; i <= 12; ++i )
    {
        if( tt.has_template( i ) )
        {
            const templtext::Templ & t = tt.get_template( i );
            std::cout << "templ " << i << " - " << t.get_template() << " " << show_placeholders( t.get_placeholders() ) << std::endl;
        }
    }

    const templtext::Templ & t = tt.get_template( 6 );

    test02( t );
    test03( t );
    test04( t );
    test05( t );
    test06( t );

    /*
    templtext::extract_function("$foo()");
    templtext::extract_function("$foo(A)");
    templtext::extract_function("$foo(AB)");
    templtext::extract_function("$foo(AB,C)");
    templtext::extract_function("$foo(AB,CD)");
    templtext::extract_function("$foo(AB,CD,E)");
    templtext::extract_function("$foo(AB,CD,EF)");
    templtext::extract_function("$foo( A )");
    templtext::extract_function("$foo( AB )");
    templtext::extract_function("$foo( AB,C )");
    templtext::extract_function("$foo( AB,CD )");
    templtext::extract_function("$foo( AB,CD,E )");
    templtext::extract_function("$foo( AB,CD,EF )");
    templtext::extract_function("$foo( A )");
    templtext::extract_function("$foo( AB )");
    templtext::extract_function("$foo( AB, C )");
    templtext::extract_function("$foo( AB, CD )");
    templtext::extract_function("$foo( AB, CD, E )");
    templtext::extract_function("$foo( AB, CD, EF )");

    templtext::find_function("some text $foo( A ) what do think?");
    templtext::find_function("some text $bar( A ) with several functions $bar( B )?");
    */

    return 0;
}