Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenplusminus_test.cpp
Go to the documentation of this file.
00001 #include <numeric> 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 PlusMinusTest : public CPPUNIT_NS::TestCase 00015 { 00016 CPPUNIT_TEST_SUITE(PlusMinusTest); 00017 CPPUNIT_TEST(plus0); 00018 CPPUNIT_TEST(minus0); 00019 CPPUNIT_TEST_SUITE_END(); 00020 00021 protected: 00022 void plus0(); 00023 void minus0(); 00024 }; 00025 00026 CPPUNIT_TEST_SUITE_REGISTRATION(PlusMinusTest); 00027 00028 // 00029 // tests implementation 00030 // 00031 void PlusMinusTest::plus0() 00032 { 00033 int input1 [4] = { 1, 6, 11, 8 }; 00034 int input2 [4] = { 1, 5, 2, 3 }; 00035 00036 int total = inner_product(input1, input1 + 4, input2, 0, plus<int>(), multiplies <int>()); 00037 00038 CPPUNIT_ASSERT(total==77); 00039 } 00040 void PlusMinusTest::minus0() 00041 { 00042 int input1 [4] = { 1, 5, 7, 8 }; 00043 int input2 [4] = { 1, 4, 8, 3 }; 00044 00045 int output [4]; 00046 00047 transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, minus<int>()); 00048 CPPUNIT_ASSERT(output[0]==0); 00049 CPPUNIT_ASSERT(output[1]==1); 00050 CPPUNIT_ASSERT(output[2]==-1); 00051 CPPUNIT_ASSERT(output[3]==5); 00052 } Generated on Sun May 27 2012 04:35:39 for ReactOS by
1.7.6.1
|