Teuchos Package Browser (Single Doxygen Collection)
Version of the Day
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
core
src
Teuchos_UnitTestHelpers.hpp
Go to the documentation of this file.
1
// @HEADER
2
// *****************************************************************************
3
// Teuchos: Common Tools Package
4
//
5
// Copyright 2004 NTESS and the Teuchos contributors.
6
// SPDX-License-Identifier: BSD-3-Clause
7
// *****************************************************************************
8
// @HEADER
9
10
#ifndef TEUCHOS_UNIT_TEST_HELPERS_HPP
11
#define TEUCHOS_UNIT_TEST_HELPERS_HPP
12
13
25
#include "
Teuchos_UnitTestBase.hpp
"
26
#include "
Teuchos_StaticSetupMacro.hpp
"
27
28
51
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME) \
52
class TEST_GROUP##_##TEST_NAME##_UnitTest : public Teuchos::UnitTestBase \
53
{ \
54
public: \
55
TEST_GROUP##_##TEST_NAME##_UnitTest() \
56
: Teuchos::UnitTestBase( #TEST_GROUP, #TEST_NAME ) \
57
{} \
58
virtual void runUnitTestImpl( Teuchos::FancyOStream &out, bool &success ) const override; \
59
virtual std::string unitTestFile() const override { return __FILE__; } \
60
virtual long int unitTestFileLineNumber() const override { return __LINE__; } \
61
}; \
62
\
63
[[maybe_unused]] TEST_GROUP##_##TEST_NAME##_UnitTest \
64
instance_##TEST_GROUP##_##TEST_NAME##_UnitTest; \
65
\
66
void TEST_GROUP##_##TEST_NAME##_UnitTest::runUnitTestImpl( \
67
Teuchos::FancyOStream &out, bool &success ) const \
68
69
128
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(TEST_GROUP, TEST_NAME, TYPE) \
129
template<class TYPE> \
130
class TEST_GROUP##_##TEST_NAME##_UnitTest : public Teuchos::UnitTestBase \
131
{ \
132
public: \
133
TEST_GROUP##_##TEST_NAME##_UnitTest(const std::string& typeName) \
134
: Teuchos::UnitTestBase( std::string(#TEST_GROUP)+"_"+typeName, #TEST_NAME ) \
135
{} \
136
void runUnitTestImpl( Teuchos::FancyOStream &out, bool &success ) const; \
137
virtual std::string unitTestFile() const { return __FILE__; } \
138
virtual long int unitTestFileLineNumber() const { return __LINE__; } \
139
}; \
140
\
141
template<class TYPE> \
142
void TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE>::runUnitTestImpl( \
143
Teuchos::FancyOStream &out, bool &success ) const \
144
145
155
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(TEST_GROUP, TEST_NAME, TYPE) \
156
\
157
template class TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE>; \
158
TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE> \
159
instance_##TEST_GROUP##_##TYPE##_##TEST_NAME##_UnitTest(#TYPE);
160
161
162
#ifdef HAVE_TEUCHOS_INST_FLOAT
163
# define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_FLOAT(TEST_GROUP, TEST_NAME)\
164
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(TEST_GROUP, TEST_NAME, float)
165
#else
166
# define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_FLOAT(TEST_GROUP, TEST_NAME)
167
#endif
168
169
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_DOUBLE(TEST_GROUP, TEST_NAME)\
170
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(TEST_GROUP, TEST_NAME, double)
171
172
#ifdef HAVE_TEUCHOS_INST_COMPLEX_FLOAT
173
# define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_FLOAT(TEST_GROUP, TEST_NAME)\
174
typedef std::complex<float> ComplexFloat; \
175
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(TEST_GROUP, TEST_NAME, ComplexFloat)
176
#else
177
# define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_FLOAT(TEST_GROUP, TEST_NAME)
178
#endif
179
180
#ifdef HAVE_TEUCHOS_INST_COMPLEX_DOUBLE
181
# define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_DOUBLE(TEST_GROUP, TEST_NAME)\
182
typedef std::complex<double> ComplexDouble; \
183
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT(TEST_GROUP, TEST_NAME, ComplexDouble)
184
#else
185
# define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_DOUBLE(TEST_GROUP, TEST_NAME)
186
#endif
187
188
194
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_REAL_SCALAR_TYPES(TEST_GROUP, TEST_NAME)\
195
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_FLOAT(TEST_GROUP, TEST_NAME) \
196
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_DOUBLE(TEST_GROUP, TEST_NAME)
197
198
203
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_SCALAR_TYPES(TEST_GROUP, TEST_NAME)\
204
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_FLOAT(TEST_GROUP, TEST_NAME) \
205
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_DOUBLE(TEST_GROUP, TEST_NAME) \
206
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_FLOAT(TEST_GROUP, TEST_NAME) \
207
TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_COMPLEX_DOUBLE(TEST_GROUP, TEST_NAME)
208
209
270
#define TEUCHOS_UNIT_TEST_TEMPLATE_2_DECL(TEST_GROUP, TEST_NAME, TYPE1, TYPE2) \
271
template<class TYPE1, class TYPE2> \
272
class TEST_GROUP##_##TEST_NAME##_UnitTest : public Teuchos::UnitTestBase \
273
{ \
274
public: \
275
TEST_GROUP##_##TEST_NAME##_UnitTest( \
276
const std::string& type1Name, \
277
const std::string& type2Name \
278
) \
279
:Teuchos::UnitTestBase( \
280
std::string(#TEST_GROUP)+"_"+type1Name+"_"+type2Name, #TEST_NAME ) \
281
{} \
282
void runUnitTestImpl( Teuchos::FancyOStream &out, bool &success ) const; \
283
virtual std::string unitTestFile() const { return __FILE__; } \
284
virtual long int unitTestFileLineNumber() const { return __LINE__; } \
285
}; \
286
\
287
template<class TYPE1, class TYPE2> \
288
void TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1,TYPE2>::runUnitTestImpl( \
289
Teuchos::FancyOStream &out, bool &success ) const \
290
291
301
#define TEUCHOS_UNIT_TEST_TEMPLATE_2_INSTANT(TEST_GROUP, TEST_NAME, TYPE1, TYPE2) \
302
\
303
template class TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1, TYPE2 >; \
304
TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1, TYPE2 > \
305
instance_##TEST_GROUP##_##TYPE1##_##TYPE2##_##TEST_NAME##_UnitTest(#TYPE1,#TYPE2);
306
307
312
#define TEUCHOS_UNIT_TEST_TEMPLATE_3_DECL(TEST_GROUP, TEST_NAME, TYPE1, TYPE2, TYPE3) \
313
template<class TYPE1, class TYPE2, class TYPE3> \
314
class TEST_GROUP##_##TEST_NAME##_UnitTest : public Teuchos::UnitTestBase \
315
{ \
316
public: \
317
TEST_GROUP##_##TEST_NAME##_UnitTest( \
318
const std::string& type1Name, \
319
const std::string& type2Name, \
320
const std::string& type3Name \
321
) \
322
:Teuchos::UnitTestBase( \
323
std::string(#TEST_GROUP)+"_"+type1Name+"_"+type2Name+"_"+type3Name, #TEST_NAME ) \
324
{} \
325
void runUnitTestImpl( Teuchos::FancyOStream &out, bool &success ) const; \
326
virtual std::string unitTestFile() const { return __FILE__; } \
327
virtual long int unitTestFileLineNumber() const { return __LINE__; } \
328
}; \
329
\
330
template<class TYPE1, class TYPE2, class TYPE3> \
331
void TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1,TYPE2,TYPE3>::runUnitTestImpl( \
332
Teuchos::FancyOStream &out, bool &success ) const \
333
334
339
#define TEUCHOS_UNIT_TEST_TEMPLATE_3_INSTANT(TEST_GROUP, TEST_NAME, TYPE1, TYPE2, TYPE3) \
340
\
341
template class TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1, TYPE2, TYPE3 >; \
342
TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1, TYPE2, TYPE3 > \
343
instance_##TEST_GROUP##_##TYPE1##_##TYPE2##_##TYPE3##_##TEST_NAME##_UnitTest(#TYPE1,#TYPE2,#TYPE3);
344
345
350
#define TEUCHOS_UNIT_TEST_TEMPLATE_4_DECL(TEST_GROUP, TEST_NAME, TYPE1, TYPE2, TYPE3, TYPE4) \
351
template<class TYPE1, class TYPE2, class TYPE3, class TYPE4> \
352
class TEST_GROUP##_##TEST_NAME##_UnitTest : public Teuchos::UnitTestBase \
353
{ \
354
public: \
355
TEST_GROUP##_##TEST_NAME##_UnitTest( \
356
const std::string& type1Name, \
357
const std::string& type2Name, \
358
const std::string& type3Name, \
359
const std::string& type4Name \
360
) \
361
:Teuchos::UnitTestBase( \
362
std::string(#TEST_GROUP)+"_"+type1Name+"_"+type2Name+"_"+type3Name+"_"+type4Name, #TEST_NAME ) \
363
{} \
364
void runUnitTestImpl( Teuchos::FancyOStream &out, bool &success ) const; \
365
virtual std::string unitTestFile() const { return __FILE__; } \
366
virtual long int unitTestFileLineNumber() const { return __LINE__; } \
367
}; \
368
\
369
template<class TYPE1, class TYPE2, class TYPE3, class TYPE4> \
370
void TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1,TYPE2,TYPE3,TYPE4>::runUnitTestImpl( \
371
Teuchos::FancyOStream &out, bool &success ) const \
372
373
378
#define TEUCHOS_UNIT_TEST_TEMPLATE_4_INSTANT(TEST_GROUP, TEST_NAME, TYPE1, TYPE2, TYPE3, TYPE4) \
379
\
380
template class TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1, TYPE2, TYPE3, TYPE4 >; \
381
TEST_GROUP##_##TEST_NAME##_UnitTest<TYPE1, TYPE2, TYPE3, TYPE4 > \
382
instance_##TEST_GROUP##_##TYPE1##_##TYPE2##_##TYPE3##_##TYPE4##_##TEST_NAME##_UnitTest(#TYPE1,#TYPE2,#TYPE3,#TYPE4);
383
384
385
#endif // TEUCHOS_UNIT_TEST_HELPERS_HPP
Teuchos_UnitTestBase.hpp
Unit testing support.
Teuchos_StaticSetupMacro.hpp
Generated on Thu Nov 21 2024 09:21:40 for Teuchos Package Browser (Single Doxygen Collection) by
1.8.5