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