Skip to content

Commit a919c14

Browse files
Add tests/signal-all.cpp
1 parent d503977 commit a919c14

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/signal-all.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,28 @@ BOOST_AUTO_TEST_CASE(signal_caster_basics) {
210210

211211
/// Unregister a type
212212
asig_caster->unregisterCast(typeid(double));
213+
214+
/// Unregister the type a second time to generate exception
215+
bool res= false;
216+
try {
217+
asig_caster->unregisterCast(typeid(double));
218+
} catch (ExceptionSignal &aes)
219+
{
220+
res = (aes.getCode() == ExceptionSignal::GENERIC);
221+
}
222+
BOOST_CHECK(res);
213223

224+
/// Get the type cast to generate exception
225+
res= false;
226+
double ad=2.0;
227+
output_test_stream output;
228+
try {
229+
asig_caster->disp(ad,output);
230+
} catch (ExceptionSignal &aes)
231+
{
232+
res = (aes.getCode() == ExceptionSignal::BAD_CAST);
233+
}
234+
BOOST_CHECK(res);
214235
asig_caster->destroy();
215236
BOOST_CHECK(true);
216237
}

0 commit comments

Comments
 (0)