1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/cppstdlib/stl/test/unit/times_test.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,34 @@
1.4 +#include <algorithm>
1.5 +#include <numeric>
1.6 +#include <functional>
1.7 +
1.8 +#include "cppunit/cppunit_proxy.h"
1.9 +
1.10 +#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
1.11 +using namespace std;
1.12 +#endif
1.13 +
1.14 +//
1.15 +// TestCase class
1.16 +//
1.17 +class TimesTest : public CPPUNIT_NS::TestCase
1.18 +{
1.19 + CPPUNIT_TEST_SUITE(TimesTest);
1.20 + CPPUNIT_TEST(times);
1.21 + CPPUNIT_TEST_SUITE_END();
1.22 +
1.23 +protected:
1.24 + void times();
1.25 +};
1.26 +
1.27 +CPPUNIT_TEST_SUITE_REGISTRATION(TimesTest);
1.28 +
1.29 +//
1.30 +// tests implementation
1.31 +//
1.32 +void TimesTest::times()
1.33 +{
1.34 + int input [4] = { 1, 5, 7, 2 };
1.35 + int total = accumulate(input, input + 4, 1, multiplies<int>());
1.36 + CPPUNIT_ASSERT(total==70);
1.37 +}