A tested discount calculator