Testing for assert in the Boost Test framework

后端 未结 6 740
忘掉有多难
忘掉有多难 2021-02-05 06:54

I use the Boost Test framework to unit test my C++ code and wondered if it is possible to test if a function will assert? Yes, sounds a bit strange but bear with me! Many of m

6条回答
  •  逝去的感伤
    2021-02-05 07:30

    I don't think so. You could always write your own assert which throws an exception and then use BOOST_CHECK_NOTHROW() for that exception.

提交回复
热议问题