当前位置:网站首页>gtest从一无所知到熟练使用(4)如何用gtest写单元测试
gtest从一无所知到熟练使用(4)如何用gtest写单元测试
2022-07-04 20:48:00 【奇妙之二进制】
1 gtest是什么
gtest是Google开发的一个跨平台开源单元测试框架,git仓库点击这里获取。主要针对c/c++,gtest有如下特点:
测试框架
自动收集测试用例,无需开发者再次组织
提供强大的断言集,支持包括布尔、整型、浮点型、字符串等
提供断言方法自定义扩展
提供死亡测试功能
可以将公共的用例初始化和清理工作放入测试夹具中,由gtest自动调用
Value-parameterized tests.
Type-parameterized tests.
生成xml格式测试报告
2.定义一个最基本的测试用例
TEST宏用于定义一个测试用例:
#include <gtest/gtest.h>
int Add(int i边栏推荐
猜你喜欢

Interpreting the development of various intelligent organizations in maker Education

Three or two things about the actual combat of OMS system

CAD中能显示打印不显示

Configuration of DNS server of Huawei ENSP simulator

Daily question-leetcode556-next larger element iii-string-double pointer-next_ permutation

杰理之增加进关机前把触摸模块关闭流程【篇】

Keep on fighting! The city chain technology digital summit was grandly held in Chongqing

每日一题-LeetCode1200-最小绝对差-数组-排序

迈动互联中标北京人寿保险

How to remove the black dot in front of the title in word document
随机推荐
杰理之增加进关机前把触摸模块关闭流程【篇】
Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"
Go语言循环语句(第10课中3)
[wechat applet] collaborative work and release
LambdaQueryWrapper用法
奋斗正当时,城链科技战略峰会广州站圆满召开
Routing configuration and connectivity test of Huawei simulator ENSP
股票开户佣金最低多少,炒股开户佣金最低网上开户安全吗
超详细教程,一文入门Istio架构原理及实战应用
类方法和类变量的使用
OMS系统实战的三两事
Redis bloom filter
How was MP3 born?
Delphi soap WebService server-side multiple soapdatamodules implement the same interface method, interface inheritance
一文掌握数仓中auto analyze的使用
开源之夏专访|Apache IoTDB社区 新晋Committer谢其骏
Huawei simulator ENSP common commands
WGCNA分析基本教程总结
Methods of improving machine vision system
How much is the minimum stock account opening commission? Is it safe to open an account online