0

I am quite new to Ceedling and unit testing, so bear with me for a moment ...

The code that I am testing contains macros in a header file in the form:

#define DO_Something_with_a_MCU_Registers() \
        (<does_something_on_a_MCU_register>)

The written unit tests are currently working. However I would like to have a coverage report with GCOV for this particular header file. At the moment the GCOV report is empty. What I would like to see/prove is that my tests are executing the macros. I do understand this poses a challenge, as the macros are included in the unit test as part of the pre-processor. But I would like to hear if there are other options or ideas?

rtoma
  • 1
  • 2
  • To save the multiple times we need to reproduce, please provide a [mre]. – the busybee Sep 15 '22 at 08:57
  • @thebusybee ... the FW is proprietary so it is not share-able for the time being. For the purpose of this query, you can consider any macro definitions in a file, such as: #define PB3_SetHigh() do { PORTB_OUTSET = 0x8; } while(0) – rtoma Sep 27 '22 at 06:45
  • Of course, many of us are working for some proprietary products. However, you could prepare a [mre] to demonstrate the issue. You don't want us to invest this time separately multiple times, do you? We don't need the real thing, just a demonstration. – the busybee Sep 27 '22 at 07:37
  • A macro does not represent executable code. The contents of the macro are basically pasted in anywhere it's used. If there are functions defined in the header file AND at least one of the functions is called from a test module, then you should see the file in your coverage report. However, to the best of my knowledge, Ceedling will not report whether or not a macro itself has been used. However, if the macro is used and contains conditionals it should identify whether all branches of the conditionals have been executed. – Jonathon S. May 26 '23 at 16:32

0 Answers0