コード例 #1
0
int main ( )

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

    MAIN is the main program for PYRAMID_INTEGRALS_PRB.

  Discussion:

    PYRAMID_INTEGRALS_PRB tests the PYRAMID_INTEGRALS library.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    13 April 2014

  Author:

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

  test01 ( );
  test02 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "PYRAMID_INTEGRALS_PRB\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
コード例 #2
0
int main ( int argc, char *argv[] )

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

    MAIN is the main program for PPMA_IO_PRB.

  Discussion:

    PPMA_IO_PRB tests the PPMA_IO library.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    27 May 2011

  Author:

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

  test01 ( );
  test02 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "PPMA_IO_PRB:\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
コード例 #3
0
ファイル: qwv_prb.c プロジェクト: johannesgerer/jburkardt-c
int main ( )

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

    MAIN is the main program for QWV_PRB.

  Discussion:

    QWV_PRB tests the QWV library.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    20 February 2014

  Author:

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

  test01 ( );
  test02 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "QWV_PRB:\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
コード例 #4
0
ファイル: qls_prb.cpp プロジェクト: Vishakha6/jburkardt-cpp
int main ( )

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

    MAIN is the main program for QLS_PRB.

  Discussion:

    QLS_PRB tests the QUADRATURE_LEAST_SQUARES library.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    14 March 2014

  Author:

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

  test01 ( );
  test02 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "QLS_PRB\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
コード例 #5
0
ファイル: ns3de_prb.c プロジェクト: lavrovd/jburkardt-c
int main ( )

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

    NS3DE_PRB tests the NS3DE library.

  Location:

    http://people.sc.fsu.edu/~jburkardt/c_src/navier_stokes_3d_exact/ns3de_prb.c

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    17 January 2015

  Author:

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

    test01 ( );
    test02 ( );
    /*
      Terminate.
    */
    printf ( "\n" );
    printf ( "NS3DE_PRB\n" );
    printf ( "  Normal end of execution.\n" );
    timestamp ( );

    return 0;
}
コード例 #6
0
int main ( void )

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

    MAIN tests the TEST_INTERP_2D library.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    04 October 2012

  Author:

    John Burkardt
*/
{
  timestamp ( );

  printf ( "\n" );
  printf ( "TEST_INTERP_2D_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the TEST_INTERP_2D library.\n" );
  printf ( "  The R8LIB library is also required.\n" );

  test01 ( );
  test02 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "TEST_INTERP_2D_PRB\n" );
  printf ( "  Normal end of execution.\n" );

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

  return 0;
}
コード例 #7
0
ファイル: fallocate04.c プロジェクト: karabijavad/ltp
int main(int argc, char *argv[])
{
    int lc;

    tst_parse_opts(argc, argv, options, help);

    setup();

    for (lc = 0; TEST_LOOPING(lc); ++lc) {
        test01();
        test02();
        test03();
        test04();
    }

    cleanup();

    tst_exit();
}
コード例 #8
0
ファイル: toms179_prb.c プロジェクト: spino327/jburkardt-c
int main ( void )

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

    MAIN is the main program for TOMS179_PRB.

  Discussion:

    TOMS179_PRB calls the TOMS179 routines.

  Modified:

    30 January 2008

  Author:

    John Burkardt
*/
{
  timestamp ( );

  printf ( "\n" );
  printf ( "TOMS179_PRB:\n" );
  printf ( "  C version\n" );
  printf ( "  Test the TOMS179 library.\n" );

  test01 ( );
  test02 ( );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "TOMS179_PRB:\n" );
  printf ( "  Normal end of execution.\n" );

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

  return 0;
}
コード例 #9
0
int main ( int argc, char** argv )

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

    MAIN is the main program for MICE_READER.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    29 April 2013

  Author:

    John Burkardt
*/
{
  timestamp ( );
  printf ( "\n" );
  printf ( "MICE_READER:\n" );
  printf ( "  C version\n" );
  printf ( "  Read a file of strings, one line at a time.\n" );

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

  return 0;
}
コード例 #10
0
int main(void)
{
   test01();
   test02();
   test03();
   test04();
   test05();
   test06();
   test07();
   test08();
   test09();
   test10();
   test11();
   test12();
   test13();
   test14();
   test15();
   test16();
   test17();
   return 0;
}
コード例 #11
0
ファイル: InstanceDecl.cpp プロジェクト: ncultra/Pegasus-2.5
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;
}
コード例 #12
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();
}
コード例 #13
0
int main ( void )

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

    FFTW3_PRB demonstrates the use of FFTW3.

  Modified:

    05 November 2007

  Author:

    John Burkardt
