Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenneq_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 NeqTest : public CPPUNIT_NS::TestCase 00015 { 00016 CPPUNIT_TEST_SUITE(NeqTest); 00017 CPPUNIT_TEST(negate0); 00018 CPPUNIT_TEST(nequal0); 00019 CPPUNIT_TEST_SUITE_END(); 00020 00021 protected: 00022 void negate0(); 00023 void nequal0(); 00024 }; 00025 00026 CPPUNIT_TEST_SUITE_REGISTRATION(NeqTest); 00027 00028 // 00029 // tests implementation 00030 // 00031 void NeqTest::negate0() 00032 { 00033 int input [3] = { 1, 2, 3 }; 00034 00035 int output[3]; 00036 transform((int*)input, (int*)input + 3, (int*)output, negate<int>()); 00037 00038 CPPUNIT_ASSERT(output[0]==-1); 00039 CPPUNIT_ASSERT(output[1]==-2); 00040 CPPUNIT_ASSERT(output[2]==-3); 00041 } 00042 void NeqTest::nequal0() 00043 { 00044 int input1 [4] = { 1, 7, 2, 2 }; 00045 int input2 [4] = { 1, 6, 2, 3 }; 00046 00047 int output [4]; 00048 transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, not_equal_to<int>()); 00049 00050 CPPUNIT_ASSERT(output[0]==0); 00051 CPPUNIT_ASSERT(output[1]==1); 00052 CPPUNIT_ASSERT(output[2]==0); 00053 CPPUNIT_ASSERT(output[3]==1); 00054 } Generated on Sun May 27 2012 04:35:38 for ReactOS by
1.7.6.1
|