From 1cd917f67446be1438fabfdec43b87e6f6f797a7 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 27 Dec 2009 11:05:43 +0000 Subject: More cleanup. svn-id: r46619 --- test/common/algorithm.h | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'test/common/algorithm.h') diff --git a/test/common/algorithm.h b/test/common/algorithm.h index 4d53c87099..8ce0290c7e 100644 --- a/test/common/algorithm.h +++ b/test/common/algorithm.h @@ -22,14 +22,11 @@ class AlgorithmTestSuite : public CxxTest::TestSuite { struct Item { int value; Item(int v) : value(v) {} - }; - struct ItemCmp { - bool operator()(const Item &a, const Item &b) { - return a.value < b.value; + bool operator<(const Item &r) const { + return value < r.value; } }; - public: void test_pod_sort() { { @@ -37,7 +34,8 @@ public: Common::sort(array, array + ARRAYSIZE(array)); checkSort(array, array + ARRAYSIZE(array), Common::Less()); - Common::sort(array, array + ARRAYSIZE(array)); //already sorted one + // already sorted + Common::sort(array, array + ARRAYSIZE(array)); checkSort(array, array + ARRAYSIZE(array), Common::Less()); } { @@ -57,12 +55,12 @@ public: for(int i = 0; i < n; ++i) list.push_back(Item(i * 0xDEADBEEF % 1337)); - Common::sort(list.begin(), list.end(), ItemCmp()); - checkSort(list.begin(), list.end(), ItemCmp()); + Common::sort(list.begin(), list.end(), Common::Less()); + checkSort(list.begin(), list.end(), Common::Less()); - //already sorted - Common::sort(list.begin(), list.end(), ItemCmp()); - checkSort(list.begin(), list.end(), ItemCmp()); + // already sorted + Common::sort(list.begin(), list.end(), Common::Less()); + checkSort(list.begin(), list.end(), Common::Less()); } }; -- cgit v1.2.3