当前位置:网站首页>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边栏推荐
- Jerry's ad series MIDI function description [chapter]
- 如何使用ConcurrentLinkedQueue做一个缓存队列
- 输入的查询SQL语句,是如何执行的?
- Redis transaction
- Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"
- 【活动早知道】LiveVideoStack近期活动一览
- redis事务
- CloudCompare&Open3D DBSCAN聚类(非插件式)
- Master the use of auto analyze in data warehouse
- How to use concurrentlinkedqueue as a cache queue
猜你喜欢
![Jerry's ad series MIDI function description [chapter]](/img/28/e0f9b41db597ff3288af431c677001.png)
Jerry's ad series MIDI function description [chapter]

解读创客教育中的各类智能化组织发展
![[early knowledge of activities] list of recent activities of livevideostack](/img/14/d2cdae45a18a5bba7ee1ffab903af2.jpg)
[early knowledge of activities] list of recent activities of livevideostack
![Jerry added the process of turning off the touch module before turning it off [chapter]](/img/28/5e4eb39243a0c973d0b90f76571f9b.png)
Jerry added the process of turning off the touch module before turning it off [chapter]

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

Daily question -leetcode1200- minimum absolute difference - array - sort

巅峰不止,继续奋斗!城链科技数字峰会于重庆隆重举行

Huawei ENSP simulator configures ACL access control list

【公开课预告】:视频质量评价基础与实践

案例分享|金融业数据运营运维一体化建设
随机推荐
旋变串判断
Go语言循环语句(第10课中3)
Golang interview finishing three resumes how to write
华为ensp模拟器实现通信安全(交换机)
【C语言】符号的深度理解
解析steam教育中蕴含的众创空间
LambdaQueryWrapper用法
2021 CCPC Harbin B. magical subsequence (thinking question)
Flutter 返回按钮的监听
Can be displayed in CAD but not displayed in print
【LeetCode】17、电话号码的字母组合
杰理之AD 系列 MIDI 功能说明【篇】
Jerry's ad series MIDI function description [chapter]
torch. Tensor and torch The difference between tensor
Redis pipeline
杰理之AD 系列 MIDI 功能说明【篇】
Maidong Internet won the bid of Beijing life insurance
Delphi soap WebService server-side multiple soapdatamodules implement the same interface method, interface inheritance
How to use concurrentlinkedqueue as a cache queue
The video sound of station B is very low - solution