@assertfails directive

This directive macro expands into nothing. It verifies that macro expansion of x generates a macro expansion error. The error is written to stdio. The directive aborts the xcpp preprocessor if macro expansion of x doesn’t generate an error. The only purpose of this directive is to properly unit test the xcpp preprocessor.


// Unit tests of xcpp preprocessor

// No conversion from string to bool
@assertfails( @(bool("x")) )

// No conversion from string to int32
@assertfails( @(int("x")) )

// No conversion from multi character string to char
@assertfails( @(char("xx")) )

// Invalid argument to log
@assertfails( @(log(0)) )
@assertfails( @(log(-1)) )

// Type mismatch (no implicit conversion between bool and int)
@assertfails( @(1 == true) )

// No implicit conversion from int to bool
@assertfails( @if(0){} )