How can I test if the algorithm is correct?