c++ - How to assert in cppunit that a statement throws an exception either of type Excp1 or Excp2? -


cppunit_assert_throw(expression, exceptiontype) not seem allow checking exceptions of multiple types i.e. statement can throw more 1 kind of exceptions.

for e.x. expression may throw excp1 on 1 platform, or excp2 on platform. there workaround test such statements using cppunit_assert_throw?

first test, make test conditions such throws exeption 1. if fails throw, test failure. if throw, catch exception 1, , accept passing. if throws else, framework catches it.

second test, make using conditional compilation enable code platform 2 only. make test conditions such throws exception 2. if fails throw, test failure. if throw, catch exception 2, , accept passing. if throws else, framework catches it.

on first platform test passes, there nothing do. on second platform catch exception 2 expected.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -