That's what unit testing is for? True, and do you understand the trade-offs? Unit testing is far more time consuming than assertions. Moreover, you're forced to write artificially short routines, routines of a length that research has shown to have a higher defect ratio. For myself, I've not yet been convinced that the costs/benefits of unit testing surpass the costs/benefits of assertions, at least when you're a small team working on end user software.
"Moreover, you're forced to write artificially short routines, routines of a length that research has shown to have a higher defect ratio"
[citation needed] So far I've only seen advice to write shorter routines.