In my experience, you should use Unit-Testing as a health check and a possible regression check. Of course, unit testing should be as thorough as possible, but sometimes it is very tiring to fully test the full functionality of the code.
Unit tests are not formal evidence. They cannot and will not force future errors and problems with your code. Check out common code use cases. If you need more reliability, then you need to create a large repository of regression tests. Fortunately, for common problems, there are several online databases for these kinds of things. TPLP , for example, is a database of problems (and solutions) for theoretical evidence.
One method that sometimes works for me ... usually in mathematical code, there are "simple but slow" methods and "fast but hard to program" methods. When writing code, you want to use fast but difficult to write (so you expect errors). So ... make a quick way to test the system (SUT). When you create Unit Test, create 1000 random problems and solve them using the simple but slow method. Then run SUT and make sure the answers are the same.
Assuming, of course, that creating random problems is an easy task to solve. Sometimes it is, sometimes it is not. It is difficult to say if you do not tell us about the mathematical code itself. Now ... Does this turn out ALL cases? Not. But he will receive "general" cases. And if in practice a corner case appears, wrap it in Unit Test and correct it in the next version of your code.
Dragontamer5788
source share