Skip to content

Latest commit

 

History

History
114 lines (84 loc) · 3.65 KB

README.md

File metadata and controls

114 lines (84 loc) · 3.65 KB

UnitTest EmbeddedC

This is an example of doing a UnitTest project using googltest.

License: MIT

Build status Systems / Compilers
Build Status Linux (gcc7)
Visual Studio Builds Windows (Visual Studio 2017)

Alt text

Info

CMake is the chosen build system using ctest.

VSCode is the chosen development IDE.

Library used

  • googltest for unit test system. (as submodule)

Project Structure

UnitTestEmbeddedC/
├── CMakeLists.txt
├── README.md
├── doc
├── .vscode
├── googletest
│   ├── CMakeLists.txt
│   └── ...
├── src
│   ├── Array.c
│   ├── Array.h
│   └── ...
│── test
│   ├── UnitTestFiles
│   │   └── ...
│   ├── MockFiles
│   │   └── ...
│   ├── Main.cpp
│   └── ...

Directory structure:

  • src : Directory for source code under test.
  • test : Directory for test code, including unit test and mock files.
  • doc : Directory for documents.
  • .vscode: Directory for VSCode configuration.
  • googletest: Directory for submodule googletest.
  • CMakeLists.txt: CMake file.
  • README.md: This file.

How to start

Clone the repository recursively

  mkdir my_project
  cd my_project
  git clone https://github.com/ProgmaticProgrammer/UnitTestEmbeddedC.git --recursive --progress -v

Open the repository in VSCode

  • Open a Developer Command Prompt (VS 2017)

Alt text

  • Open the VSCode from the Command Prompt
  cd my_project\UnitTestEmbeddedC
  code .

Alt text

Build/Run/Test in VSCode

Alt text Alt text

  • Choose the cmake configure to confgure cmake

  • Choose the cmake build to build vs2017 target

  • Choose the ctest run to configure/build/test as one go

    Alt text

Develop

Click Explorer or (Ctrl+Shift+E) to browser source code

Alt text

Click Source Control or (Ctrl+Shift+G) to browser source control

Alt text

Click Run or (Ctrl+Shift+D) to debug source code

Alt text

If GoogleTest Adapter is installed, unittests can be viewed in a tree graph as well

Alt text

Todos

  • Integrate with Circleci
  • Make it running under GNU/Linux

References

License

MIT