*/
{
  timestamp ( );

  printf ( "\n" );
  printf ( "FFTW3_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the FFTW3 library.\n" );

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

  return 0;
}
コード例 #14
0
ファイル: IPC.cpp プロジェクト: ncultra/Pegasus-2.5
int main(int argc, char** argv)
{
    verbose = (getenv("PEGASUS_TEST_VERBOSE")) ? true : false;

    for (Uint32 loop=0; loop<10; loop++)
    {
        test01();
    }
    if (verbose)
        cout << "+++++ passed test 1" << endl; 

    for (Uint32 loop=0; loop<10; loop++)
    {
        test02();
    }
    if (verbose)
        cout << "+++++ passed test 2" << endl; 

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

    return 0;
}
コード例 #15
0
int main ( void )

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

    CYCLIC_REDUCTION_PRB calls the CYCLIC_REDUCTION tests.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    10 May 2010

  Author:

    John Burkardt
*/
{
  timestamp ( );
  printf ( "\n" );
  printf ( "CYCLIC_REDUCTION_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the routines in the CYCLIC_REDUCTION library.\n" );

  test02 ( );
  test03 ( );

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

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

  return 0;
}
コード例 #16
0
ファイル: ResponseData.cpp プロジェクト: deleisha/neopegasus
int main (int argc, char *argv[])
{

    CIMClass CIM_TESTClass2;

    verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false;

    try
    {
        testSizeMethod();
        testMoveMethod01();
        testClearMethod();
        test02();

    }
    catch (CIMException& e)
    {
        cerr << endl << "CIMException: "
             << e.getMessage() << endl << endl ;
        exit(-1);
    }

    catch (Exception& e)
    {
        cout << endl << "Exception: "
             << e.getMessage() << endl << endl ;
        exit(-1);
    }
    catch (...)
    {
        cout << endl << "Unkown excetption!" << endl << endl;
        exit(-1);
    }

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

}
int MEKD_Test_Debug_Ghosts_Test0()
{
	/// TEST 0
	if( Show_Description ) cout << "\n -- STARTING TEST 0 -- \n";
	const unsigned int Nr_of_models = 4;
	double ME[Nr_of_models];
	MEKD test01(8.0, ""), test02(8.0, "");
	
	string model[Nr_of_models];
	model[0] = "ggSpin2Mh";	//8
	model[1] = "ggSpin2Pm";	//10
	model[2] = "ggSpin2Pm";	//8
	model[3] = "ggSpin2Mh";	//10
	
	if( Show_Description ) cout << "Testing ME ordering using int computeME( string, vector<double*>, vector<int>, double& );\n";
	
	if( (error_value=test01.computeME( model[0], Set_Of_Arrays, Set_Of_IDs, ME[0] )) != 0 ) cout << "ERROR CODE in ME for " << model[0] << "; Err: " << error_value << endl;
	if( (error_value=test01.computeME( model[1], Set_Of_Arrays, Set_Of_IDs, ME[1] )) != 0 ) cout << "ERROR CODE in ME for " << model[1] << "; Err: " << error_value << endl;
	if( (error_value=test02.computeME( model[2], Set_Of_Arrays, Set_Of_IDs, ME[2] )) != 0 ) cout << "ERROR CODE in ME for " << model[2] << "; Err: " << error_value << endl;
	if( (error_value=test02.computeME( model[3], Set_Of_Arrays, Set_Of_IDs, ME[3] )) != 0 ) cout << "ERROR CODE in ME for " << model[3] << "; Err: " << error_value << endl;

	if( Show_Basic_Data )
	{
		if( Show_Description ) cout << "Initial results, before any permutation.\n";
		cout.width( 20 );
		cout << std::left << "Model" << std::right << "ME value\n\n";

		for( unsigned int count=0; count < Nr_of_models; count++ )
		{
			cout.width( 20 );
			cout << std::left << model[count] << std::right << ME[count] << endl;
		}
	}
	
	
	return 0;
}
コード例 #18
0
ファイル: Reference.cpp プロジェクト: brunolauze/pegasus
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;
}
コード例 #19
0
int main ( int argc, char *argv[] )

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

    MAIN is the main program for DOT_PRODUCT.

  Discussion:

    This program illustrates how a vector dot product could be set up
    in a C program using OpenMP.

  Licensing:

    This code is distributed under the GNU LGPL license. 

  Modified:

    18 April 2009

  Author:

    John Burkardt
