Kinda sorry for bumping my own post, but it occurred to me that the motivation might be a bit mysterious. So I added a motivation section in the README. I reproduce it here.
Some code provides efficient, specialized methods for particular data types. It’s important that the input, the output, and the function call look exactly as they did before implementing the efficient method. So the test shouldn’t change:
@test sum(A) = n
How then, apart from benchmarking, do you test your new implementation ? This module is a step towards a solution.
The problem becomes more complicated, and more error prone, if you have a file defining binary operations, say multiplication, for combinations of various particular and abstract types. Are you sure dispatch is occurring as you intend ? Furthermore, due to changes in other code, someone may remove a specialized method that has become redundant, or add a new one. When reading this code (even if you changed it yourself last year) and you can’t find method, did it go missing, or was removed intentionally ? “… wait a minute, there’s a test for that missing method in the test suite, and it’s passing!”
You get the idea.