首次运行gtest
来源:互联网 发布:整形医院网络咨询技巧 编辑:程序博客网 时间:2024/06/04 23:27
看到 cleanfight 下面有 test/unit, 估计是做单元测试用的
一个make (Ubuntu下面) 都编译了,再到 cleanflight/obj/test 生成了很多可执行文件
原来 cleanflight的单元测试不是是stm32上跑了,而是在pc上跑,主要测试函数的功能
找个源元件,原来是用gtest写的,下面就在 cleanflight目录下做 gtest的试验
1)编写一个文件叫 1.c
======= 1.c ============
#include "gtest/gtest.h"TEST (SquareRootTest, PositiveNos) { EXPECT_EQ (18.0, 18.0);}int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS();}
g++ -isystem ./lib/test/gtest/inc 1.c ./obj/test/gtest-all.o -o 1 -lpthread
3)运行得到结果
$ ./1
[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from SquareRootTest
[ RUN ] SquareRootTest.PositiveNos
[ OK ] SquareRootTest.PositiveNos (0 ms)
[----------] 1 test from SquareRootTest (0 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test case ran. (0 ms total)
[ PASSED ] 1 test.
0 0
- 首次运行gtest
- 首次运行CE 5.0
- 首次运行AndroidStudio
- 应用程序是否首次运行
- IntelliJ IDEA 首次运行
- gtest
- gtest
- gtest
- gtest
- gtest
- gtest
- gtest
- gtest
- gtest
- gtest
- gtest
- 首次运行.NET的注意事项
- iosApp首次次运行判断
- 第16周 项目2 - 大数据集上排序算法性能的体验
- “#ifdef __cplusplus extern "C" { #endif”的定义(转)
- 遍历map集合
- Android 高级开发笔记 第一章 Activity的生命周期探索
- javascript:void(0)是什么意思
- 首次运行gtest
- [Binary Search]Search Insert Position
- Mongodb 聚合
- 每日一篇:将一个正整数分解质因数
- Unity3d 工具打包完 自动上传到FTP服务器
- Android音频系统之AudioTrack(二)
- iOS开发 - iOS崩溃堆栈信息的符号化解析
- 深入理解MFC子类化
- jq 获取多个子元素宽之和