gtest(Google Test)使用

本文介绍了gtest的代码目录结构,包括cmake、make等构建文件,以及include和src中的头文件和实现代码。讲解了gtest的编译链接流程,提供了两种使用方式:直接编译源文件和构建库。此外,还概述了gtest的运行过程,包括测试用例的执行步骤。
摘要由CSDN通过智能技术生成

gtest 代码目录结构

说明:以 gtest-1.7.0 为例

cmake, codegear, make, msvc, xcode

构建测试项目的构建文件,如 make 就是 Makefile.

To write a test program using Google Test, you need to compile Google Test into a library and link your test with it. We provide build files for some popular build systems: msvc/ for Visual Studio, xcode/ for Mac Xcode, make/ for GNU make, codegear/ for Borland C++ Builder, and the autotools script (deprecated) and CMakeLists.txt for CMake (recommended) in the Google Test root directory.


include, src

分别为 gtest 框架实现代码的头文件和 C++ 文件。


fused-src

将上面 include 和 src 中多个 .h, .cc 文件合并成一个 .h, .cc 之后的代码。

Google Test's implementation consists of ~30 files (excluding its own tests). Sometimes you may want them to be packaged up in two files (a .h and a .cc) instead, such that you can easily copy them to a new machine and start hacking there.
<

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值