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