If we were talking about unit testing, since you want to provide a test for one method / class, you must provide input and check the results of your algorithm.
As your algorithm does some calculations that you cannot trust by default (this is a testing point), you need to check the results against constant values . For instance. you supply 5 and your method returns 17 . Which is either beautiful or not - your test pass or failure.
Where to get 17 ? Use paper and pencil, an online settlement site, no matter how you trust.
The test, especially a single one, should be simple and very easy . You should not offer an alternative approach to how to calculate the results and test them against those that produce the code. This approach brings you two different implementations that you will need to support, refactoring, etc.
Obviously, you can provide a table of inputs and expected outputs, not just 5 and 17 .
source share