I've written a Matrix class, and checked that it disallowed multiplication of matrices of incompatible sizes using C++ exceptions. I wrote unit tests to check that behavior, and they are expecting exception to be thrown.
Now I'm changing the Matrix size from being a runtime variable to a template parameter. If I'll be able to do that correctly, the code that will try to multiply matrices of wrong sizes won't even compile.
It would seem that now these unit tests are redundant. However, since I don't know how I'll change my code in the future, and what will break, I still want to implement tests for this. If before I expected my tests to throw specific exceptions at specific places, now I want my test to throw specific compile errors at specific places.
What's the best way to do that? I would imagine some sort of mechanism based on Makefile and shell scripting that would wait for a specific error codes — or should I try something else? Is this idea a common practice or complete madness?
Aucun commentaire:
Enregistrer un commentaire