First public contribution.
5 #include "cppunit/cppunit_proxy.h"
7 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
14 class GreaterTest : public CPPUNIT_NS::TestCase
16 CPPUNIT_TEST_SUITE(GreaterTest);
17 CPPUNIT_TEST(greatert);
18 CPPUNIT_TEST(greatereq);
19 CPPUNIT_TEST_SUITE_END();
26 CPPUNIT_TEST_SUITE_REGISTRATION(GreaterTest);
29 // tests implementation
31 void GreaterTest::greatert()
33 int array[4] = { 3, 1, 4, 2 };
34 sort(array, array + 4, greater<int>() );
36 CPPUNIT_ASSERT(array[0]==4);
37 CPPUNIT_ASSERT(array[1]==3);
38 CPPUNIT_ASSERT(array[2]==2);
39 CPPUNIT_ASSERT(array[3]==1);
41 void GreaterTest::greatereq()
43 int array [4] = { 3, 1, 4, 2 };
44 sort(array, array + 4, greater_equal<int>());
45 CPPUNIT_ASSERT(array[0]==4);
46 CPPUNIT_ASSERT(array[1]==3);
47 CPPUNIT_ASSERT(array[2]==2);
48 CPPUNIT_ASSERT(array[3]==1);