diff options
author | Mattias Andrée <m@maandree.se> | 2024-10-20 17:28:46 +0200 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2024-10-20 17:28:46 +0200 |
commit | 09e6857ae73249bc7433f2971dcf291c70e4c766 (patch) | |
tree | f07ef152c6372083ab87e2e4289c7ab8b1f2c1ad /common.h | |
parent | Third commit (diff) | |
download | libtellurian-09e6857ae73249bc7433f2971dcf291c70e4c766.tar.gz libtellurian-09e6857ae73249bc7433f2971dcf291c70e4c766.tar.bz2 libtellurian-09e6857ae73249bc7433f2971dcf291c70e4c766.tar.xz |
Fourth commit
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r-- | common.h | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -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 |