Skip to content

Latest commit

 

History

History

tests

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Unit tests

Setup

  • Linux - sudo apt-get install cpputest lcov
  • OSX - brew install cpputest lcov

Running tests

make

Directory structure

├── Makefile // Invokes all the unit tests
├── MakefileWorker.mk // Comes from CppUTest itself
├── MakefileWorkerOverrides.mk // Injected overrides
├── build
│   [...] // Where all the tests wind up
├── fakes
│   // fakes for unit tests
├── mocks
│   // mocks for unit tests
├── makefiles // Each c file you unit test has a makefile here
│   ├── Makefile_<module_name>.mk
│   └── [...]
├── src // test source files
└── test_*

Adding a test

  • Add a new test makefile under test/makefiles/. These just list the sources you will compile
  • Add a new test file under tests/src for the module you want to test
  • make

Based on the work of our friends at Memfault (SDK). For more, checkout the Interrupt blog.