Unit testing is typically done by developers as they work on code (white-box style), to ensure that the specific function of that unit and its output are as expected, given a known input. By automating this process, any changes to the code will result in easy-to-read outputs that document the changes and whether or not those changes caused any new errors (i.e., regression). This can be simply a yes or no answer, a percentage of passed tests, or a more detailed report showing which tests were completed and how long they took.
For testing, you need to create test data. There is a lot of test data open source libraries available on the internet. This list will talk about the most popular 5 C++ of them and how they help test developers like EDASkel - A skeleton EDA App in C, featuring design data parsers; SparseMatrixLibraries - Test cases demonstrating different sparse matrix libraries; ACME - This repository contains opensource C code for reconstructing membranes from timelapse confocal/2photon image data.