1
0
forked from 0ad/0ad

Add tests for fixed::FromFraction

Differential Revision: https://code.wildfiregames.com/D4458
This was SVN commit r26273.
This commit is contained in:
wraitii 2022-01-30 12:57:08 +00:00
parent d740b4f335
commit 0779c64052

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2021 Wildfire Games.
/* Copyright (C) 2022 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -47,6 +47,14 @@ public:
TS_ASSERT_EQUALS(a.ToInt_RoundToZero(), 123);
}
void test_FromFraction()
{
TS_ASSERT_EQUALS(fixed::FromFraction(340, 10), fixed::FromInt(340) / 10);
TS_ASSERT_EQUALS(fixed::FromFraction(-5, 11), fixed::FromInt(-5) / 11);
TS_ASSERT_EQUALS(fixed::FromFraction(4, -3), fixed::FromInt(4) / -3);
TS_ASSERT_EQUALS(fixed::FromFraction(2, 3), fixed::FromInt(2) / 3);
}
void test_FromFloat()
{
fixed a = fixed::FromFloat(123.125f);