More cleanup.

svn-id: r46619
This commit is contained in:
Johannes Schickel 2009-12-27 11:05:43 +00:00
parent 7f8beedda7
commit 1cd917f674

View file

@ -22,14 +22,11 @@ class AlgorithmTestSuite : public CxxTest::TestSuite {
struct Item { struct Item {
int value; int value;
Item(int v) : value(v) {} Item(int v) : value(v) {}
};
struct ItemCmp { bool operator<(const Item &r) const {
bool operator()(const Item &a, const Item &b) { return value < r.value;
return a.value < b.value;
} }
}; };
public: public:
void test_pod_sort() { void test_pod_sort() {
{ {
@ -37,7 +34,8 @@ public:
Common::sort(array, array + ARRAYSIZE(array)); Common::sort(array, array + ARRAYSIZE(array));
checkSort(array, array + ARRAYSIZE(array), Common::Less<int>()); checkSort(array, array + ARRAYSIZE(array), Common::Less<int>());
Common::sort(array, array + ARRAYSIZE(array)); //already sorted one // already sorted
Common::sort(array, array + ARRAYSIZE(array));
checkSort(array, array + ARRAYSIZE(array), Common::Less<int>()); checkSort(array, array + ARRAYSIZE(array), Common::Less<int>());
} }
{ {
@ -57,12 +55,12 @@ public:
for(int i = 0; i < n; ++i) for(int i = 0; i < n; ++i)
list.push_back(Item(i * 0xDEADBEEF % 1337)); list.push_back(Item(i * 0xDEADBEEF % 1337));
Common::sort(list.begin(), list.end(), ItemCmp()); Common::sort(list.begin(), list.end(), Common::Less<Item>());
checkSort(list.begin(), list.end(), ItemCmp()); checkSort(list.begin(), list.end(), Common::Less<Item>());
//already sorted // already sorted
Common::sort(list.begin(), list.end(), ItemCmp()); Common::sort(list.begin(), list.end(), Common::Less<Item>());
checkSort(list.begin(), list.end(), ItemCmp()); checkSort(list.begin(), list.end(), Common::Less<Item>());
} }
}; };