1 #include <numeric> 2 #include <functional> 3 4 #include "cppunit/cppunit_proxy.h" 5 6 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES) 7 using namespace std; 8 #endif 9 10 // 11 // TestCase class 12 // 13 class DivideTest : public CPPUNIT_NS::TestCase 14 { 15 CPPUNIT_TEST_SUITE(DivideTest); 16 CPPUNIT_TEST(div); 17 CPPUNIT_TEST_SUITE_END(); 18 19 protected: 20 void div(); 21 }; 22 23 CPPUNIT_TEST_SUITE_REGISTRATION(DivideTest); 24 25 // 26 // tests implementation 27 // 28 void DivideTest::div() 29 { 30 int input [3] = { 2, 3, 4 }; 31 int result = accumulate(input, input + 3, 48, divides<int>()); 32 CPPUNIT_ASSERT(result==2); 33 } 34