📄 fail.cpp
字号:
#include <tut/tut.hpp>#include <string>#include <stdexcept>using std::string;using std::runtime_error;namespace tut{ /** * Testing fail() method. */struct fail_test{};typedef test_group<fail_test> tf;typedef tf::object object;tf fail_test("fail()");template<>template<>void object::test<1>(){ set_test_name("checks fail with message"); try { fail("A Fail"); throw runtime_error("fail doesn't work"); } catch (const failure& ex) { if (string(ex.what()).find("A Fail") == string::npos ) { throw runtime_error("fail doesn't contain proper message"); } }}template<>template<>void object::test<2>(){ set_test_name("checks fail without message"); try { fail(); throw runtime_error("fail doesn't work"); } catch (const failure&) { }}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -