Teuchos_Assert.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef TEUCHOS_ASSERT_HPP
00030 #define TEUCHOS_ASSERT_HPP
00031
00032
00033 #include "Teuchos_TestForException.hpp"
00034
00035
00042 #define TEUCHOS_ASSERT(assertion_test) TEST_FOR_EXCEPT(!(assertion_test))
00043
00044
00052 #define TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE( index, lower_inclusive, upper_exclusive ) \
00053 { \
00054 TEST_FOR_EXCEPTION( \
00055 !( (lower_inclusive) <= (index) && (index) < (upper_exclusive) ), \
00056 std::out_of_range, \
00057 "Error, the index " #index " = " << (index) << " does not fall in the range" \
00058 "["<<(lower_inclusive)<<","<<(upper_exclusive)<<")!" ); \
00059 }
00060
00061
00069 #define TEUCHOS_ASSERT_EQUALITY( val1, val2 ) \
00070 { \
00071 TEST_FOR_EXCEPTION( \
00072 (val1) != (val2), std::out_of_range, \
00073 "Error, (" #val1 " = " << (val1) << ") != (" #val2 " = " << (val2) << ")!" ); \
00074 }
00075
00076
00084 #define TEUCHOS_ASSERT_INEQUALITY( val1, comp, val2 ) \
00085 { \
00086 TEST_FOR_EXCEPTION( \
00087 !( (val1) comp (val2) ), std::out_of_range, \
00088 "Error, (" #val1 " = " << (val1) << ") " \
00089 #comp " (" #val2 " = " << (val2) << ")! FAILED!" ); \
00090 }
00091
00092
00093 #endif // TEUCHOS_ASSERT_HPP