added tests for both cases of underspending and overspending