I have a class Vector that represents a point in 3-dimensional space. This vector has a method normalize(self, length = 1)
which scales the vector down/up
I suppose one possibility is to apply the function to test cases for which all inputs, the results of all intermediate calculations, and the output are exactly representable by float
.
To illustrate:
In [2]: import math
In [4]: def norm(x, y):
...: return math.sqrt(x*x + y*y)
...:
In [6]: norm(3, 4) == 5
Out[6]: True
Not sure how practical this is though...