当前位置:网站首页>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边栏推荐
- How was MP3 born?
- Shutter textfield example
- 2021 CCPC Harbin I. power and zero (binary + thinking)
- y56.第三章 Kubernetes从入门到精通 -- 业务镜像版本升级及回滚(二九)
- Le module minidom écrit et analyse XML
- 华为ensp模拟器 三层交换机
- Why does invariant mode improve performance
- redis缓存
- A quick start to fastdfs takes you three minutes to upload and download files to the ECS
- 面试官:说说XSS攻击是什么?
猜你喜欢

ArcGIS 10.2.2 | solution to the failure of ArcGIS license server to start

每日一题-LeetCode556-下一个更大元素III-字符串-双指针-next_permutation

超详细教程,一文入门Istio架构原理及实战应用

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

【活动早知道】LiveVideoStack近期活动一览

Enlightenment of maker thinking in Higher Education

torch. Tensor and torch The difference between tensor

Arcgis 10.2.2 | arcgis license server无法启动的解决办法

华为模拟器ensp的路由配置以及连通测试

TCP shakes hands three times and waves four times. Do you really understand?
随机推荐
Routing configuration and connectivity test of Huawei simulator ENSP
案例分享|金融业数据运营运维一体化建设
numpy vstack 和 column_stack
MP3是如何诞生的?
[buuctf.reverse] 151_[FlareOn6]DnsChess
Lambdaquerywrapper usage
【C语言】符号的深度理解
Minidom module writes and parses XML
torch. Tensor and torch The difference between tensor
超详细教程,一文入门Istio架构原理及实战应用
2021 CCPC Harbin I. power and zero (binary + thinking)
[weekly translation go] how to code in go series articles are online!!
Caduceus从未停止创新,去中心化边缘渲染技术让元宇宙不再遥远
Exclusive interview of open source summer | new committer Xie Qijun of Apache iotdb community
杰理之AD 系列 MIDI 功能说明【篇】
redis RDB AOF
Numpy vstack and column_ stack
MYSQL 用!=查询不出等于null的数据,解决办法
杰理之AD 系列 MIDI 功能说明【篇】
At the right time, the Guangzhou station of the city chain science and Technology Strategy Summit was successfully held