Hello, I am currently making a minimalistic testing framework for on-target unit testing. I am making the framework layered, so that a named testing section contains multiple assertions and a named test case contains multiple sections. For every section that is called within a test case, a counter will increment, so that once the test case is finished, the total number of sections can be sent over a communication protocol (e.g. UART), with additional information on each assertion performed in each section.
What I am wondering is, would it be better to place the entire testing framework in a struct with the relevant counters internally, or each function (for naming and incrementing the total number of sections) in a file along with a namespace containing the counters to limit the scope? As I understand it, if I use the struct method, I will get multiple of the same counter variables while in the namespace method I will only have one, where I use various function calls to increment the counter. Would the namespace method be bad practice in some way, or is this the preferred choice?
Below is the code for the namespace method. The create_id_message doesn't require a template, but I used it so that it will be run at compile time. Feel free to comment on any bad practice or improvements I can make, any help would be greatly appreciated :)
The std::cout statements will be changed for communication protocol message functions that are used on-target