Add up/down _premium_/@round@ support

* insurance.xml (_premium_): Added up/down support for @round@
* test/core/insurance.xml: Associated test cases
master
Mike Gerwitz 2016-08-02 10:07:45 -04:00 committed by Mike Gerwitz
parent 44be881050
commit 18fe43b38f
2 changed files with 94 additions and 1 deletions

View File

@ -93,7 +93,24 @@
</if>
<unless name="@round@" eq="cent">
<param-copy name="@values@" />
<if name="@round@" eq="up">
<c:ceil>
<param-copy name="@values@" />
</c:ceil>
</if>
<unless name="@round@" eq="up">
<if name="@round@" eq="down">
<c:floor>
<param-copy name="@values@" />
</c:floor>
</if>
<unless name="@round@" eq="down">
<!-- no rounding -->
<param-copy name="@values@" />
</unless>
</unless>
</unless>
</unless>
</rate-each>

View File

@ -127,6 +127,82 @@
</t:match-result>
</t:expect>
</t:it>
<t:it desc="Performs ceiling when 'up' (low)">
<t:premium class="length1"
generates="premRoundCeilLow" index="k"
round="up">
<c:value-of name="#1.1" />
</t:premium>
<t:given name="premRoundCeilLow" />
<t:expect>
<t:match-result>
<c:eq>
<c:value-of name="#2" />
</c:eq>
</t:match-result>
</t:expect>
</t:it>
<t:it desc="Performs ceiling when 'up' (high)">
<t:premium class="length1"
generates="premRoundCeilHigh" index="k"
round="up">
<c:value-of name="#1.7" />
</t:premium>
<t:given name="premRoundCeilHigh" />
<t:expect>
<t:match-result>
<c:eq>
<c:value-of name="#2" />
</c:eq>
</t:match-result>
</t:expect>
</t:it>
<t:it desc="Performs floor when 'down' (low)">
<t:premium class="length1"
generates="premRoundFloorLow" index="k"
round="down">
<c:value-of name="#1.1" />
</t:premium>
<t:given name="premRoundFloorLow" />
<t:expect>
<t:match-result>
<c:eq>
<c:value-of name="#1" />
</c:eq>
</t:match-result>
</t:expect>
</t:it>
<t:it desc="Performs floor when 'down' (high)">
<t:premium class="length1"
generates="premRoundFloorHigh" index="k"
round="down">
<c:value-of name="#1.7" />
</t:premium>
<t:given name="premRoundFloorHigh" />
<t:expect>
<t:match-result>
<c:eq>
<c:value-of name="#1" />
</c:eq>
</t:match-result>
</t:expect>
</t:it>
</t:describe>
</t:describe>
</package>