Git Product home page Git Product logo

gtestdemo's Introduction

说明

This is a cmake test for GTest. 可以一键执行shell脚本统计代码覆盖率。

演示GTest集成与使用。

使用方式

mkdir build

cd build

cmake ..

开Debug模式命令

cmake .. -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_DEBUG_ASAN=ON

make -j16

运行

./bin/main

./bin/func_test

sudo apt install lcov

./code_coverage.sh 可以统计单元测试的代码覆盖率,结果生成在GTestDemo/build/coverage/coverage_report/index.html,如下图:

清理

make clean

参考文档

Cmake add_test

https://blog.csdn.net/sun_ashe/article/details/104527591/

https://cmake.org/cmake/help/v3.12/command/file.html

https://blog.csdn.net/bytxl/article/details/48287499

代码覆盖测试

https://paul.pub/gtest-and-coverage/

https://www.codeleading.com/article/93614362313/

gtestdemo's People

Contributors

hqh2010 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.