libblobpack/test/test-funcs.h

15 lines
366 B
C
Raw Permalink Normal View History

2016-08-30 20:40:02 +02:00
#pragma once
#include <math.h>
#ifndef FLT_EPSILON
#define FLT_EPSILON 1e-5
#endif
static inline unsigned char is_equal(float a, float b){
return fabsf(a - b) < FLT_EPSILON;
}
2016-08-30 20:40:02 +02:00
#define STR(x) #x
#define TEST(x) if(!(x)){ printf("test failed at %d, %s: %s\n", __LINE__, __FILE__, STR(x)); exit(-1); } else { printf("[OK] %s\n", STR(x)); }