#include "CompareTest.h" #include <set> #include <vector> #include <pair> #include <map> CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( CompareTest, "bits" ); CPPUNIT_TEST_SUITE_REGISTRATION( CompareTest ); void CompareTest::setUp() { } void CompareTest::tearDown() { } void CompareTest::testCompare() { std::vector<int> vector1 {1, 2, 3}; std::vector<int> vector2 {2, 3, 4}; std::compare<std::vector<int>> comp1; CPPUNIT_ASSERT(comp1(vector1, vector2) < 0); std::set<std::vector<int>> set1 {vector1}; std::set<std::vector<int>> set2 {vector2}; std::compare<std::set<std::vector<int>>> comp2; CPPUNIT_ASSERT(comp2(set1, set2) < 0); std::pair<std::set<std::vector<int>>, std::set<std::vector<int>>> pair1 {set1, set2}; std::pair<std::set<std::vector<int>>, std::set<std::vector<int>>> pair2 {set2, set1}; std::compare<std::pair<std::set<std::vector<int>>, std::set<std::vector<int>>>> comp3; CPPUNIT_ASSERT(comp3(pair1, pair2) < 0); int two = 2; int three = 3; int four = 4; std::map<int, const int*> map1 = { {1, &two}, {2, &three} }; std::map<int, const int*> map2 = { {2, &three}, {3, &four} }; std::compare<std::map<int, const int*>> comp4; CPPUNIT_ASSERT(comp4(map1, map2) < 0); auto first = std::tie(vector1, set1, pair1, map1); auto second = std::tie(vector2, set2, pair2, map2); std::compare<decltype ( first ) > comp5; CPPUNIT_ASSERT(comp5(first, second) < 0); }