From ec88915a05a39f2edce5ac01e51f2be971f12b13 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Mon, 26 Oct 2020 18:36:28 +0100 Subject: Add assert_throws function for testing expected exception throwing behaviour. --- examples/ExampleTest.cc | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'examples') diff --git a/examples/ExampleTest.cc b/examples/ExampleTest.cc index bc5e2f7..2a4997c 100644 --- a/examples/ExampleTest.cc +++ b/examples/ExampleTest.cc @@ -92,19 +92,7 @@ public: void exceptionTests() { - try - { - getBaud(-1); - uUNIT_ASSERT(false); // exception should be thrown for invalid value - } - catch(const bad_speed& e) - { - // Excpected outcome - } - catch(...) - { - uUNIT_ASSERT(false); // Unknown exception were thrown - } + uUNIT_ASSERT_THROWS(bad_speed, getBaud(-1)); } }; -- cgit v1.2.3