Home | History | Annotate | Download | only in unit
      1 #include <vector>
      2 #include <algorithm>
      3 #include <functional>
      4 
      5 #include "cppunit/cppunit_proxy.h"
      6 
      7 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
      8 using namespace std;
      9 #endif
     10 
     11 //
     12 // TestCase class
     13 //
     14 class LexcmpTest : public CPPUNIT_NS::TestCase
     15 {
     16   CPPUNIT_TEST_SUITE(LexcmpTest);
     17   CPPUNIT_TEST(lexcmp1);
     18   CPPUNIT_TEST(lexcmp2);
     19   CPPUNIT_TEST_SUITE_END();
     20 
     21 protected:
     22   void lexcmp1();
     23   void lexcmp2();
     24 };
     25 
     26 CPPUNIT_TEST_SUITE_REGISTRATION(LexcmpTest);
     27 
     28 //
     29 // tests implementation
     30 //
     31 void LexcmpTest::lexcmp1()
     32 {
     33   const unsigned size = 6;
     34   char n1[size] = "shoe";
     35   char n2[size] = "shine";
     36 
     37   bool before = lexicographical_compare(n1, n1 + size, n2, n2 + size);
     38   CPPUNIT_ASSERT(!before);
     39 }
     40 void LexcmpTest::lexcmp2()
     41 {
     42   const unsigned size = 6;
     43   char n1[size] = "shoe";
     44   char n2[size] = "shine";
     45 
     46   bool before = lexicographical_compare(n1, n1 + size, n2, n2 + size, greater<char>());
     47   CPPUNIT_ASSERT(before);
     48 }
     49