gtest source code
来源:互联网 发布:网络消费者权益保护 编辑:程序博客网 时间:2024/06/05 16:15
gtest 里面有一段漂亮的宏定义代码
大意就是说如果定义了跑出异常,就要在执行的时候判断,试图捕获异常,并处理异常
如果没有定义就不用管了, 如下的红色代码所示,两段式一样的
# if GTEST_HAS_EXCEPTIONS
# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \try { \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \
} catch (const ::std::exception& gtest_exception) { \
fprintf(\
stderr, \
"\n%s: Caught std::exception-derived exception escaping the " \
"death test statement. Exception message: %s\n", \
::testing::internal::FormatFileLocation(__FILE__, __LINE__).c_str(), \
gtest_exception.what()); \
fflush(stderr); \
death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
} catch (...) { \
death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \
}
# else
# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \
GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement)
# endif
在程序的处理过程中,对于异常的处理很重要。最好能对已知的问题作出级别上的区分;例如上面的代码,是个很好的范例
- gtest source code
- source code
- source code
- source code
- source code
- Source Code of exe2com.
- Source Code of exe2com
- HookAPI source code
- Source code of CIH
- Microsoft CLI source code
- PHPfileNavigator source code
- Linux source code
- about packer source code
- Source Code Search Engine?
- source code generators.
- [Source Code]文件过滤
- Source Code Comprehension Tools
- DES JAVA source code
- 线段树(4)
- 黑马程序员_java的多线程(对第十一课创建多线程及多线程安全问题总结)
- 用Openssl建立私有CA并颁发证书
- sqlserver2005 恢复备份 不是多簇媒体集的一部分
- [Machine Learning step by step] 1 统计学习:scikit-learn机器学习简介
- gtest source code
- XML第一天
- ORA-01261经典解决方法
- 数据量极大时用什么排序方法比较好
- Java JDK版本说明
- JDBC以及相关技术学习(一)----第一个JDBC程序
- linux系统下proc文件的含义
- 一步一步教你搭建win7下的Node.js服务(来玩玩服务器端的javascript吧,这可不是前端js插件)
- 基于指定数组大小的切割字符串(java字符串分割性能比较)