Changeset View
Changeset View
Standalone View
Standalone View
0ad/source/maths/tests/test_FixedVector2D.h
Show All 14 Lines | |||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
#include "lib/self_test.h" | #include "lib/self_test.h" | ||||
#include "maths/FixedVector2D.h" | #include "maths/FixedVector2D.h" | ||||
#define TS_ASSERT_VEC_EQUALS(v, x, y) \ | #define TS_ASSERT_VEC_EQUALS(v, x, y) \ | ||||
TS_ASSERT_EQUALS(v.X.ToDouble(), x); \ | TS_ASSERT_EQUALS(v.getX().ToDouble(), x); \ | ||||
TS_ASSERT_EQUALS(v.Y.ToDouble(), y); | TS_ASSERT_EQUALS(v.getY().ToDouble(), y); | ||||
#define TS_ASSERT_VEC_DELTA(v, x, y, delta) \ | #define TS_ASSERT_VEC_DELTA(v, x, y, delta) \ | ||||
TS_ASSERT_DELTA(v.X.ToDouble(), x, delta); \ | TS_ASSERT_DELTA(v.getX().ToDouble(), x, delta); \ | ||||
TS_ASSERT_DELTA(v.Y.ToDouble(), y, delta); | TS_ASSERT_DELTA(v.getY().ToDouble(), y, delta); | ||||
class TestFixedVector2D : public CxxTest::TestSuite | class TestFixedVector2D : public CxxTest::TestSuite | ||||
{ | { | ||||
public: | public: | ||||
void test_basic() | void test_basic() | ||||
{ | { | ||||
CFixedVector2D v1 (fixed::FromInt(1), fixed::FromInt(2)); | CFixedVector2D v1 (fixed::FromInt(1), fixed::FromInt(2)); | ||||
CFixedVector2D v2 (fixed::FromInt(10), fixed::FromInt(20)); | CFixedVector2D v2 (fixed::FromInt(10), fixed::FromInt(20)); | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator