当前位置:网站首页>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边栏推荐
猜你喜欢

ArcGIS 10.2.2 | solution to the failure of ArcGIS license server to start
![[public class preview]: basis and practice of video quality evaluation](/img/fd/42b98a08b5a0fd89c119f1d1a8fe1b.png)
[public class preview]: basis and practice of video quality evaluation

Flutter TextField示例

y56.第三章 Kubernetes从入门到精通 -- 业务镜像版本升级及回滚(二九)

Lambdaquerywrapper usage

TCP三次握手,四次挥手,你真的了解吗?

WGCNA分析基本教程总结

Difference between ApplicationContext and beanfactory (MS)

torch. Tensor and torch The difference between tensor

Redis03 - network configuration and heartbeat mechanism of redis
随机推荐
Maya lamp modeling
Delphi SOAP WebService 服务器端多个 SoapDataModule 实现相同的接口方法,接口继承
Open3D 曲面法向量计算
SolidWorks工程图添加材料明细表的操作
Flutter TextField示例
Golang interview finishing three resumes how to write
奋斗正当时,城链科技战略峰会广州站圆满召开
TCP三次握手,四次挥手,你真的了解吗?
redis管道
Redis transaction
Why does invariant mode improve performance
Huawei ENSP simulator layer 3 switch
华为ensp模拟器实现通信安全(交换机)
How was MP3 born?
WGCNA analysis basic tutorial summary
How much is the minimum stock account opening commission? Is it safe to open an account online
杰理之AD 系列 MIDI 功能说明【篇】
Cadeus has never stopped innovating. Decentralized edge rendering technology makes the metauniverse no longer far away
OMS系统实战的三两事
开源之夏专访|Apache IoTDB社区 新晋Committer谢其骏