aboutsummaryrefslogtreecommitdiffstats
path: root/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'common.h')
-rw-r--r--common.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/common.h b/common.h
index 36ca06f..332e19a 100644
--- a/common.h
+++ b/common.h
@@ -5,7 +5,7 @@
#include <math.h>
-#if __GNUC__
+#if defined(__GNUC__) && !defined(__clang__)
# pragma GCC diagnostic ignored "-Wunsuffixed-float-constants"
#endif
@@ -17,3 +17,30 @@
void libtellurian_vincenty_inverse__(double latitude1, double longitude1, double latitude2, double longitude2,
double *distance_out, double *azimuth1_out, double *azimuth2_out);
+
+#ifdef TEST
+# include <stdio.h>
+# include <stdlib.h>
+# if __GNUC__
+# pragma GCC diagnostic ignored "-Wfloat-equal"
+# endif
+# define D180 M_PI
+# define D90 (M_PI / 2.0)
+# define D60 (M_PI / 3.0)
+# define D45 (M_PI / 4.0)
+# define D30 (M_PI / 6.0)
+# define ASSERT(ASSERTION)\
+ do {\
+ if (!(ASSERTION)) {\
+ fprintf(stderr, "Failed assertion at line %i: %s\n", __LINE__, #ASSERTION);\
+ exit(1);\
+ }\
+ } while (0)
+# if defined(__GNUC__)
+# define TO\
+DO_TEST __attribute__((__const__)) int main(void) { return 0; }
+# else
+# define TO\
+DO_TEST int main(void) { return 0; }
+# endif
+#endif