Posts tagged gtest
Why unit tests crashed on windows but worked on the microcontroller
- 24 September 2025
When writing cross-platform code, it’s easy to forget that pointers don’t always have the same size. This caused a segmentation fault in one of our unit tests.
On the Aurix MCU, pointers are 32-bit.
In the code a pointer (memory address) was stored in a uint32_t
variable.
That worked fine on the target.
Making Unit Tests Visible in Visual Studio Code with CTest and GoogleTest
- 05 February 2025
Many C/C++ projects rely on CMake, GoogleTest (GTest), and GoogleMock (GMock) for unit testing. Sometimes developers want to see and run/debug these tests directly in their IDE.
In this blog post, I will show how to make the unit tests visible in Visual Studio Code (VS Code) using CTest and GoogleTest. I will start by explaining the standard way to build and run the tests with CMake. Then we will see how CTest can help us discover the tests and how to display them in the VS Code interface.
