test/def: Use macros to run valid/invalid cases

VALID_CASE ensures the identifier is valid.
INVALID_CASE ensures the identifier is invalid.
test/def: Add a few more test cases