From: Andrew G. <and...@gm...> - 2008-08-27 17:14:24
|
Re: Is assert a code path? In my opinion "error behavior" qualifies as a code path. If you submit a null to a function and "expect" it to fail assertion then you should be testing for that behavior. I bring it up because yesterday I found a typo in a GLM function which would have been caught if the unit tests tested for error behavior. That said, either test for it (assertions) or don't use them. I think it's perfectly acceptable to say functions will produce undefined results given null input. If that's not acceptable, create some reasonable error behavior *and test for that behavior*. This should be true whether the behavior is an assertion or a "return null and don't modify *out". pudman |