nr-types-test.h revision c0092c87b724182672defa4f5f75a82c27f017dc
#include <cxxtest/TestSuite.h>
#include "libnr/nr-types.h"
#include "libnr/nr-point-fns.h"
#include <cmath>
{
NrTypesTest() :
a( 1.5, 2.0 ),
b(-2.0, 3.0),
{}
virtual ~NrTypesTest() {}
// createSuite and destroySuite get us per-suite setup and teardown
// without us having to worry about static initialization order, etc.
double const small;
void testXYValues( void )
{
TS_ASSERT_EQUALS( NR::X, 0 );
}
void testXYCtorAndArrayConst(void)
{
}
void testCopyCtor(void)
{
TS_ASSERT_EQUALS( a, a_copy );
}
void testNonConstArrayOperator(void)
{
TS_ASSERT_DIFFERS( a_copy, a );
TS_ASSERT_DIFFERS( a_copy, b );
TS_ASSERT_EQUALS( a_copy, b );
}
void testBinaryPlusMinus(void)
{
TS_ASSERT_DIFFERS( a, b );
TS_ASSERT_EQUALS( a + b, ab );
TS_ASSERT_EQUALS( ab - a, b );
TS_ASSERT_EQUALS( ab - b, a );
TS_ASSERT_DIFFERS( ab + a, b );
}
void testUnaryMinus(void)
{
}
void tetScaleDivide(void)
{
TS_ASSERT_EQUALS( -a, -1.0 * a );
TS_ASSERT_EQUALS( a + a + a, 3.0 * a );
}
void testDot(void)
{
}
void testL1L2LInftyNorms(void)
{
// TODO look at TS_ASSERT_DELTA
}
void testOperatorPlusEquals(void)
{
x += b;
TS_ASSERT_EQUALS( x, ab );
}
void tetOperatorDivEquals(void)
{
x /= .5;
TS_ASSERT_EQUALS( x, a + a );
}
void testNormalize(void)
{
x.normalize();
x = smallish_3_neg4;
x.normalize();
}
};
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :