Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygengreater_test.cpp
Go to the documentation of this file.
00001 #include <vector> 00002 #include <algorithm> 00003 #include <functional> 00004 00005 #include "cppunit/cppunit_proxy.h" 00006 00007 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) 00008 using namespace std; 00009 #endif 00010 00011 // 00012 // TestCase class 00013 // 00014 class GreaterTest : public CPPUNIT_NS::TestCase 00015 { 00016 CPPUNIT_TEST_SUITE(GreaterTest); 00017 CPPUNIT_TEST(greatert); 00018 CPPUNIT_TEST(greatereq); 00019 CPPUNIT_TEST_SUITE_END(); 00020 00021 protected: 00022 void greatert(); 00023 void greatereq(); 00024 }; 00025 00026 CPPUNIT_TEST_SUITE_REGISTRATION(GreaterTest); 00027 00028 // 00029 // tests implementation 00030 // 00031 void GreaterTest::greatert() 00032 { 00033 int array[4] = { 3, 1, 4, 2 }; 00034 sort(array, array + 4, greater<int>() ); 00035 00036 CPPUNIT_ASSERT(array[0]==4); 00037 CPPUNIT_ASSERT(array[1]==3); 00038 CPPUNIT_ASSERT(array[2]==2); 00039 CPPUNIT_ASSERT(array[3]==1); 00040 } 00041 void GreaterTest::greatereq() 00042 { 00043 int array [4] = { 3, 1, 4, 2 }; 00044 sort(array, array + 4, greater_equal<int>()); 00045 CPPUNIT_ASSERT(array[0]==4); 00046 CPPUNIT_ASSERT(array[1]==3); 00047 CPPUNIT_ASSERT(array[2]==2); 00048 CPPUNIT_ASSERT(array[3]==1); 00049 } Generated on Sun May 27 2012 04:35:25 for ReactOS by
1.7.6.1
|