/* See LICENSE file for copyright and license details. */
#include "common.h"
#ifndef TEST
double
libtellurian_azimuthal_radius(double latitude, double azimuth)
{
latitude = radians(latitude);
azimuth = radians(azimuth);
return libtellurian_azimuthal_radius_radians(latitude, azimuth);
}
#else
static int
approx(double a, double b)
{
return fabs(a - b) <= 1e-8 * (0.5 * (a + b));
}
int
main(void)
{
ASSERT(libtellurian_azimuthal_radius(0, 30) == libtellurian_azimuthal_radius_radians(0, D30));
ASSERT(approx(libtellurian_azimuthal_radius(180, 30), libtellurian_azimuthal_radius_radians(0, D30)));
ASSERT(approx(libtellurian_azimuthal_radius(360, 30), libtellurian_azimuthal_radius_radians(0, D30)));
ASSERT(approx(libtellurian_azimuthal_radius(90, 30), libtellurian_azimuthal_radius(-90, 30)));
ASSERT(approx(libtellurian_azimuthal_radius(90, 30), libtellurian_azimuthal_radius(270, 30)));
ASSERT(approx(libtellurian_azimuthal_radius(45, 30), libtellurian_azimuthal_radius(-45, 30)));
ASSERT(approx(libtellurian_azimuthal_radius(135, 30), libtellurian_azimuthal_radius(45, 30)));
ASSERT(approx(libtellurian_azimuthal_radius(-135, 30), libtellurian_azimuthal_radius(135, 30)));
ASSERT(libtellurian_azimuthal_radius(90, 30) == libtellurian_azimuthal_radius_radians(D90, D30));
ASSERT(libtellurian_azimuthal_radius(45, 30) == libtellurian_azimuthal_radius_radians(D45, D30));
ASSERT(libtellurian_azimuthal_radius(30, 30) == libtellurian_azimuthal_radius_radians(D30, D30));
ASSERT(libtellurian_azimuthal_radius(0, 60) == libtellurian_azimuthal_radius_radians(0, D60));
ASSERT(approx(libtellurian_azimuthal_radius(180, 60), libtellurian_azimuthal_radius_radians(0, D60)));
ASSERT(approx(libtellurian_azimuthal_radius(360, 60), libtellurian_azimuthal_radius_radians(0, D60)));
ASSERT(approx(libtellurian_azimuthal_radius(90, 60), libtellurian_azimuthal_radius(-90, 60)));
ASSERT(approx(libtellurian_azimuthal_radius(90, 60), libtellurian_azimuthal_radius(270, 60)));
ASSERT(approx(libtellurian_azimuthal_radius(45, 60), libtellurian_azimuthal_radius(-45, 60)));
ASSERT(approx(libtellurian_azimuthal_radius(135, 60), libtellurian_azimuthal_radius(45, 60)));
ASSERT(approx(libtellurian_azimuthal_radius(-135, 60), libtellurian_azimuthal_radius(135, 60)));
ASSERT(libtellurian_azimuthal_radius(90, 60) == libtellurian_azimuthal_radius_radians(D90, D60));
ASSERT(libtellurian_azimuthal_radius(45, 60) == libtellurian_azimuthal_radius_radians(D45, D60));
ASSERT(libtellurian_azimuthal_radius(30, 60) == libtellurian_azimuthal_radius_radians(D30, D60));
return 0;
}
#endif