/*
	testsupport.c: define some testing helpers
 */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>

#include "testsupport.h"


#define EPSILON  0.0001


void assert_double_same( double a, char *astr, double b, char *bstr )
{
	if( fabs(a-b) >= EPSILON )
	{
		fprintf( stderr, "%s: %g != %s: %g\n", astr, a, bstr, b );
		exit(1);
	}
}


void assert_str_same( char *a, char *astr, char *b, char *bstr )
{
	if( strcmp(a,b) != 0 )
	{
		fprintf( stderr, "%s: %s != %s: %s\n", astr, a, bstr, b );
		exit(1);
	}
}
