Main Page
Related Pages
API Reference
Namespace List
Namespace List
Namespace Members
All
a
b
c
d
e
f
g
h
i
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
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
g
i
n
o
p
r
s
t
v
w
x
z
Enumerations
a
b
c
d
e
f
g
i
l
m
n
o
p
r
s
t
w
x
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
p
r
s
t
u
v
w
x
y
z
Class List
Class List
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
i
k
l
m
n
o
p
r
s
t
v
z
Enumerations
b
c
e
f
g
h
k
o
p
r
s
t
v
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
y
z
Related Functions
:
c
d
e
f
g
i
l
m
n
o
p
r
s
t
u
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
y
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
Variables
_
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
r
s
t
u
v
w
x
y
Typedefs
Enumerations
Enumerator
Macros
_
a
c
d
f
g
h
i
l
m
n
o
p
r
s
t
v
x
Examples
core
tests
Utilities
EnumIterator_T.cpp
Go to the documentation of this file.
1
//==============================================================================
2
//
3
// This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4
//
5
// The GNSSTk is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU Lesser General Public License as published
7
// by the Free Software Foundation; either version 3.0 of the License, or
8
// any later version.
9
//
10
// The GNSSTk is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU Lesser General Public License for more details.
14
//
15
// You should have received a copy of the GNU Lesser General Public
16
// License along with GNSSTk; if not, write to the Free Software Foundation,
17
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18
//
19
// This software was developed by Applied Research Laboratories at the
20
// University of Texas at Austin.
21
// Copyright 2004-2022, The Board of Regents of The University of Texas System
22
//
23
//==============================================================================
24
25
//==============================================================================
26
//
27
// This software was developed by Applied Research Laboratories at the
28
// University of Texas at Austin, under contract to an agency or agencies
29
// within the U.S. Department of Defense. The U.S. Government retains all
30
// rights to use, duplicate, distribute, disclose, or release this software.
31
//
32
// Pursuant to DoD Directive 523024
33
//
34
// DISTRIBUTION STATEMENT A: This software has been approved for public
35
// release, distribution is unlimited.
36
//
37
//==============================================================================
38
39
#include "
TestUtil.hpp
"
40
#include "
EnumIterator.hpp
"
41
#include <iostream>
42
43
using namespace
std
;
44
45
enum class
TestEnum1
46
{
47
One
,
48
Two
,
49
Three
,
50
Four
,
51
Five
,
52
Last
53
};
54
55
ostream&
operator<<
(ostream& s,
TestEnum1
e)
56
{
57
s << static_cast<int>(e);
58
return
s;
59
}
60
61
class
EnumIterator_T
62
{
63
public
:
64
unsigned
constructorTest();
65
unsigned
incrementTest();
66
unsigned
inequalityTest();
67
unsigned
beginEndTest();
68
};
69
70
71
unsigned
EnumIterator_T ::
72
constructorTest
()
73
{
74
TUDEF
(
"EnumIterator"
,
"EnumIterator()"
);
75
typedef
gnsstk::EnumIterator<TestEnum1, TestEnum1::One, TestEnum1::Last>
TestIterator1;
76
TestIterator1 test1;
77
// this also tests the dereference operator
78
TUASSERTE
(
TestEnum1
,
TestEnum1::One
, *test1);
79
80
typedef
gnsstk::EnumIterator<TestEnum1, TestEnum1::Two, TestEnum1::Last>
TestIterator2;
81
TestIterator2 test2;
82
// this also tests the dereference operator
83
TUASSERTE
(
TestEnum1
,
TestEnum1::Two
, *test2);
84
85
TUCSM
(
"EnumIterator(C)"
);
86
TestIterator1 test3(
TestEnum1::Three
);
87
// this also tests the dereference operator
88
TUASSERTE
(
TestEnum1
,
TestEnum1::Three
, *test3);
89
90
TURETURN
();
91
}
92
93
94
unsigned
EnumIterator_T ::
95
incrementTest
()
96
{
97
TUDEF
(
"EnumIterator"
,
"operator++"
);
98
typedef
gnsstk::EnumIterator<TestEnum1, TestEnum1::One, TestEnum1::Last>
TestIterator1;
99
TestIterator1 test1;
100
// this also tests the dereference operator
101
TUASSERTE
(
TestEnum1
,
TestEnum1::One
, *test1);
102
++test1;
103
TUASSERTE
(
TestEnum1
,
TestEnum1::Two
, *test1);
104
TURETURN
();
105
}
106
107
108
unsigned
EnumIterator_T ::
109
inequalityTest
()
110
{
111
TUDEF
(
"EnumIterator"
,
"operator!="
);
112
typedef
gnsstk::EnumIterator<TestEnum1, TestEnum1::One, TestEnum1::Last>
TestIterator1;
113
TestIterator1 test1, test2;
114
TUASSERT
(!(test1.operator!=(test2)));
115
++test2;
116
TUASSERT
(test1.operator!=(test2));
117
TURETURN
();
118
}
119
120
121
unsigned
EnumIterator_T ::
122
beginEndTest
()
123
{
124
TUDEF
(
"EnumIterator"
,
"begin/end"
);
125
typedef
gnsstk::EnumIterator<TestEnum1, TestEnum1::One, TestEnum1::Last>
TestIterator1;
126
unsigned
count = 0;
127
TestIterator1 test;
128
for
(test = test.begin(); test != test.end(); ++test, count++)
129
{
130
}
131
TUASSERTE
(
unsigned
, 5, count);
132
// nicer syntax
133
count = 0;
134
for
(
TestEnum1
e : TestIterator1())
135
{
136
count++;
137
}
138
TUASSERTE
(
unsigned
, 5, count);
139
TURETURN
();
140
}
141
142
143
int
main
()
144
{
145
unsigned
errorTotal = 0;
146
EnumIterator_T
testClass;
147
errorTotal += testClass.
constructorTest
();
148
errorTotal += testClass.
incrementTest
();
149
errorTotal += testClass.
inequalityTest
();
150
errorTotal += testClass.
beginEndTest
();
151
cout <<
"Total Failures for "
<< __FILE__ <<
": "
<< errorTotal << endl;
152
return
errorTotal;
153
}
TUCSM
#define TUCSM(METHOD)
Definition:
TestUtil.hpp:59
EnumIterator_T::inequalityTest
unsigned inequalityTest()
Definition:
EnumIterator_T.cpp:109
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition:
TestUtil.hpp:81
TestEnum1::One
@ One
EnumIterator_T::incrementTest
unsigned incrementTest()
Definition:
EnumIterator_T.cpp:95
main
int main()
Definition:
EnumIterator_T.cpp:143
EnumIterator_T::constructorTest
unsigned constructorTest()
Definition:
EnumIterator_T.cpp:72
TUASSERT
#define TUASSERT(EXPR)
Definition:
TestUtil.hpp:63
TestEnum1::Two
@ Two
TestUtil.hpp
TURETURN
#define TURETURN()
Definition:
TestUtil.hpp:232
TestEnum1::Three
@ Three
EnumIterator.hpp
TUDEF
#define TUDEF(CLASS, METHOD)
Definition:
TestUtil.hpp:56
std::operator<<
std::ostream & operator<<(std::ostream &s, gnsstk::StringUtils::FFLead v)
Definition:
FormattedDouble_T.cpp:44
EnumIterator_T
Definition:
EnumIterator_T.cpp:61
gnsstk::EnumIterator
Definition:
EnumIterator.hpp:68
std
Definition:
Angle.hpp:142
EnumIterator_T::beginEndTest
unsigned beginEndTest()
Definition:
EnumIterator_T.cpp:122
TestEnum1::Four
@ Four
TestEnum1
TestEnum1
Definition:
EnumIterator_T.cpp:45
TestEnum1::Five
@ Five
gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:39