Esempio n. 1
0
static void print_usage( const char *str ) 
{
   printf( "\n" );
   printf( "WebFetch V%s - Fetch data from a specified URL\n", TA_GetVersionString() );
   printf( "\n" );
   printf( "Usage: WebFetch URL\n" );
   printf( "\n" );
   printf( "   The text content of the URL is simply displayed\n" );
   printf( "   and can be redirected to a file.\n" );
   printf( "\n" );
   printf( "   Examples: WebFetch http://www.yahoo.com\n" );
   printf( "             WebFetch finance.yahoo.com/mt\n" );
   printf( "             WebFetch www.yahoo.com >myFile.html\n" );
   printf( "\n" );
   printf( "   On failure the first string displayed is\n" );
   printf( "   always \"WebFetch\".\n" );
   printf( "\n" );
   printf( "   Exit code is 0 on success.\n" );
   printf( "   Exit code is -1 on failure.\n" );
   printf( "\n" );
   printf( "   To uninstall, just delete WebFetch.exe\n" );
   printf( "\n" );
   printf( "   WebFetch.exe is open-source and is a small\n" );
   printf( "   component of a larger project called TA-LIB.\n" );
   printf( "\n" );
   printf( "   More info at http://ta-lib.org\n" );
   printf( "\n" );
   printf( "Error: [%s]\n", str );
}
Esempio n. 2
0
int main( int argc, char *argv[] )
{
   (void)argc;
   (void)argv;

   printf( TA_GetVersionString() );

   return 0;
}
Esempio n. 3
0
/**** Global functions definitions.   ****/
int main( int argc, char **argv )
{
#ifdef WIN32
	LARGE_INTEGER QPFrequency;
#endif
   double freq;

   ErrorNumber retValue;

   (void)argv;

   insufficientClockPrecision = 0;
   timeInProfiledCall = 0.0;
   worstProfiledCall = 0.0;
   nbProfiledCall = 0;
   doExtensiveProfiling = 0;

   printf( "\n" );
   printf( "ta_regtest V%s - Regression Tests of TA-Lib code\n", TA_GetVersionString() );
   printf( "\n" );

   if( argc == 2 )
   {
	   /* Detect option to perform extended profiling. */
	   if( (argv[1][0] == '-') && (argv[1][1] == 'p') && (argv[1][2] == '\0'))
	   {
		   doExtensiveProfiling = 1;
	   }
	   else
	   {
		   printUsage();
		   return TA_REGTEST_BAD_USER_PARAM;
	   }
   }

   if( argc > 2 )
   {
      printUsage();
      return TA_REGTEST_BAD_USER_PARAM;
   }

   /* Some tests are using randomness. */ 
   srand( (unsigned)time( NULL ) );

   /* Test utility like List/Stack/Dictionary/Memory Allocation etc... */
   retValue = test_internals();
   if( retValue != TA_TEST_PASS )
   {
      printf( "\nFailed an internal test with code=%d\n", retValue );
      return retValue;
   }

   /* Test abstract interface. */
   retValue = test_abstract();
   if( retValue != TA_TEST_PASS )
   {
      printf( "Failed: Abstract interface Tests (error number = %d)\n", retValue );
      return retValue;
   }

   /* Perform all regresstions tests (except when ta_regtest is executed for profiling only). */
   if( !doExtensiveProfiling )
   {
      retValue = test_with_simulator();
      if( retValue != TA_TEST_PASS )
         return retValue;

      if( insufficientClockPrecision != 0 )
      {
   	   printf( "\nWarning: Code profiling not supported for this platform.\n" );
      }
      else if( nbProfiledCall > 0 )
      {
         printf( "\nNumber profiled function call       = %d function calls", nbProfiledCall );	  

#ifdef WIN32
         QueryPerformanceFrequency(&QPFrequency);
         freq = (double)QPFrequency.QuadPart;
         printf( "\nTotal execution time                = %g milliseconds", (timeInProfiledCall/freq)*1000.0 );
         printf( "\nWorst single function call          = %g milliseconds", (worstProfiledCall/freq)*1000.0 );
         printf( "\nAverage execution time per function = %g microseconds\n", ((timeInProfiledCall/freq)*1000000.0)/((double)nbProfiledCall) );
#else
         freq = (double)CLOCKS_PER_SEC;
         printf( "\nTotal execution time                = %g milliseconds", timeInProfiledCall/freq/1000.0 );
         printf( "\nWorst single function call          = %g milliseconds", worstProfiledCall/freq/1000.0 );
         printf( "\nAverage execution time per function = %g microseconds\n", (timeInProfiledCall/freq/1000000.0)/((double)nbProfiledCall) );
#endif	  
      }   
      printf( "\n* All tests succeeded. Enjoy the library. *\n" );
   }


   return TA_TEST_PASS; /* Everything succeed !!! */
}
Esempio n. 4
0
/**** Global functions definitions.   ****/
int main( int argc, char **argv )
{
   ErrorNumber retValue;

   (void)argv;

   printf( "\n" );
   printf( "ta_regtest V%s - Regression Tests of TA-Lib code\n", TA_GetVersionString() );
   printf( "\n" );

   if( argc > 1 )
   {
      printf( "Usage: ta_regtest\n" );
      printf( "\n" );
      printf( "   No parameter needed.\n" );
      printf( "\n" );
      printf( "   This tool will execute a series of tests to\n" );
      printf( "   make sure that the library is behaving as\n" );
      printf( "   expected.\n\n");

      printf( "   ** Must be run from the 'bin' directory.\n\n" );

      printf( "   On success, the exit code is 0.\n" );
      printf( "   On failure, the exit code is a number that can be\n" );
      printf( "   found in c/src/tools/ta_regtest/ta_error_number.h\n" );

      return TA_REGTEST_BAD_USER_PARAM;
   }

   /* Some tests are using randomness. */
   srand( (unsigned)time( NULL ) );

   /* Test utility like List/Stack/Dictionary/Memory Allocation etc... */
   retValue = test_internals();
   if( retValue != TA_TEST_PASS )
   {
      printf( "Failed internal cricular buffer test with code=%d\n", retValue );
      return retValue;
   }

   /* Test the CSI data source. */
   retValue = test_csi();
   if( retValue != TA_TEST_PASS )
      return retValue;

   /* Test Performance Measurements. */
   retValue = test_pm();
   if( retValue != TA_TEST_PASS )
   {
      printf( "Failed: Performance Measurements Tests (error number = %d)\n", retValue );
      return retValue;
   }

   /* Test abstract interface. */
   retValue = test_abstract();
   if( retValue != TA_TEST_PASS )
   {
      printf( "Failed: Abstract interface Tests (error number = %d)\n", retValue );
      return retValue;
   }

   /* Test history alloc. */
   retValue = testHistoryAlloc();
   if( retValue != TA_TEST_PASS )
   {
      printf( "Failed TA_HistoryAlloc test with code=%d\n", retValue );
      return retValue;
   }

   /* Test the ASCII data source. */
   retValue = test_ascii();
   if( retValue != TA_TEST_PASS )
      return retValue;

   /* Perform all the tests using the TA_SIMULATOR data */
   retValue = test_with_simulator();
   if( retValue != TA_TEST_PASS )
      return retValue;


   /* Test the merging of multiple data source */
   retValue = test_datasource_merge();
   if( retValue != TA_TEST_PASS )
      return retValue;

   /* Test the Yahoo! data source. */
   retValue = test_yahoo();
   if( retValue != TA_TEST_PASS )
      return retValue;

   printf( "\n* All tests succeed. Enjoy the library. *\n" );

   return TA_TEST_PASS; /* Everything succeed !!! */
}