ReactOS
0.4.16-dev-983-g23ad936
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
Variables
_
c
d
e
f
g
h
i
l
m
n
o
p
s
t
u
x
Typedefs
_
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
w
x
Enumerations
_
a
b
c
d
f
i
l
m
o
p
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
m
n
o
p
r
s
t
u
v
w
x
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
h
i
k
l
m
n
o
p
r
s
t
u
v
w
z
Enumerator
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Properties
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Related Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
x
Files
File List
File Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Examples
max_test.cpp
Go to the documentation of this file.
1
#include <vector>
2
#include <algorithm>
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
MaxTest
:
public
CPPUNIT_NS::TestCase
14
{
15
CPPUNIT_TEST_SUITE
(
MaxTest
);
16
CPPUNIT_TEST
(
max1
);
17
CPPUNIT_TEST
(
max2
);
18
CPPUNIT_TEST
(
maxelem1
);
19
CPPUNIT_TEST
(
maxelem2
);
20
CPPUNIT_TEST_SUITE_END
();
21
22
protected
:
23
void
max1
();
24
void
max2
();
25
void
maxelem1
();
26
void
maxelem2
();
27
28
static
bool
str_compare
(
const
char
* a_,
const
char
* b_)
29
{
return
strcmp
(a_, b_) < 0 ? 1 : 0; }
30
};
31
32
CPPUNIT_TEST_SUITE_REGISTRATION
(
MaxTest
);
33
34
//
35
// tests implementation
36
//
37
void
MaxTest::max1
()
38
{
39
int
r
=
max
(42, 100);
40
CPPUNIT_ASSERT
(
r
== 100 );
41
42
int
t
=
max
(++
r
, 0);
43
CPPUNIT_ASSERT
(
t
== 101 );
44
}
45
void
MaxTest::max2
()
46
{
47
const
char
*
r
=
max
((
const
char
*)
"shoe"
, (
const
char
*)
"shine"
,
str_compare
);
48
CPPUNIT_ASSERT
(!
strcmp
(
r
,
"shoe"
));
49
}
50
void
MaxTest::maxelem1
()
51
{
52
int
numbers[6] = { 4, 10, 56, 11, -42, 19 };
53
54
int
*
r
=
max_element
((
int
*)numbers, (
int
*)numbers + 6);
55
CPPUNIT_ASSERT
(*
r
==56);
56
}
57
void
MaxTest::maxelem2
()
58
{
59
const
char
*
names
[] = {
"Brett"
,
"Graham"
,
"Jack"
,
"Mike"
,
"Todd"
};
60
61
const
unsigned
namesCt =
sizeof
(
names
) /
sizeof
(
names
[0]);
62
const
char
**
r
=
max_element
((
const
char
**)
names
, (
const
char
**)
names
+ namesCt,
str_compare
);
63
CPPUNIT_ASSERT
(!
strcmp
(*
r
,
"Todd"
));
64
}
max_element
_ForwardIter max_element(_ForwardIter __first, _ForwardIter __last)
Definition:
_algo.c:1800
strcmp
int strcmp(const char *String1, const char *String2)
Definition:
utclib.c:469
MaxTest
Definition:
max_test.cpp:14
MaxTest::CPPUNIT_TEST
CPPUNIT_TEST(max1)
MaxTest::str_compare
static bool str_compare(const char *a_, const char *b_)
Definition:
max_test.cpp:28
MaxTest::max1
void max1()
Definition:
max_test.cpp:37
MaxTest::maxelem1
void maxelem1()
Definition:
max_test.cpp:50
MaxTest::CPPUNIT_TEST
CPPUNIT_TEST(max2)
MaxTest::max2
void max2()
Definition:
max_test.cpp:45
MaxTest::CPPUNIT_TEST
CPPUNIT_TEST(maxelem2)
MaxTest::CPPUNIT_TEST
CPPUNIT_TEST(maxelem1)
MaxTest::CPPUNIT_TEST_SUITE_END
CPPUNIT_TEST_SUITE_END()
MaxTest::maxelem2
void maxelem2()
Definition:
max_test.cpp:57
MaxTest::CPPUNIT_TEST_SUITE
CPPUNIT_TEST_SUITE(MaxTest)
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
r
GLdouble GLdouble GLdouble r
Definition:
gl.h:2055
t
GLdouble GLdouble t
Definition:
gl.h:2047
names
GLuint GLuint * names
Definition:
glext.h:11545
std
Definition:
features.h:417
max
#define max(a, b)
Definition:
svc.c:63
sdk
lib
3rdparty
stlport
test
unit
max_test.cpp
Generated on Thu Apr 17 2025 06:15:20 for ReactOS by
1.9.6