2
#include <glib/gmacros.h>
4
#include <libnr/nr-rotate-fns.h>
5
#include <utest/utest.h>
7
int main(int argc, char *argv[])
9
utest_start("rotate-fns");
11
UTEST_TEST("rotate_degrees") {
13
0, 90, 180, 270, 360, 45, 45.01, 44.99, 134, 135, 136, 314, 315, 317, 359, 361
15
for (unsigned i = 0; i < G_N_ELEMENTS(d); ++i) {
16
double const degrees = d[i];
17
NR::rotate const rot(rotate_degrees(degrees));
18
NR::rotate const rot_approx( M_PI * ( degrees / 180. ) );
19
UTEST_ASSERT(rotate_equalp(rot, rot_approx, 1e-12));
21
NR::rotate const rot_inv(rotate_degrees(-degrees));
22
NR::rotate const rot_compl(rotate_degrees(360 - degrees));
23
UTEST_ASSERT(rotate_equalp(rot_inv, rot_compl, 1e-12));
25
UTEST_ASSERT(!rotate_equalp(rot, rotate_degrees(degrees + 1), 1e-5));
37
c-file-style:"stroustrup"
38
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
43
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :