mirror of https://github.com/adamdruppe/arsd.git
Add further unittest for `UDecimal`
This commit is contained in:
parent
425fb918db
commit
7f91abfc0a
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue