mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
C++: Moved all C++ examples to own folder
* moved C++ examples to a new cxx folder in examples * added experimental C++ component * added ESPException class to the C++ experimental component * added test cases for ESPException and corresponding test macros
This commit is contained in:

committed by
Mahavir Jain

parent
a0644bf8ae
commit
31edd48b43
@@ -0,0 +1,35 @@
|
||||
#ifndef UNITY_CXX_H_
|
||||
#define UNITY_CXX_H_
|
||||
|
||||
#include "unity.h"
|
||||
|
||||
#define STR(x) #x
|
||||
|
||||
/**
|
||||
* Very simple helper macro to catch exceptions.
|
||||
*
|
||||
* @note
|
||||
* * If there is any exception which not a child of std::exception, it will terminate the program!
|
||||
* * If there is no exception, it will jump from the current frame without de-initializing
|
||||
* destructors!
|
||||
*/
|
||||
#define TEST_THROW(expr_, exception_) \
|
||||
do { \
|
||||
bool caught = false; \
|
||||
bool caught_different = false; \
|
||||
try { \
|
||||
expr_; \
|
||||
} catch ( exception_ &e) { \
|
||||
caught = true; \
|
||||
} catch ( std::exception &e) { \
|
||||
caught_different = true; \
|
||||
} \
|
||||
TEST_ASSERT_FALSE_MESSAGE(caught_different, "ERROR: Expected " STR(exception_) \
|
||||
", but caught different exception."); \
|
||||
TEST_ASSERT_TRUE_MESSAGE(caught, "ERROR: Expected " STR(exception_) \
|
||||
", but no exception thrown."); \
|
||||
} \
|
||||
while (0)
|
||||
|
||||
|
||||
#endif // UNITY_CXX_H_
|
Reference in New Issue
Block a user