Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TemplateFunc_UnitTests.cpp
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 
11 #include "Teuchos_as.hpp"
12 
13 
14 template<class T>
15 T someFunc( const T &t )
16 {
17  return t*t;
18 }
19 
20 
21 namespace {
22 
23 
25 {
26  using Teuchos::as;
27  T t1 = 5;
28  TEST_EQUALITY_CONST( t1, as<T>(5) );
29 }
30 
32 
33 
34 } // namespace
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_DECL(TEST_GROUP, TEST_NAME, TYPE)
Macro for defining a templated unit test with one template parameter.
#define TEUCHOS_UNIT_TEST_TEMPLATE_1_INSTANT_SCALAR_TYPES(TEST_GROUP, TEST_NAME)
Instantiate a whole group of tests for supported Scalar types.
Unit testing support.
#define TEST_EQUALITY_CONST(v1, v2)
Assert the equality of v1 and constant v2.
TypeTo as(const TypeFrom &t)
Convert from one value type to another.
Definition of Teuchos::as, for conversions between types.
T someFunc(const T &t)