mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 01:46:42 +00:00
Add tests for Common::Rational from patch #2963496 (VideoDecoder Rewrite), also courtesy of DrMcCoy who wrote the main Common::Rational class too
svn-id: r49062
This commit is contained in:
parent
811fc0e7ec
commit
ea84abf588
38
test/common/rational.h
Normal file
38
test/common/rational.h
Normal file
@ -0,0 +1,38 @@
|
||||
#include <cxxtest/TestSuite.h>
|
||||
|
||||
#include "common/rational.h"
|
||||
|
||||
class RationalTestSuite : public CxxTest::TestSuite {
|
||||
public:
|
||||
void test_operators() {
|
||||
Common::Rational r0(6, 3);
|
||||
Common::Rational r1(1, 2);
|
||||
|
||||
Common::Rational r2(62, 2);
|
||||
Common::Rational r3(34, 4);
|
||||
|
||||
Common::Rational r4 = (r0 + r1) * 3;
|
||||
Common::Rational r5 = (r2 - r3) / 3;
|
||||
|
||||
Common::Rational r6 = r5 - 1;
|
||||
|
||||
TS_ASSERT(r4 == r5);
|
||||
|
||||
TS_ASSERT(-r4 == -r5);
|
||||
|
||||
TS_ASSERT( r4 > r6);
|
||||
TS_ASSERT( r4 >= r6);
|
||||
TS_ASSERT(!(r4 < r6));
|
||||
TS_ASSERT(!(r4 <= r6));
|
||||
|
||||
TS_ASSERT( r4 > 7);
|
||||
TS_ASSERT( r4 >= 7);
|
||||
TS_ASSERT(!(r4 < 7));
|
||||
TS_ASSERT(!(r4 <= 7));
|
||||
|
||||
TS_ASSERT( 7 < r4);
|
||||
TS_ASSERT( 7 <= r4);
|
||||
TS_ASSERT(!(7 > r4));
|
||||
TS_ASSERT(!(7 >= r4));
|
||||
}
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user