3131* Prints the TAP version.
3232*/
3333static void print_version ( void ) {
34- printf ( "TAP version 13\n" );
34+ printf ( "TAP version 13\n" );
3535}
3636
3737/**
@@ -41,12 +41,12 @@ static void print_version( void ) {
4141* @param passing total number of passing tests
4242*/
4343static void print_summary ( int total , int passing ) {
44- printf ( "#\n" );
45- printf ( "1..%d\n" , total ); // TAP plan
46- printf ( "# total %d\n" , total );
47- printf ( "# pass %d\n" , passing );
48- printf ( "#\n" );
49- printf ( "# ok\n" );
44+ printf ( "#\n" );
45+ printf ( "1..%d\n" , total ); // TAP plan
46+ printf ( "# total %d\n" , total );
47+ printf ( "# pass %d\n" , passing );
48+ printf ( "#\n" );
49+ printf ( "# ok\n" );
5050}
5151
5252/**
@@ -55,12 +55,12 @@ static void print_summary( int total, int passing ) {
5555* @param elapsed elapsed time in seconds
5656*/
5757static void print_results ( double elapsed ) {
58- double rate = (double )ITERATIONS / elapsed ;
59- printf ( " ---\n" );
60- printf ( " iterations: %d\n" , ITERATIONS );
61- printf ( " elapsed: %0.9f\n" , elapsed );
62- printf ( " rate: %0.9f\n" , rate );
63- printf ( " ...\n" );
58+ double rate = (double )ITERATIONS / elapsed ;
59+ printf ( " ---\n" );
60+ printf ( " iterations: %d\n" , ITERATIONS );
61+ printf ( " elapsed: %0.9f\n" , elapsed );
62+ printf ( " rate: %0.9f\n" , rate );
63+ printf ( " ...\n" );
6464}
6565
6666/**
@@ -69,9 +69,9 @@ static void print_results( double elapsed ) {
6969* @return clock time
7070*/
7171static double tic ( void ) {
72- struct timeval now ;
73- gettimeofday ( & now , NULL );
74- return (double )now .tv_sec + (double )now .tv_usec /1.0e6 ;
72+ struct timeval now ;
73+ gettimeofday ( & now , NULL );
74+ return (double )now .tv_sec + (double )now .tv_usec /1.0e6 ;
7575}
7676
7777/**
@@ -80,46 +80,46 @@ static double tic( void ) {
8080* @return elapsed time in seconds
8181*/
8282static double benchmark ( void ) {
83- double elapsed ;
84- double mu ;
83+ double elapsed ;
84+ double mu ;
8585 double s ;
86- double y ;
87- double t ;
88- int i ;
86+ double y ;
87+ double t ;
88+ int i ;
8989
90- t = tic ();
91- for ( i = 0 ; i < ITERATIONS ; i ++ ) {
92- mu = 100.0 * ( (double )rand () / (double )RAND_MAX ) - 50.0 ;
93- s = 20.0 * ( (double )rand () / (double )RAND_MAX );
94- y = stdlib_base_dists_cosine_mean ( mu , s );
95- if ( y != y ) {
96- printf ( "should not return NaN\n" );
97- break ;
98- }
99- }
100- elapsed = tic () - t ;
101- if ( y != y ) {
102- printf ( "should not return NaN\n" );
103- }
104- return elapsed ;
90+ t = tic ();
91+ for ( i = 0 ; i < ITERATIONS ; i ++ ) {
92+ mu = 100.0 * ( (double )rand () / (double )RAND_MAX ) - 50.0 ;
93+ s = 20.0 * ( (double )rand () / (double )RAND_MAX );
94+ y = stdlib_base_dists_cosine_mean ( mu , s );
95+ if ( y != y ) {
96+ printf ( "should not return NaN\n" );
97+ break ;
98+ }
99+ }
100+ elapsed = tic () - t ;
101+ if ( y != y ) {
102+ printf ( "should not return NaN\n" );
103+ }
104+ return elapsed ;
105105}
106106
107107/**
108108* Main execution sequence.
109109*/
110110int main ( void ) {
111- double elapsed ;
112- int i ;
111+ double elapsed ;
112+ int i ;
113113
114- // Use the current time to seed the random number generator:
115- srand ( time ( NULL ) );
114+ // Use the current time to seed the random number generator:
115+ srand ( time ( NULL ) );
116116
117- print_version ();
118- for ( i = 0 ; i < REPEATS ; i ++ ) {
119- printf ( "# c::%s\n" , NAME );
120- elapsed = benchmark ();
121- print_results ( elapsed );
122- printf ( "ok %d benchmark finished\n" , i + 1 );
123- }
124- print_summary ( REPEATS , REPEATS );
117+ print_version ();
118+ for ( i = 0 ; i < REPEATS ; i ++ ) {
119+ printf ( "# c::%s\n" , NAME );
120+ elapsed = benchmark ();
121+ print_results ( elapsed );
122+ printf ( "ok %d benchmark finished\n" , i + 1 );
123+ }
124+ print_summary ( REPEATS , REPEATS );
125125}
0 commit comments