From 1c6ccf8000c8eb34e4ae3d68312a23261f87862c Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 6 Jan 2010 12:15:05 +0000 Subject: Add more comparision operators to Timestamp svn-id: r47071 --- test/sound/timestamp.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'test/sound/timestamp.h') diff --git a/test/sound/timestamp.h b/test/sound/timestamp.h index d4cd0edc44..7219bb54aa 100644 --- a/test/sound/timestamp.h +++ b/test/sound/timestamp.h @@ -103,6 +103,40 @@ class TimestampTestSuite : public CxxTest::TestSuite } + void test_compare() { + const Audio::Timestamp a = Audio::Timestamp(60, 1000); + Audio::Timestamp b = Audio::Timestamp(60, 60); + Audio::Timestamp c = Audio::Timestamp(60, 44100); + + TS_ASSERT(a <= b); + TS_ASSERT(b <= c); + TS_ASSERT(a <= c); + + TS_ASSERT(b >= a); + TS_ASSERT(c >= b); + TS_ASSERT(c >= a); + + b = b.addFrames(60 / 12); + c = c.addFrames(44100 / 10); + + TS_ASSERT(a < b); + TS_ASSERT(b < c); + TS_ASSERT(a < c); + + TS_ASSERT(b > a); + TS_ASSERT(c > b); + TS_ASSERT(c > a); + + TS_ASSERT(a <= b); + TS_ASSERT(b <= c); + TS_ASSERT(a <= c); + + TS_ASSERT(b >= a); + TS_ASSERT(c >= b); + TS_ASSERT(c >= a); + } + + void test_framerate() { const Audio::Timestamp a = Audio::Timestamp(500, 1000); const Audio::Timestamp b = Audio::Timestamp(500, 67); -- cgit v1.2.3