Unit testing with Catch2! and Trompeloeil

I needed to unit test some arduino code I was working on, which required the use of a mocking framework. After reading online, I discovered that trompeloeil (working in conjunction with Catch2!) was probably the best approach to this.

They are both header only libraries, favouring a ‘no-default’ approach to testing; in the words of Bjorn Fahller (developer of Trompeloeil):

I wanted to reduce the number of wtf moments.

Use example

Creating a test environment

Mocking classes

Catch2! Cookbook

Trompeloeil Cookbook