$search
00001 00008 /***************************************************************************** 00009 ** Includes 00010 *****************************************************************************/ 00011 00012 #include <iostream> 00013 #include "../../include/ecl/errors/compile_time_assert.hpp" 00014 #include "../../include/ecl/errors/handlers.hpp" 00015 #include "../../include/ecl/errors/run_time_functions.hpp" 00016 #include "../../include/ecl/errors/macros.hpp" 00017 00018 00019 /***************************************************************************** 00020 ** Globals 00021 *****************************************************************************/ 00025 template <int M, int N> 00026 class Test { 00027 public: 00028 Test() { 00029 ecl_compile_time_assert( M >= 0 ); 00030 ecl_compile_time_assert( N >= 0 ); 00031 } 00032 }; 00036 /***************************************************************************** 00037 ** Main 00038 *****************************************************************************/ 00039 00040 int main() { 00041 00042 std::cout << std::endl; 00043 std::cout << "***********************************************************" << std::endl; 00044 std::cout << " Error functions" << std::endl; 00045 std::cout << "***********************************************************" << std::endl; 00046 std::cout << std::endl; 00047 00048 ecl::Error error(ecl::UnknownError); 00049 std::cout << "Error::what() " << std::endl; 00050 std::cout << error.what() << std::endl; 00051 std::cout << "Error::print() " << std::endl; 00052 error.print(LOC); 00053 00054 std::cout << std::endl; 00055 std::cout << "***********************************************************" << std::endl; 00056 std::cout << " Asserts and Aborts" << std::endl; 00057 std::cout << "***********************************************************" << std::endl; 00058 std::cout << std::endl; 00059 00060 ecl::Error configuration_error(ecl::ConfigurationError); 00061 Test<3,1> test; 00062 // ecl_compile_time_assert(1 >= 3); 00063 // ecl_verbose_compile_time_assert( 1 >= 0, BAD_INEQUALITY ); 00064 // ecl_run_time_abort ( LOC, ConfigurationError ); 00065 // ecl_run_time_abort ( LOC, "Custom error report." ); 00066 ecl_run_time_assert ( 2 < 1, LOC, configuration_error.flag() ); 00067 // ecl_run_time_assert ( 2 < 1, LOC, ConfigurationError ); 00068 // ecl_run_time_assert ( 2 < 1, LOC, "Inequality broken." ); 00069 00070 return 0; 00071 } 00072