Precedent only deals with regression, which is also useful to document in code, but should not be your only source of documentation.
The purpose of testing, though oft missed due to the name we have given it, is to document your code. The tests explain intent, usage, etc. that can often not be conveyed by the code alone. Verification that the documentation does what it claims comes as an added bonus, of course, and is why we recommend testing over writing comments. Though comments can also be useful in certain situations – right tool for the job and all that.
I feel like law could benefit greatly from something that mirrors TDD, not only to help convey intent of the law, which is information often lost as years pass, but also to help third-parties better understand what the law says. The exact same reasons why we write tests for code. Starting to write that documentation after the code is already in production, so to speak, seems too late.