Use C++ catch framework to verify assert statement
问题 Is it possible to use the C++ CATCH framework to verify that an assert statement correctly identifies an invalid precondition? // Source code void loadDataFile(FILE* input) { assert(input != NULL); ... } // Test code TEST_CASE("loadDataFile asserts out when passed NULL", "[loadDataFile]") { loadDataFile(NULL) // Now what do I look for? } 回答1: Assuming that the first section of your example is the source code under test and the second part is the unit test, then you'll need to make a choice in