Matthew Palmer wrote:
On Wed, Jun 21, 2006 at 05:47:10PM +1000, O Plameras wrote:
The above tests appear to be incosistent and therefore the TEST are
incorrect. You seem to say to round to the nearest UNIT and later on say
to round to the nearest HUNDRETH UNIT.
In practice there should be a consistent rule for rounding like, the
nearest UNIT, or TENTHS, or HUNDRETH, for all numbers and not a mixture.
The customer's needs were quite explicit that the rounding was not
consistent between positive and negative numbers.
Firstly, if the customer was such explicit, so what is the correct
bodgy_rounding() because what is posted is definitely WRONG
as it will not work with your specifications. Even then, you did
not point this out.
Are'nt you misleading the audience of this list?
Secondly, how do you reconcile your specs as follows:
>class SimpleBodgyRoundingTest < Test::Unit::TestCase
> def test_bodgy_rounding
> assert_equal(10, bodgy_rounding(12))
Your bodgy_rounding(12) should send ONLY ONE parameter,
that is integer 10 in the above to satisfy the TEST,
and now you are saying bodgy_rounding should return
TWO PARAMETERS ?
Is'nt this a parody of stupidity ?
> assert_equal(15, bodgy_rounding(13))
> assert_equal(0, bodgy_rounding(1))
> assert_equal(0, bodgy_rounding(0))
> assert_equal(5, bodgy_rounding(7))
> assert_equal(10, bodgy_rounding(7.01))
> end
O Plameras
_______________________________________________
coders mailing list
[email protected]
http://lists.slug.org.au/listinfo/coders