*/
{
  double factor;
  int i;
  int n;
  double wtime;
  double *x;
  double xdoty;
  double *y;

  omp_sched_t myschedule;
  char schedstring[20];
  int mychunk;

  printf ( "\n" );
  printf ( "DOT_PRODUCT\n" );
  printf ( "  C/OpenMP version\n" );
  printf ( "\n" );
  printf ( "  A program which computes a vector dot product.\n" );

  printf ( "\n" );
  printf ( "  Number of processors available = %d\n", omp_get_num_procs ( ) );
  printf ( "  Number of threads =              %d\n", omp_get_max_threads ( ) );

  omp_get_schedule ( &myschedule, &mychunk );
  switch (myschedule) {
    case omp_sched_static:
                 strcpy(schedstring, "Static");
                 break;
    case omp_sched_dynamic:
                 strcpy(schedstring, "Dynamic");
                 break;
    case omp_sched_guided:
                 strcpy(schedstring, "Guided");
                 break;
    case omp_sched_auto:
                 strcpy(schedstring, "Auto");
                 break;
  }
  printf ( "  Scheduling Policy =              %s\n", schedstring );
  printf ( "  Chunk Size =                     %d\n", mychunk );

/*
  Set up the vector data.
  N may be increased to get better timing data.

  The value FACTOR is chosen so that the correct value of the dot product 
  of X and Y is N.
*/
  n = 100000000;


//  while ( n < 1000000 )
  {
    n = n * 10;

    x = ( double * ) malloc ( n * sizeof ( double ) );
    y = ( double * ) malloc ( n * sizeof ( double ) );

    factor = ( double ) ( n );
    factor = 1.0 / sqrt ( 2.0 * factor * factor + 3 * factor + 1.0 );

// Chandan: Commenting initialization code
/*
    for ( i = 0; i < n; i++ )
    {
      x[i] = ( i + 1 ) * factor;
    }

    for ( i = 0; i < n; i++ )
    {
      y[i] = ( i + 1 ) * 6 * factor;
    }
*/
    printf ( "\n" );
/*
  Test #1 Sequential Code
*/
/* Chandan commented this block.
    wtime = omp_get_wtime ( );

    xdoty = test01 ( n, x, y );

    wtime = omp_get_wtime ( ) - wtime;

    printf ( "  Sequential  %8d  %14.6e  %15.10f\n", n, xdoty, wtime );
*/
/*
  Test #2
*/
    wtime = omp_get_wtime ( );

    xdoty = test02 ( n, x, y );

    wtime = omp_get_wtime ( ) - wtime;

    printf ( "  Parallel    %8d  %14.6e  %15.10f\n", n, xdoty, wtime );
  
    free ( x );
    free ( y );
  }
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "DOT_PRODUCT\n" );
  printf ( "  Normal end of execution.\n" );

  return 0;
}
コード例 #20
0
int main ( int argc, char *argv[] )

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

    MAIN is the main program for PBMB_IO_PRB.

  Discussion:

    PBMB_IO_PRB tests the PBMB_IO library.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    15 June 2012

  Author:

    John Burkardt
*/
{
  bool error;

  timestamp ( );
  printf ( "\n" );
  printf ( "PBMB_IO_PRB:\n" );
  printf ( "  C version\n" );
  printf ( "  Test the PBMB_IO library.\n" );

  error = test01 ( );

  if ( error )
  {
    printf ( "\n" );
    printf ( "PBMB_IO_PRB - Fatal error!\n" );
    printf ( "  TEST01 terminated with an error.\n" );
    return 1;
  }

  error = test02 ( );

  if ( error )
  {
    printf ( "\n" );
    printf ( "PBMB_IO_PRB - Fatal error!\n" );
    printf ( "  TEST02 terminated with an error.\n" );
    return 1;
  }
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "PBMB_IO_PRB:\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
コード例 #21
0
int main ( )

//****************************************************************************80
//
//  Purpose:
//
//    FILE_NAME_SEQUENCE demonstrates ways of generating a sequence of filenames.
//
//  Discussion:
//
//    There are situations such as animations or parallel processing in which
//    it is necessary to generate a sequence of file names which include
//    an embedded index that increases.  A simple example might be
//
//      "fred0.txt", "fred1.txt", "fred2.txt"
//
//    A side issue arises when the number of files is large enough that the
//    number of digits in the index will vary.  Thus, if we are going to have
//    15 files, do we want to number them as
//
//      "fred00.txt" through "fred14.txt"
//
//    which means, for one thing, that they will alphabetize properly, or
//    will we be satisfied with
//
//      "fred0.txt" through "fred14.txt" ?
//
//  Licensing:
//
//    This code is distributed under the GNU LGPL license.
//
//  Modified:
//
//    23 July 2012
//
//  Author:
//
//    John Burkardt
//
{
  char filename[81] = { "frodo_01345_lives.txt" };

  timestamp ( );
  printf ( "\n" );
  printf ( "FILE_NAME_SEQUENCE_PRB:\n" );
  printf ( "  C version\n" );
  printf ( "  Demonstrate ways of generating a numeric sequence of file names.\n" );

  test02 ( "fred", ".txt", 0, 12 );
  test03 ( "frid", ".txt", 99, 105 );
  test04 ( filename, 10 );
//
//  Terminate.
//
  printf ( "\n" );
  printf ( "FILE_NAME_SEQUENCE_PRB:\n" );
  printf ( "  Normal end of execution.\n" );

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

  return 0;
}
コード例 #22
0
ファイル: toms655_prb.c プロジェクト: spino327/jburkardt-c
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;
}
コード例 #23
0
int main ( )

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

    MAIN is the main program for TOMS743_PRB.

  Licensing:

    This code is distributed under the GNU LGPL license.

  Modified:

    16 June 2014

  Author:

    Original FORTRAN77 version by Andrew Barry, S. J. Barry, 
    Patricia Culligan-Hensley.
    This C version by John Burkardt.

  Reference:

    Andrew Barry, S. J. Barry, Patricia Culligan-Hensley,
    Algorithm 743: WAPR - A Fortran routine for calculating real 
    values of the W-function,
    ACM Transactions on Mathematical Software,
    Volume 21, Number 2, June 1995, pages 172-181.
