[Scummvm-cvs-logs] SF.net SVN: scummvm:[49062] scummvm/trunk/test/common/rational.h
mthreepwood at users.sourceforge.net
mthreepwood at users.sourceforge.net
Mon May 17 22:57:36 CEST 2010
Revision: 49062
http://scummvm.svn.sourceforge.net/scummvm/?rev=49062&view=rev
Author: mthreepwood
Date: 2010-05-17 20:57:36 +0000 (Mon, 17 May 2010)
Log Message:
-----------
Add tests for Common::Rational from patch #2963496 (VideoDecoder Rewrite), also courtesy of DrMcCoy who wrote the main Common::Rational class too
Added Paths:
-----------
scummvm/trunk/test/common/rational.h
Added: scummvm/trunk/test/common/rational.h
===================================================================
--- scummvm/trunk/test/common/rational.h (rev 0)
+++ scummvm/trunk/test/common/rational.h 2010-05-17 20:57:36 UTC (rev 49062)
@@ -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));
+ }
+};
Property changes on: scummvm/trunk/test/common/rational.h
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:keywords
+ Date Rev Author URL Id
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list