testing: Fix cxxtest application for "no-rtti" builds

Signed-off-by: Gustavo Henrique Nihei <gustavo.nihei@espressif.com>
This commit is contained in:
Gustavo Henrique Nihei 2022-03-25 16:01:05 -03:00 committed by Petro Karashchenko
parent cfadf7b9dc
commit 732df52aef

View File

@ -167,6 +167,7 @@ static void test_stl(void)
// Name: test_rtti // Name: test_rtti
//***************************************************************************/ //***************************************************************************/
#ifdef CONFIG_CXX_RTTI
static void test_rtti(void) static void test_rtti(void)
{ {
std::cout << "test rtti===============================" << std::endl; std::cout << "test rtti===============================" << std::endl;
@ -185,6 +186,7 @@ static void test_rtti(void)
delete a; delete a;
delete b; delete b;
} }
#endif
//*************************************************************************** //***************************************************************************
// Name: test_exception // Name: test_exception
@ -195,14 +197,13 @@ static void test_exception(void)
{ {
std::cout << "test exception==========================" << std::endl; std::cout << "test exception==========================" << std::endl;
try try
{ {
throw runtime_error("runtime error"); throw runtime_error("runtime error");
} }
catch (runtime_error &e) catch (runtime_error &e)
{ {
std::cout << "Catch exception: " << e.what() << std::endl; std::cout << "Catch exception: " << e.what() << std::endl;
} }
} }
#endif #endif
@ -219,7 +220,9 @@ extern "C" int main(int argc, char *argv[])
test_ofstream(); test_ofstream();
test_iostream(); test_iostream();
test_stl(); test_stl();
#ifdef CONFIG_CXX_RTTI
test_rtti(); test_rtti();
#endif
#ifdef CONFIG_CXX_EXCEPTION #ifdef CONFIG_CXX_EXCEPTION
test_exception(); test_exception();
#endif #endif