*/
{
  double dx;
  int n;
  int nbits;
  double xmax;
  double xmin;

  timestamp ( );
  printf ( "\n" );
  printf ( "TOMS743_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the TOMS743 library.\n" );

  nbits = nbits_compute ( );
  printf ( "\n" );
  printf ( "  Number of bits in mantissa - 1 = %d\n", nbits );

  test01 ( nbits );

  dx = + 1.0E-09;
  n = 10;
  test02 ( nbits, dx, n );

  xmin = 0.0;
  xmax = 1.0E+20;
  n = 20;
  test03 ( nbits, xmin, xmax, n );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "TOMS743_PRB\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
コード例 #24
0
ファイル: Value.cpp プロジェクト: rdobson/openpegasus
int main(int argc, char** argv)
{
#ifdef IO
    verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false;
    if (verbose)
    cout << "Test CIMValue. To turn off display, compile with IO undefined\n";
#endif
    // Test the primitive CIMValue types with test01
    test01(Boolean(true));
    test01(Boolean(false));
    test01(Char16('Z'));
    test01(Uint8(77));
    test01(Sint8(-77));
    test01(Sint16(77));
    test01(Uint16(-77));
    test01(Sint32(77));
    test01(Uint32(-77));
    test01(Sint64(77));
    test01(Uint64(-77));
    test01(Real32(1.5));
    test01(Real64(55.5));
    test01(Uint64(123456789));
    test01(Sint64(-123456789));
    test01(String("Hello world"));
    test01(CIMDateTime("19991224120000.000000+360"));
    test01(CIMObjectPath(
        "//host1:77/root/test:Class1.key1=\"key1Value\",key2=\"key2Value\""));

    // Create and populate a declaration context:

    const CIMNamespaceName NAMESPACE = CIMNamespaceName ("/zzz");

    SimpleDeclContext* context = new SimpleDeclContext;

    context->addQualifierDecl(
    NAMESPACE, CIMQualifierDecl(CIMName ("counter"), false,
        CIMScope::PROPERTY));

    context->addQualifierDecl(
    NAMESPACE, CIMQualifierDecl(CIMName ("classcounter"), false,
        CIMScope::CLASS));

    context->addQualifierDecl(
    NAMESPACE, CIMQualifierDecl(CIMName ("min"), String(),
        CIMScope::PROPERTY));

    context->addQualifierDecl(
    NAMESPACE, CIMQualifierDecl(CIMName ("max"), String(),
        CIMScope::PROPERTY));

    context->addQualifierDecl(NAMESPACE,
    CIMQualifierDecl(CIMName ("Description"), String(),
        CIMScope::PROPERTY));

    CIMClass class1(CIMName ("MyClass"));

    class1
    .addProperty(CIMProperty(CIMName ("count"), Uint32(55))
        .addQualifier(CIMQualifier(CIMName ("counter"), true))
        .addQualifier(CIMQualifier(CIMName ("min"), String("0")))
        .addQualifier(CIMQualifier(CIMName ("max"), String("1"))))
    .addProperty(CIMProperty(CIMName ("message"), String("Hello"))
        .addQualifier(CIMQualifier(CIMName ("description"),
                String("My Message"))))
    .addProperty(CIMProperty(CIMName ("ratio"), Real32(1.5)));

    Resolver::resolveClass (class1, context, NAMESPACE);
    context->addClass(NAMESPACE, class1);

    // Test a CIMObject that is a CIMClass
    test01(CIMObject(class1));

    // Test a CIMObject that is a CIMInstance
    CIMInstance instance1(CIMName ("MyClass"));
    instance1.addQualifier(CIMQualifier(CIMName ("classcounter"), true));
    instance1.addProperty(CIMProperty(CIMName ("message"), String("Goodbye")));

    Resolver::resolveInstance (instance1, context, NAMESPACE, true);

    test01(CIMObject(instance1));

    testEmbeddedValue<CIMObject>(instance1);
    testEmbeddedValue<CIMInstance>(instance1);

    // Test CIMValue arrays

    Array<Uint8> arr1;
    arr1.append(11);
    arr1.append(22);
    arr1.append(23);
    test02(arr1);

    Array<Uint16> arr2;
    arr2.append(333);
    arr2.append(444);
    arr2.append(445);
    test02(arr2);

    Array<Uint32> arr3;
    arr3.append(5555);
    arr3.append(6666);
    arr3.append(6667);
    test02(arr3);

    Array<Uint64> arr4;
    arr4.append(123456789);
    arr4.append(987654321);
    arr4.append(987654322);
    test02(arr4);

    Array<Sint8> arr5;
    arr5.append(-11);
    arr5.append(-22);
    arr5.append(-23);
    test02(arr5);

    Array<Sint16> arr6;
    arr6.append(333);
    arr6.append(444);
    arr6.append(555);
    test02(arr6);

    Array<Sint32> arr7;
    arr7.append(555);
    arr7.append(666);
    arr7.append(777);
    test02(arr7);

    Array<Sint64> arr8;
    arr8.append(-123456789);
    arr8.append(-987654321);
    arr8.append(-987654321);
    test02(arr8);

    Array<Boolean> arr9;
    arr9.append(true);
    arr9.append(false);
    arr9.append(false);
    test02(arr9);

    Array<Real32> arr10;
    arr10.append(1.55F);
    arr10.append(2.66F);
    arr10.append(3.77F);
    test02(arr10);

    Array<Real64> arr11;
    arr11.append(55.55);
    arr11.append(66.66);
    arr11.append(77.77);
    test02(arr11);

    Array<Char16> arr12;
    arr12.append('X');
    arr12.append('Y');
    arr12.append('Z');
    test02(arr12);

    Array<String> arr13;
    arr13.append("One");
    arr13.append("Two");
    arr13.append("Three");
    test02(arr13);

    Array<CIMDateTime> arr14;
    arr14.append(CIMDateTime ("20020130120000.000000+360"));
    arr14.append(CIMDateTime ("20020201120000.000000+360"));
    arr14.append(CIMDateTime ("20020202120000.000000+360"));
    test02(arr14);

    Array<CIMObjectPath> arr15;
    arr15.append(CIMObjectPath(
        "//host1:77/root/test:Class1.key1=\"key1Value\",key2=\"key2Value\""));
    arr15.append(CIMObjectPath(
        "//host2:88/root/static:Class2.keyA=\"keyAValue\",keyB="
                "\"keyBValue\""));
    arr15.append(CIMObjectPath(
        "//host3:99/root/test/static:Class3.keyX=\"keyXValue\","
                "keyY=\"keyYValue\""));
    test02(arr15);

    testEmbeddedValueArray<CIMObject>(instance1, NAMESPACE, context);
    testEmbeddedValueArray<CIMInstance>(instance1, NAMESPACE, context);

    // Calling remaining  Array tests..
    CIMDateTime D1("19991224120000.000000+100");
    Array<CIMDateTime> arrD1(10,D1);
    CIMDateTime *D2 = new CIMDateTime("19991224120000.000000+100");
    Array<CIMDateTime> arrD2(D2,1);
    test03(arrD1, arrD2, D2, CIMDateTime("19991224120000.000000+100"),
                     CIMDateTime("29991224120000.000000+100"));
    delete D2;

    CIMName cimname1("yourName");
    Array<CIMName> arrcimname1(10,cimname1);
    CIMName *cimname2 = new CIMName("yourName");
    Array<CIMName> arrcimname2(cimname2,1);
    test03(arrcimname1, arrcimname2, cimname2, CIMName("yourName"),
            CIMName("myName"));
    delete cimname2;

    CIMKeyBinding cimbind1(cimname1, "myKey", CIMKeyBinding::STRING);
    CIMKeyBinding cimbind2(cimname1, "yourKey", CIMKeyBinding::STRING);
    Array<CIMKeyBinding> arrcimbind1(10,cimbind1);
    CIMKeyBinding *cimbind3 =
        new CIMKeyBinding(cimname1, "myKey", CIMKeyBinding::STRING);
    Array<CIMKeyBinding> arrcimbind2(cimbind3,1);
    test03(arrcimbind1, arrcimbind2, cimbind3, cimbind1, cimbind2 );
    delete cimbind3;

    CIMNamespaceName cimnamespace1("root/SampleProvider");
    Array<CIMNamespaceName> arrcimnamespace1(10,cimnamespace1);
    CIMNamespaceName *cimnamespace2 = new CIMNamespaceName(
            "root/SampleProvider");
    Array<CIMNamespaceName> arrcimnamespace2(cimnamespace2,1);
    test03(arrcimnamespace1, arrcimnamespace2, cimnamespace2,
            CIMNamespaceName("root/SampleProvider"),
            CIMNamespaceName("root/SampleProvider2"));
    delete cimnamespace2;

    Array<Boolean> arrB1(10,true);
    Boolean *b = new Boolean(true);
    Array<Boolean> arrB2(b,1);
    Array<Boolean> arrB3(2);
    Boolean b1 = true, b2=false;
    test03(arrB1, arrB2, b, Boolean(true),Boolean(false));
    delete b;

    Array<Real32> arrreal321(10);
    Real32 creal321(2.5);
    Array<Real32> arrreal322(10, creal321);
    Real32 *creal322 = new Real32(2.5);
    Array<Real32> arrreal323(creal322,1);
    Array<Real32> arrreal324(arrreal321);
    test03(arrreal322, arrreal323, creal322,Real32(2.5),Real32(3.5));
    delete creal322;

    Array<Real64> arrreal641(10);
    Real64 creal641(20000.54321);
    Array<Real64> arrreal642(10, creal641);
    Real64 *creal642 = new Real64(20000.54321);
    Array<Real64> arrreal643(creal642,1);
    Array<Real64> arrreal644(arrreal641);
    test03(arrreal642, arrreal643, creal642,Real64(20000.54321),
            Real64(30000.54321));
    delete creal642;

    Array<Sint16> arrSint161(10);
    Sint16 cSint161(-2000);
    Array<Sint16> arrSint162(10, cSint161);
    Sint16 *cSint162 = new Sint16(-2000);
    Array<Sint16> arrSint163(cSint162,1);
    Array<Sint16> arrSint164(arrSint161);
    test03(arrSint162, arrSint163, cSint162, Sint16(-2000), Sint16(-3000));
    delete cSint162;

    Array<Sint32> arrSint321(10);
    Sint32 cSint321(-200000000);
    Array<Sint32> arrSint322(10, cSint321);
    Sint32 *cSint322 = new Sint32(-200000000);
    Array<Sint32> arrSint323(cSint322,1);
    Array<Sint32> arrSint324(arrSint321);
    test03(arrSint322, arrSint323, cSint322, Sint32(-200000000),
            Sint32(-300000000));
    delete cSint322;

    Array<Sint64> arrSint641(10);
    Sint64 cSint641(Sint64(-2000000)*Sint64(10000000) );
    Array<Sint64> arrSint642(10, cSint641);
    Sint64 *cSint642 = new Sint64(Sint64(-2000000)*Sint64(10000000));
    Array<Sint64> arrSint643(cSint642,1);
    Array<Sint64> arrSint644(arrSint641);
    test03(arrSint642, arrSint643, cSint642,Sint64(-2000000)*Sint64(10000000),
                           Sint64(-3000000)*Sint64(10000000));
    delete cSint642;

    Array<Sint8> arrSint81(10);
    Sint8 cSint81(-20);
    Array<Sint8> arrSint82(10, cSint81);
    Sint8 *cSint82 = new Sint8(-20);
    Array<Sint8> arrSint83(cSint82,1);
    Array<Sint8> arrSint84(arrSint81);
    test03(arrSint82, arrSint83, cSint82, Sint8(-20), Sint8(-22));
    delete cSint82;

    Array<Uint16> arrUint161(10);
    Uint16 cUint161(200);
    Array<Uint16> arrUint162(10, cUint161);
    Uint16 *cUint162 = new Uint16(200);
    Array<Uint16> arrUint163(cUint162,1);
    Array<Uint16> arrUint164(arrUint161);
    test03(arrUint162, arrUint163, cUint162, Uint16(200), Uint16(255));
    delete cUint162;

    Array<Uint32> arrUint321(10);
    Uint32 cUint321(2000);
    Array<Uint32> arrUint322(10, cUint321);
    Uint32 *cUint322 = new Uint32(2000);
    Array<Uint32> arrUint323(cUint322,1);
    Array<Uint32> arrUint324(arrUint321);
    test03(arrUint322, arrUint323, cUint322, Uint32(2000), Uint32(3000));
    delete cUint322;

    Array<Uint64> arrUint641(10);
    Uint64 cUint641(Uint64(2000000)*Uint64(10000000));
    Array<Uint64> arrUint642(10, cUint641);
    Uint64 *cUint642 = new Uint64(Uint64(2000000)*Uint64(10000000));
    Array<Uint64> arrUint643(cUint642,1);
    Array<Uint64> arrUint644(arrUint641);
    test03(arrUint642, arrUint643, cUint642,Uint64(2000000)*Uint64(10000000),
                           Uint64(255000)*Uint64(10000000));
    delete cUint642;

    Array<Uint8> arrUint81(10);
    Uint8 cUint81(200);
    Array<Uint8> arrUint82(10, cUint81);
    Uint8 *cUint82 = new Uint8(200);
    Array<Uint8> arrUint83(cUint82,1);
    Array<Uint8> arrUint84(arrUint81);
    test03(arrUint82, arrUint83, cUint82, Uint8(200), Uint8(255));
    delete cUint82;

    Array<Char16> arrChar161(10);
    Char16 cChar161('Z');
    Array<Char16> arrChar162(10, cChar161);
    Char16 *cChar162 = new Char16('Z');
    Array<Char16> arrChar163(cChar162,1);
    Array<Char16> arrChar164(arrChar161);
    test03(arrChar162, arrChar163, cChar162, Char16('Z'), Char16('z'));
    delete cChar162;
    delete context;

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

    return 0;
}
コード例 #25
0
ファイル: example.cpp プロジェクト: trodevel/templtextkeeper
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;
}
コード例 #26
0
ファイル: Value.cpp プロジェクト: rdobson/openpegasus
void testEmbeddedValueArray(const CIMInstance & startInstance,
                            const CIMNamespaceName & NAMESPACE,
                            SimpleDeclContext * context)
{
    CIMInstance instance1(startInstance.clone());
    // Test an array of CIMObjects that are CIMInstances
    CIMInstance instance2(CIMName ("MyClass"));
    instance2.addQualifier(CIMQualifier(CIMName ("classcounter"), true));
    instance2.addProperty(CIMProperty(CIMName ("message"), String("Adios")));
    Resolver::resolveInstance (instance2, context, NAMESPACE, true);

    CIMInstance instance3(CIMName ("MyClass"));
    instance3.addQualifier(CIMQualifier(CIMName ("classcounter"), false));
    instance3.addProperty(CIMProperty(CIMName ("message"),
                String("Au Revoir")));
    Resolver::resolveInstance (instance3, context, NAMESPACE, true);

    Array<EmbeddedType> arr16;
    arr16.append(EmbeddedType(instance1));
    arr16.append(EmbeddedType(instance2));
    arr16.append(EmbeddedType(instance3));
    test02(arr16);

    // Specific test to verify the cloning of CIMObjects when set as and
    // gotten from a CIMValue.
    CIMValue v1array;
    // Create CIMValue v1 of type CIMTYPE_OBJECT (ie. CIMObject)
    v1array.set(arr16);
    // Change the "count" property of arr16[1], and then verify
    // that the CIMValue v1array, that was set from arr16, is
    // not affected (ie. tests clone() on CIMValue::set() ).
    Uint32 propIx = arr16[1].findProperty(CIMName("count"));
    PEGASUS_TEST_ASSERT(propIx != PEG_NOT_FOUND);
    CIMValue v2 = arr16[1].getProperty(propIx).getValue();
    Uint32 propCount;
    v2.get(propCount);
    PEGASUS_TEST_ASSERT(propCount == 55);
    arr16[1].removeProperty(propIx);
    arr16[1].addProperty(CIMProperty(CIMName ("count"), Uint32(65))
        .addQualifier(CIMQualifier(CIMName ("counter"), true))
        .addQualifier(CIMQualifier(CIMName ("min"), String("0")))
        .addQualifier(CIMQualifier(CIMName ("max"), String("1"))));
    Array<EmbeddedType> object2array;
    v1array.get(object2array);
    CIMInstance instance2a(object2array[1]);
    propIx = instance2a.findProperty(CIMName("count"));
    PEGASUS_TEST_ASSERT(propIx != PEG_NOT_FOUND);
    CIMValue v3 = instance2a.getProperty(propIx).getValue();
    v3.get(propCount);
    PEGASUS_TEST_ASSERT(propCount == 55);
    // Now change the "count" property of instance2a, which was obtained
    // from a get of CIMValue v1array. Again, the underlying CIMValue should
    // not be affected (ie. tests clone() on CIMValue::get() ).
    instance2a.removeProperty(propIx);
    instance2a.addProperty(CIMProperty(CIMName ("count"), Uint32(65))
       .addQualifier(CIMQualifier(CIMName ("counter"), true))
       .addQualifier(CIMQualifier(CIMName ("min"), String("0")))
       .addQualifier(CIMQualifier(CIMName ("max"), String("1"))));
    Array<EmbeddedType> object3array;
    v1array.get(object3array);
    CIMInstance instance2b(object3array[1]);
    propIx = instance2b.findProperty(CIMName("count"));
    PEGASUS_TEST_ASSERT(propIx != PEG_NOT_FOUND);
    CIMValue v4 = instance2b.getProperty(propIx).getValue();
    v4.get(propCount);
    PEGASUS_TEST_ASSERT(propCount == 55);

    // Specific test for setting value as a null CIMObject() (see bug 3373).
    // Confirm that CIMValue() with an uninitialized CIMObject in the input
    // array will throw exception.
    arr16.append(EmbeddedType());
    bool caught_exception = false;
    try
    {
        CIMValue y(arr16);
    }
    catch(UninitializedObjectException&)
    {
        caught_exception = true;
    }
    PEGASUS_TEST_ASSERT (caught_exception == true);
    // Confirm that set() with an uninitialized CIMObject in the input
    // array will throw exception.
    caught_exception = false;
    try
    {
        CIMValue y;
        y.set(arr16);
    }
    catch(UninitializedObjectException&)
    {
        caught_exception = true;
    }
    PEGASUS_TEST_ASSERT (caught_exception == true);
}
コード例 #27
0
int main ( )

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

    MAIN is the main program for SQUARE_SYMQ_RULE_PRB.

  Discussion:

    SQUARE_SYMQ_RULE_PRB tests the SQUARE_SYMQ_RULE library.

  Licensing:

    This code is distributed under the GNU GPL license.

  Modified:

    02 July 2014

  Author:

    Original FORTRAN77 version by Hong Xiao, Zydrunas Gimbutas.
    This C version by John Burkardt.

  Reference:

    Hong Xiao, Zydrunas Gimbutas,
    A numerical algorithm for the construction of efficient quadrature
    rules in two and higher dimensions,
    Computers and Mathematics with Applications,
    Volume 59, 2010, pages 663-676.
*/
{
  int degree;
  char header[255];
  int n;

  timestamp ( );
  printf ( "\n" );
  printf ( "SQUARE_SYMQ_RULE_PRB\n" );
  printf ( "  C version\n" );
  printf ( "  Test the SQUARE_SYMQ_RULE library.\n" );

  degree = 8;
  n = rule_full_size ( degree );
  strcpy ( header, "square08" );

  test01 ( degree, n );

  test02 ( degree, n, header );

  test03 ( degree, n, header );

  test04 ( degree, n );
/*
  Terminate.
*/
  printf ( "\n" );
  printf ( "SQUARE_SYMQ_RULE_PRB\n" );
  printf ( "  Normal end of execution.\n" );
  printf ( "\n" );
  timestamp ( );

  return 0;
}
コード例 #28
0
ファイル: test.cpp プロジェクト: nandai/slog
void DateTimeTest::run()
{
    test01();
    test02();
}
コード例 #29
0
ファイル: test.cpp プロジェクト: nandai/slog
void ConvertTest::run()
{
    test01();
    test02();
    test03();
}
コード例 #30
0
ファイル: test.cpp プロジェクト: nandai/slog
void StringTest::run()
{
    test01();
    test02();
    test03();
}