I was how it's possible to test some specific C macros for embedded SW.
For example if I have the following macro:
/*
Set a pin as an input
port (B,C, D or E)
pin - pin to set (0-7)
*/
#define _SET_INPUT_PIN(port,pin) DDR ## port &= ~(1<<pin)
#define SET_INPUT_PIN(...) _SET_INPUT_PIN(__VA_ARGS__)
and I want to test it with two ports, one who exists (LED_OK) the other one no (LED_FAIL):
#define LED_OK D,3
#define LED_FAIL D,8
When I try to test it both LED_OK and LED_FAIL will work fine but some sort of warning/fail should alert that LED_FAIL doesn't exist since PORTD has only defined pins 0 to 7.
So, when I pass a LED how could I check "pin" is in range?