ReactOS
0.4.16-dev-819-g75c0dc0
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
generator_test.cpp
Go to the documentation of this file.
1
#include <vector>
2
#include <algorithm>
3
#include "
fadapter.h
"
4
#include "
fib.h
"
5
6
#include "
cppunit/cppunit_proxy.h
"
7
8
#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
9
using namespace
std
;
10
#endif
11
12
//
13
// TestCase class
14
//
15
class
GeneratorTest
:
public
CPPUNIT_NS::TestCase
16
{
17
CPPUNIT_TEST_SUITE
(
GeneratorTest
);
18
CPPUNIT_TEST
(
gener1
);
19
CPPUNIT_TEST
(
gener2
);
20
CPPUNIT_TEST
(
genern1
);
21
CPPUNIT_TEST
(
genern2
);
22
CPPUNIT_TEST_SUITE_END
();
23
24
protected
:
25
void
gener1
();
26
void
gener2
();
27
void
genern1
();
28
void
genern2
();
29
};
30
31
CPPUNIT_TEST_SUITE_REGISTRATION
(
GeneratorTest
);
32
33
//
34
// tests implementation
35
//
36
37
static
int
cxxrand
() {
return
rand
();}
38
39
void
GeneratorTest::gener1
()
40
{
41
int
numbers[10];
42
#if defined(__MVS__)
43
generate
(numbers, numbers + 10,
ptr_gen
(
cxxrand
));
44
#else
45
generate
(numbers, numbers + 10,
cxxrand
);
46
#endif
47
// any suggestions?
48
}
49
void
GeneratorTest::gener2
()
50
{
51
vector <int>
v1
(10);
52
Fibonacci
generator;
53
generate
(
v1
.begin(),
v1
.end(), generator);
54
55
CPPUNIT_ASSERT
(
v1
[0]==1);
56
CPPUNIT_ASSERT
(
v1
[1]==1);
57
CPPUNIT_ASSERT
(
v1
[2]==2);
58
CPPUNIT_ASSERT
(
v1
[3]==3);
59
CPPUNIT_ASSERT
(
v1
[4]==5);
60
CPPUNIT_ASSERT
(
v1
[5]==8);
61
CPPUNIT_ASSERT
(
v1
[6]==13);
62
CPPUNIT_ASSERT
(
v1
[7]==21);
63
CPPUNIT_ASSERT
(
v1
[8]==34);
64
CPPUNIT_ASSERT
(
v1
[9]==55);
65
}
66
void
GeneratorTest::genern1
()
67
{
68
#if !defined (_STLP_MEMBER_POINTER_PARAM_BUG)
69
//*TY 07/18/98 - added conditional
70
// since ptr_gen() is not defined under this condition
71
// (see xfunction.h)
72
vector <int>
v1
(10);
73
generate_n
(
v1
.begin(),
v1
.size(),
ptr_gen
(
cxxrand
));
74
#endif
//_STLP_MEMBER_POINTER_PARAM_BUG //*TY 07/18/98 - added
75
}
76
void
GeneratorTest::genern2
()
77
{
78
vector <int>
v1
(10);
79
Fibonacci
generator;
80
generate_n
(
v1
.begin(),
v1
.size(), generator);
81
82
CPPUNIT_ASSERT
(
v1
[0]==1);
83
CPPUNIT_ASSERT
(
v1
[1]==1);
84
CPPUNIT_ASSERT
(
v1
[2]==2);
85
CPPUNIT_ASSERT
(
v1
[3]==3);
86
CPPUNIT_ASSERT
(
v1
[4]==5);
87
CPPUNIT_ASSERT
(
v1
[5]==8);
88
CPPUNIT_ASSERT
(
v1
[6]==13);
89
CPPUNIT_ASSERT
(
v1
[7]==21);
90
CPPUNIT_ASSERT
(
v1
[8]==34);
91
CPPUNIT_ASSERT
(
v1
[9]==55);
92
}
generate_n
_STLP_INLINE_LOOP void generate_n(_OutputIter __first, _Size __n, _Generator __gen)
Definition:
_algo.h:230
Fibonacci
Definition:
fib.h:4
GeneratorTest
Definition:
generator_test.cpp:16
GeneratorTest::CPPUNIT_TEST
CPPUNIT_TEST(gener1)
GeneratorTest::gener1
void gener1()
Definition:
generator_test.cpp:39
GeneratorTest::CPPUNIT_TEST_SUITE
CPPUNIT_TEST_SUITE(GeneratorTest)
GeneratorTest::CPPUNIT_TEST
CPPUNIT_TEST(gener2)
GeneratorTest::gener2
void gener2()
Definition:
generator_test.cpp:49
GeneratorTest::genern1
void genern1()
Definition:
generator_test.cpp:66
GeneratorTest::CPPUNIT_TEST
CPPUNIT_TEST(genern2)
GeneratorTest::CPPUNIT_TEST_SUITE_END
CPPUNIT_TEST_SUITE_END()
GeneratorTest::genern2
void genern2()
Definition:
generator_test.cpp:76
GeneratorTest::CPPUNIT_TEST
CPPUNIT_TEST(genern1)
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
fadapter.h
ptr_gen
pointer_to_void_function< Result > ptr_gen(Result(*x)())
Definition:
fadapter.h:39
fib.h
cxxrand
static int cxxrand()
Definition:
generator_test.cpp:37
v1
GLfloat GLfloat v1
Definition:
glext.h:6062
rand
_Check_return_ int __cdecl rand(void)
Definition:
rand.c:10
std
Definition:
features.h:417
generate
static int generate
Definition:
xmllint.c:164
sdk
lib
3rdparty
stlport
test
unit
generator_test.cpp
Generated on Sat Mar 15 2025 06:14:17 for ReactOS by
1.9.6