Correctly test negative tax_rate
It turns out that -0.15::tax_rate means -(0.15::tax_rate), but i want (-0.15)::tax_rate, because otherwise i only check the domain [0, 1).
This commit is contained in:
parent
fa3ffdf19b
commit
96cfee6f56
|
@ -13,7 +13,7 @@ select has_domain('tax_rate');
|
|||
select domain_type_is('tax_rate', 'numeric');
|
||||
|
||||
select lives_ok($$ select 0.21::tax_rate $$, 'Should be able to cast valid positive decimals to tax rate');
|
||||
select lives_ok($$ select -0.15::tax_rate $$, 'Should be able to cast valid negative decimals to tax rate');
|
||||
select lives_ok($$ select (-0.15)::tax_rate $$, 'Should be able to cast valid negative decimals to tax rate');
|
||||
select lives_ok($$ select 0::tax_rate $$, 'Should be able to cast valid zero to tax rate');
|
||||
|
||||
select throws_ok(
|
||||
|
@ -23,7 +23,7 @@ select throws_ok(
|
|||
);
|
||||
|
||||
select throws_ok(
|
||||
$$ SELECT -1::tax_rate $$,
|
||||
$$ SELECT (-1)::tax_rate $$,
|
||||
23514, null,
|
||||
'Should reject -100 % tax rate'
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue