aboutsummaryrefslogtreecommitdiff
path: root/test/audio/timestamp.h
diff options
context:
space:
mode:
Diffstat (limited to 'test/audio/timestamp.h')
-rw-r--r--test/audio/timestamp.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/audio/timestamp.h b/test/audio/timestamp.h
index ca56e34a4d..ec42a55ec4 100644
--- a/test/audio/timestamp.h
+++ b/test/audio/timestamp.h
@@ -2,6 +2,8 @@
#include "audio/timestamp.h"
+#include <limits.h>
+
class TimestampTestSuite : public CxxTest::TestSuite
{
public:
@@ -238,4 +240,15 @@ class TimestampTestSuite : public CxxTest::TestSuite
TS_ASSERT_EQUALS(c.numberOfFrames(), 11025);
TS_ASSERT_EQUALS(c.totalNumberOfFrames(), 33075);
}
+
+ void test_no_overflow() {
+ // The constructor should not overflow and give incoherent values
+ const Audio::Timestamp a = Audio::Timestamp(0, UINT_MAX, 1000);
+
+ int secs = UINT_MAX / 1000;
+ int frames = UINT_MAX % 1000;
+
+ TS_ASSERT_EQUALS(a.secs(), secs);
+ TS_ASSERT_EQUALS(a.numberOfFrames(), frames);
+ }
};