From bf580e6e6b9af3a545dfd7105aa4e5d691443495 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sun, 7 Aug 2011 11:38:42 +0200 Subject: JANITORIAL: Add missing NL at EOF. --- test/README | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/README b/test/README index 479b290967..25c378374e 100644 --- a/test/README +++ b/test/README @@ -2,4 +2,4 @@ This directory contains some unit tests for ScummVM. They are based on CxxTest , which you can find in the cxxtest subdirectory, including its manual. -To run the unit tests, simply use "make test". \ No newline at end of file +To run the unit tests, simply use "make test". -- cgit v1.2.3 From 23a0f5318c50cdf3dce19e4de0c98fb5ae1c2618 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sun, 7 Aug 2011 11:39:54 +0200 Subject: JANITORIAL: Remove trailing empty lines. --- test/audio/audiostream.h | 1 - test/audio/helper.h | 1 - test/common/algorithm.h | 1 - test/common/fixedstack.h | 1 - test/common/queue.h | 1 - test/common/stack.h | 1 - test/common/tokenizer.h | 1 - test/cxxtest/COPYING | 2 -- test/cxxtest/TODO | 1 - test/cxxtest/cxxtest.spec | 1 - test/cxxtest/cxxtest/Descriptions.h | 1 - test/cxxtest/cxxtest/DummyDescriptions.cpp | 1 - test/cxxtest/cxxtest/DummyDescriptions.h | 1 - test/cxxtest/cxxtest/GlobalFixture.cpp | 1 - test/cxxtest/cxxtest/GlobalFixture.h | 1 - test/cxxtest/cxxtest/LinkedList.h | 1 - test/cxxtest/cxxtest/RealDescriptions.cpp | 1 - test/cxxtest/cxxtest/RealDescriptions.h | 1 - test/cxxtest/docs/guide.html | 1 - test/cxxtest/sample/Construct | 2 -- test/cxxtest/sample/aborter.tpl | 1 - test/cxxtest/sample/file_printer.tpl | 1 - test/cxxtest/sample/mock/Dice.cpp | 2 -- test/cxxtest/sample/mock/Dice.h | 1 - test/cxxtest/sample/msvc/CxxTest_Workspace.dsw | 1 - test/cxxtest/sample/only.tpl | 1 - test/cxxtest/sample/winddk/SOURCES | 1 - 27 files changed, 30 deletions(-) (limited to 'test') diff --git a/test/audio/audiostream.h b/test/audio/audiostream.h index 1ffb2308ec..b94ee087d0 100644 --- a/test/audio/audiostream.h +++ b/test/audio/audiostream.h @@ -206,4 +206,3 @@ public: testSubLoopingAudioStreamFixedIter(22050, true, 2, 2); } }; - diff --git a/test/audio/helper.h b/test/audio/helper.h index e0d034aaea..5080c79eef 100644 --- a/test/audio/helper.h +++ b/test/audio/helper.h @@ -109,4 +109,3 @@ static Audio::SeekableAudioStream *createSineStream(const int sampleRate, const } #endif - diff --git a/test/common/algorithm.h b/test/common/algorithm.h index 4d7e9b2e20..beba495e40 100644 --- a/test/common/algorithm.h +++ b/test/common/algorithm.h @@ -80,4 +80,3 @@ public: TS_ASSERT_EQUALS(checkSort(list.begin(), list.end(), Common::Less()), true); } }; - diff --git a/test/common/fixedstack.h b/test/common/fixedstack.h index 62e536d5fa..9aa00b4680 100644 --- a/test/common/fixedstack.h +++ b/test/common/fixedstack.h @@ -79,4 +79,3 @@ public: TS_ASSERT(!q2.empty()); } }; - diff --git a/test/common/queue.h b/test/common/queue.h index cadb3979d7..c11f7a31ca 100644 --- a/test/common/queue.h +++ b/test/common/queue.h @@ -80,4 +80,3 @@ public: TS_ASSERT(!q2.empty()); } }; - diff --git a/test/common/stack.h b/test/common/stack.h index 66ba5f5e2b..0b1bcee350 100644 --- a/test/common/stack.h +++ b/test/common/stack.h @@ -79,4 +79,3 @@ public: TS_ASSERT(!q2.empty()); } }; - diff --git a/test/common/tokenizer.h b/test/common/tokenizer.h index 9c14875b81..c6a73d77b7 100644 --- a/test/common/tokenizer.h +++ b/test/common/tokenizer.h @@ -55,4 +55,3 @@ public: } }; - diff --git a/test/cxxtest/COPYING b/test/cxxtest/COPYING index b1e3f5a263..cfe59bcadb 100644 --- a/test/cxxtest/COPYING +++ b/test/cxxtest/COPYING @@ -500,5 +500,3 @@ necessary. Here is a sample; alter the names: Ty Coon, President of Vice That's all there is to it! - - diff --git a/test/cxxtest/TODO b/test/cxxtest/TODO index 7a7f926e50..63afa6896a 100644 --- a/test/cxxtest/TODO +++ b/test/cxxtest/TODO @@ -31,4 +31,3 @@ Seems logical, since they evolve separately. But then you'd want to download bo -fomit-frame-pointer ** TS_HEX - diff --git a/test/cxxtest/cxxtest.spec b/test/cxxtest/cxxtest.spec index 0f1ded6c53..c4d0017bb9 100644 --- a/test/cxxtest/cxxtest.spec +++ b/test/cxxtest/cxxtest.spec @@ -37,4 +37,3 @@ rm -rf $RPM_BUILD_ROOT %attr(-, root, root) /usr/include/cxxtest %attr(-, root, root) /usr/bin/cxxtestgen.pl %attr(-, root, root) /usr/bin/cxxtestgen.py - diff --git a/test/cxxtest/cxxtest/Descriptions.h b/test/cxxtest/cxxtest/Descriptions.h index c25b88dd99..f0e26cb942 100644 --- a/test/cxxtest/cxxtest/Descriptions.h +++ b/test/cxxtest/cxxtest/Descriptions.h @@ -71,4 +71,3 @@ namespace CxxTest } #endif // __cxxtest__Descriptions_h__ - diff --git a/test/cxxtest/cxxtest/DummyDescriptions.cpp b/test/cxxtest/cxxtest/DummyDescriptions.cpp index 04869bfc06..c8eca15827 100644 --- a/test/cxxtest/cxxtest/DummyDescriptions.cpp +++ b/test/cxxtest/cxxtest/DummyDescriptions.cpp @@ -46,4 +46,3 @@ namespace CxxTest bool DummyWorldDescription::setUp() { return true;} bool DummyWorldDescription::tearDown() { return true;} } - diff --git a/test/cxxtest/cxxtest/DummyDescriptions.h b/test/cxxtest/cxxtest/DummyDescriptions.h index 69d1116f84..e3aef921ca 100644 --- a/test/cxxtest/cxxtest/DummyDescriptions.h +++ b/test/cxxtest/cxxtest/DummyDescriptions.h @@ -73,4 +73,3 @@ namespace CxxTest } #endif // __cxxtest__DummyDescriptions_h__ - diff --git a/test/cxxtest/cxxtest/GlobalFixture.cpp b/test/cxxtest/cxxtest/GlobalFixture.cpp index edcaf1efe4..a5b2cf8340 100644 --- a/test/cxxtest/cxxtest/GlobalFixture.cpp +++ b/test/cxxtest/cxxtest/GlobalFixture.cpp @@ -20,4 +20,3 @@ namespace CxxTest } #endif // __cxxtest__GlobalFixture_cpp__ - diff --git a/test/cxxtest/cxxtest/GlobalFixture.h b/test/cxxtest/cxxtest/GlobalFixture.h index cbecb0daf8..3c4e12ec14 100644 --- a/test/cxxtest/cxxtest/GlobalFixture.h +++ b/test/cxxtest/cxxtest/GlobalFixture.h @@ -27,4 +27,3 @@ namespace CxxTest } #endif // __cxxtest__GlobalFixture_h__ - diff --git a/test/cxxtest/cxxtest/LinkedList.h b/test/cxxtest/cxxtest/LinkedList.h index bb5e842c97..0d134d2712 100644 --- a/test/cxxtest/cxxtest/LinkedList.h +++ b/test/cxxtest/cxxtest/LinkedList.h @@ -62,4 +62,3 @@ namespace CxxTest } #endif // __cxxtest__LinkedList_h__ - diff --git a/test/cxxtest/cxxtest/RealDescriptions.cpp b/test/cxxtest/cxxtest/RealDescriptions.cpp index 234622cbbf..079a9cf056 100644 --- a/test/cxxtest/cxxtest/RealDescriptions.cpp +++ b/test/cxxtest/cxxtest/RealDescriptions.cpp @@ -308,4 +308,3 @@ namespace CxxTest } #endif // __cxxtest__RealDescriptions_cpp__ - diff --git a/test/cxxtest/cxxtest/RealDescriptions.h b/test/cxxtest/cxxtest/RealDescriptions.h index ad455db0c2..76eee1a852 100644 --- a/test/cxxtest/cxxtest/RealDescriptions.h +++ b/test/cxxtest/cxxtest/RealDescriptions.h @@ -220,4 +220,3 @@ namespace CxxTest } #endif // __cxxtest__RealDescriptions_h__ - diff --git a/test/cxxtest/docs/guide.html b/test/cxxtest/docs/guide.html index fb435fb8f1..3e628ff742 100644 --- a/test/cxxtest/docs/guide.html +++ b/test/cxxtest/docs/guide.html @@ -1957,4 +1957,3 @@ no limit, or CXXTEST_MAX_DUMP_SIZE if you #define it. - diff --git a/test/cxxtest/sample/Construct b/test/cxxtest/sample/Construct index b8019616a9..994daa4fa5 100644 --- a/test/cxxtest/sample/Construct +++ b/test/cxxtest/sample/Construct @@ -60,5 +60,3 @@ sub cons::CxxTestErrorPrinter($$@) { my ($env, $dst, @srcs) = @_; CxxTestRunner $env $dst, 'ErrorPrinter', @srcs; } - - diff --git a/test/cxxtest/sample/aborter.tpl b/test/cxxtest/sample/aborter.tpl index 14fc50d2c7..ec6e187c98 100644 --- a/test/cxxtest/sample/aborter.tpl +++ b/test/cxxtest/sample/aborter.tpl @@ -13,4 +13,3 @@ int main() // The CxxTest "world" - diff --git a/test/cxxtest/sample/file_printer.tpl b/test/cxxtest/sample/file_printer.tpl index a9627d6d0d..8bd11cada0 100644 --- a/test/cxxtest/sample/file_printer.tpl +++ b/test/cxxtest/sample/file_printer.tpl @@ -19,4 +19,3 @@ int main( int argc, char *argv[] ) // The CxxTest "world" - diff --git a/test/cxxtest/sample/mock/Dice.cpp b/test/cxxtest/sample/mock/Dice.cpp index 161b80fa2b..afd0641ac1 100644 --- a/test/cxxtest/sample/mock/Dice.cpp +++ b/test/cxxtest/sample/mock/Dice.cpp @@ -10,5 +10,3 @@ unsigned Dice::roll() { return (T::rand() % 6) + 1; } - - diff --git a/test/cxxtest/sample/mock/Dice.h b/test/cxxtest/sample/mock/Dice.h index 3a393ef262..2ffd2562c5 100644 --- a/test/cxxtest/sample/mock/Dice.h +++ b/test/cxxtest/sample/mock/Dice.h @@ -10,4 +10,3 @@ public: }; #endif // __DICE_H - diff --git a/test/cxxtest/sample/msvc/CxxTest_Workspace.dsw b/test/cxxtest/sample/msvc/CxxTest_Workspace.dsw index 9a88de6ef7..e59b75c11c 100644 --- a/test/cxxtest/sample/msvc/CxxTest_Workspace.dsw +++ b/test/cxxtest/sample/msvc/CxxTest_Workspace.dsw @@ -56,4 +56,3 @@ Package=<3> }}} ############################################################################### - diff --git a/test/cxxtest/sample/only.tpl b/test/cxxtest/sample/only.tpl index b2a7277cf6..12fde95224 100644 --- a/test/cxxtest/sample/only.tpl +++ b/test/cxxtest/sample/only.tpl @@ -30,4 +30,3 @@ int main( int argc, char *argv[] ) // The CxxTest "world" - diff --git a/test/cxxtest/sample/winddk/SOURCES b/test/cxxtest/sample/winddk/SOURCES index dae0148885..3129141d8a 100644 --- a/test/cxxtest/sample/winddk/SOURCES +++ b/test/cxxtest/sample/winddk/SOURCES @@ -43,4 +43,3 @@ SOURCES=RunTests.cpp # This line tells the build utility to process Makefile.inc # NTTARGETFILE0=RunTests.cpp - -- cgit v1.2.3 From ab80b20a305728ecbe402ab0461c9a10cd7570b5 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Sun, 7 Aug 2011 10:19:30 +0200 Subject: COMMON: Replace x + ARRAYSIZE(x) by the simpler ARRAYEND(x). --- test/common/algorithm.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'test') diff --git a/test/common/algorithm.h b/test/common/algorithm.h index beba495e40..6eecae3635 100644 --- a/test/common/algorithm.h +++ b/test/common/algorithm.h @@ -38,30 +38,30 @@ public: const int arraySorted[] = { 1, 2, 3, 3, 4, 5 }; const int arrayUnsorted[] = { 5, 3, 1, 2, 4, 3 }; - TS_ASSERT_EQUALS(checkSort(arraySorted, arraySorted + ARRAYSIZE(arraySorted), Common::Less()), true); - TS_ASSERT_EQUALS(checkSort(arraySorted, arraySorted + ARRAYSIZE(arraySorted), Common::Greater()), false); + TS_ASSERT_EQUALS(checkSort(arraySorted, ARRAYEND(arraySorted), Common::Less()), true); + TS_ASSERT_EQUALS(checkSort(arraySorted, ARRAYEND(arraySorted), Common::Greater()), false); - TS_ASSERT_EQUALS(checkSort(arrayUnsorted, arrayUnsorted + ARRAYSIZE(arrayUnsorted), Common::Less()), false); - TS_ASSERT_EQUALS(checkSort(arrayUnsorted, arrayUnsorted + ARRAYSIZE(arrayUnsorted), Common::Greater()), false); + TS_ASSERT_EQUALS(checkSort(arrayUnsorted, ARRAYEND(arrayUnsorted), Common::Less()), false); + TS_ASSERT_EQUALS(checkSort(arrayUnsorted, ARRAYEND(arrayUnsorted), Common::Greater()), false); } void test_pod_sort() { { int array[] = { 63, 11, 31, 72, 1, 48, 32, 69, 38, 31 }; - Common::sort(array, array + ARRAYSIZE(array)); - TS_ASSERT_EQUALS(checkSort(array, array + ARRAYSIZE(array), Common::Less()), true); + Common::sort(array, ARRAYEND(array)); + TS_ASSERT_EQUALS(checkSort(array, ARRAYEND(array), Common::Less()), true); // already sorted - Common::sort(array, array + ARRAYSIZE(array)); - TS_ASSERT_EQUALS(checkSort(array, array + ARRAYSIZE(array), Common::Less()), true); + Common::sort(array, ARRAYEND(array)); + TS_ASSERT_EQUALS(checkSort(array, ARRAYEND(array), Common::Less()), true); } { int array[] = { 90, 80, 70, 60, 50, 40, 30, 20, 10 }; - Common::sort(array, array + ARRAYSIZE(array)); - TS_ASSERT_EQUALS(checkSort(array, array + ARRAYSIZE(array), Common::Less()), true); + Common::sort(array, ARRAYEND(array)); + TS_ASSERT_EQUALS(checkSort(array, ARRAYEND(array), Common::Less()), true); - Common::sort(array, array + ARRAYSIZE(array), Common::Greater()); - TS_ASSERT_EQUALS(checkSort(array, array + ARRAYSIZE(array), Common::Greater()), true); + Common::sort(array, ARRAYEND(array), Common::Greater()); + TS_ASSERT_EQUALS(checkSort(array, ARRAYEND(array), Common::Greater()), true); } } -- cgit v1.2.3 From 1e0b05ff992665467f762d61947a51407d1f1c41 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 19 Aug 2011 01:14:09 +0200 Subject: TEST: Add a very tiny and simple unit test for intLog2. --- test/common/math.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/common/math.h (limited to 'test') diff --git a/test/common/math.h b/test/common/math.h new file mode 100644 index 0000000000..5da0410e8e --- /dev/null +++ b/test/common/math.h @@ -0,0 +1,18 @@ +#include + +#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); + } +}; -- cgit v1.2.3