Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Failing_UnitTest.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 
12 
13 namespace {
14 
15 
16 TEUCHOS_UNIT_TEST( Int, BadAssignment )
17 {
18  int i1 = 4;
19  int i2 = i1 + 1;
20  TEST_EQUALITY( i2, i1 );
21 }
22 
23 
24 TEUCHOS_UNIT_TEST( VectorInt, OutOfRangeAt )
25 {
26  const size_t n = 1;
27  std::vector<int> v(n);
28  const int i = v.at(n); // Should throw std::out_of_range!
29  TEST_EQUALITY_CONST( i, 10 ); // Will never be executed!
30 }
31 
32 
33 } // namespace
#define TEST_EQUALITY(v1, v2)
Assert the equality of v1 and v2.
#define TEUCHOS_UNIT_TEST(TEST_GROUP, TEST_NAME)
Macro for defining a (non-templated) unit test.
Unit testing support.
#define TEST_EQUALITY_CONST(v1, v2)
Assert the equality of v1 and constant v2.