[Scummvm-cvs-logs] scummvm master -> 1e0b05ff992665467f762d61947a51407d1f1c41

lordhoto lordhoto at gmail.com
Fri Aug 19 01:18:38 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1e0b05ff99 TEST: Add a very tiny and simple unit test for intLog2.


Commit: 1e0b05ff992665467f762d61947a51407d1f1c41
    https://github.com/scummvm/scummvm/commit/1e0b05ff992665467f762d61947a51407d1f1c41
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-08-18T16:14:09-07:00

Commit Message:
TEST: Add a very tiny and simple unit test for intLog2.

Changed paths:
  A test/common/math.h



diff --git a/test/common/math.h b/test/common/math.h
new file mode 100644
index 0000000..5da0410
--- /dev/null
+++ b/test/common/math.h
@@ -0,0 +1,18 @@
+#include <cxxtest/TestSuite.h>
+
+#include "common/math.h"
+
+class MathTestSuite : public CxxTest::TestSuite
+{
+	public:
+	void test_intLog2() {
+		// Test special case for 0
+		TS_ASSERT_EQUALS(Common::intLog2(0), -1);
+
+		// intLog2 should round the result towards 0
+		TS_ASSERT_EQUALS(Common::intLog2(7), 2);
+
+		// Some simple test for 2^10
+		TS_ASSERT_EQUALS(Common::intLog2(1024), 10);
+	}
+};






More information about the Scummvm-git-logs mailing list