ReactOS  0.4.15-dev-509-g96a357b
plusminus_test.cpp
Go to the documentation of this file.
1 #include <numeric>
2 #include <algorithm>
3 #include <functional>
4 
6 
7 #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
8 using namespace std;
9 #endif
10 
11 //
12 // TestCase class
13 //
14 class PlusMinusTest : public CPPUNIT_NS::TestCase
15 {
17  CPPUNIT_TEST(plus0);
18  CPPUNIT_TEST(minus0);
20 
21 protected:
22  void plus0();
23  void minus0();
24 };
25 
27 
28 //
29 // tests implementation
30 //
32 {
33  int input1 [4] = { 1, 6, 11, 8 };
34  int input2 [4] = { 1, 5, 2, 3 };
35 
36  int total = inner_product(input1, input1 + 4, input2, 0, plus<int>(), multiplies <int>());
37 
38  CPPUNIT_ASSERT(total==77);
39 }
41 {
42  int input1 [4] = { 1, 5, 7, 8 };
43  int input2 [4] = { 1, 4, 8, 3 };
44 
45  int output [4];
46 
47  transform((int*)input1, (int*)input1 + 4, (int*)input2, (int*)output, minus<int>());
48  CPPUNIT_ASSERT(output[0]==0);
49  CPPUNIT_ASSERT(output[1]==1);
50  CPPUNIT_ASSERT(output[2]==-1);
51  CPPUNIT_ASSERT(output[3]==5);
52 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
#define CPPUNIT_TEST_SUITE(X)
Definition: cppunit_mini.h:142
#define CPPUNIT_TEST(X)
Definition: cppunit_mini.h:182
Definition: features.h:417
#define CPPUNIT_TEST_SUITE_END()
Definition: cppunit_mini.h:191
_STLP_INLINE_LOOP _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp _Init)
Definition: _numeric.h:61
CPPUNIT_TEST_SUITE_REGISTRATION(PlusMinusTest)
#define CPPUNIT_ASSERT(X)
Definition: cppunit_mini.h:200
GLuint GLenum GLenum transform
Definition: glext.h:9407