diff --git a/pixmappaint.d b/pixmappaint.d index 1bf8368..c8e87af 100644 --- a/pixmappaint.d +++ b/pixmappaint.d @@ -625,6 +625,20 @@ struct UDecimal { assert((UDecimal(10) / 5).ceil().castTo!uint == 2); } +@safe unittest { + UDecimal val; + + val = (UDecimal(1) / 2); + assert(val.roundEven().castTo!uint == 0); + assert(val.castTo!double > 0.49); + assert(val.castTo!double < 0.51); + + val = (UDecimal(3) / 2); + assert(val.roundEven().castTo!uint == 2); + assert(val.castTo!double > 1.49); + assert(val.castTo!double < 1.51); +} + @safe unittest { UDecimal val;