What is the test to determine whether such facts alleged in the complaint or information are matters of defense?

The test is: if the language of the law defining the offense can be separated from the exception that the ingredients of the offense may be accurately and clearly defined without reference to the exception, the latter need not be incorporated in the information because the exception is a matter of defense.

However, if the exception is so intimately related to the language of the law defining the offense that the ingredients of the offense cannot be accurately and clearly described if not included, then the exception is a matter forming the essential element of the offense and not merely a matter of defense.