ReactOS
0.4.16-dev-334-g4d9f67c
greater_test.cpp
Go to the documentation of this file.
1
#include <vector>
2
#include <algorithm>
3
#include <functional>
4
5
#include "
cppunit/cppunit_proxy.h
"
6
7
#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
8
using namespace
std
;
9
#endif
10
11
//
12
// TestCase class
13
//
14
class
GreaterTest
:
public
CPPUNIT_NS::TestCase
15
{
16
CPPUNIT_TEST_SUITE
(
GreaterTest
);
17
CPPUNIT_TEST
(
greatert
);
18
CPPUNIT_TEST
(
greatereq
);
19
CPPUNIT_TEST_SUITE_END
();
20
21
protected
:
22
void
greatert
();
23
void
greatereq
();
24
};
25
26
CPPUNIT_TEST_SUITE_REGISTRATION
(
GreaterTest
);
27
28
//
29
// tests implementation
30
//
31
void
GreaterTest::greatert
()
32
{
33
int
array
[4] = { 3, 1, 4, 2 };
34
sort
(
array
,
array
+ 4,
greater<int>
() );
35
36
CPPUNIT_ASSERT
(
array
[0]==4);
37
CPPUNIT_ASSERT
(
array
[1]==3);
38
CPPUNIT_ASSERT
(
array
[2]==2);
39
CPPUNIT_ASSERT
(
array
[3]==1);
40
}
41
void
GreaterTest::greatereq
()
42
{
43
int
array
[4] = { 3, 1, 4, 2 };
44
sort
(
array
,
array
+ 4,
greater_equal<int>
());
45
CPPUNIT_ASSERT
(
array
[0]==4);
46
CPPUNIT_ASSERT
(
array
[1]==3);
47
CPPUNIT_ASSERT
(
array
[2]==2);
48
CPPUNIT_ASSERT
(
array
[3]==1);
49
}
sort
_STLP_MOVE_TO_STD_NAMESPACE void sort(_RandomAccessIter __first, _RandomAccessIter __last)
Definition:
_algo.c:993
GreaterTest
Definition:
greater_test.cpp:15
GreaterTest::CPPUNIT_TEST
CPPUNIT_TEST(greatereq)
GreaterTest::CPPUNIT_TEST_SUITE_END
CPPUNIT_TEST_SUITE_END()
GreaterTest::greatert
void greatert()
Definition:
greater_test.cpp:31
GreaterTest::CPPUNIT_TEST_SUITE
CPPUNIT_TEST_SUITE(GreaterTest)
GreaterTest::greatereq
void greatereq()
Definition:
greater_test.cpp:41
GreaterTest::CPPUNIT_TEST
CPPUNIT_TEST(greatert)
CPPUNIT_TEST_SUITE_REGISTRATION
#define CPPUNIT_TEST_SUITE_REGISTRATION(X)
Definition:
cppunit_mini.h:193
CPPUNIT_ASSERT
#define CPPUNIT_ASSERT(X)
Definition:
cppunit_mini.h:200
cppunit_proxy.h
std
Definition:
features.h:417
array
Definition:
wbemprox_private.h:130
greater_equal
Definition:
_function.h:54
greater
Definition:
_function.h:49
sdk
lib
3rdparty
stlport
test
unit
greater_test.cpp
Generated on Mon Dec 9 2024 06:13:11 for ReactOS by
1.9.6