insurance (_factor_): Add @allow-negative

* insurance.xml (_factor_)[@allow-negative@]: New param.
master
Mike Gerwitz 2018-09-06 15:40:34 -04:00
parent 0e084c1504
commit 875ec7634f
1 changed files with 24 additions and 2 deletions

View File

@ -206,6 +206,12 @@
</error>
</if>
<!-- negative values might be indicitive of a failure to provide a floor
on certain factors when summing (for example) -->
<param name="@allow-negative@" desc="Allow negative value (default false)">
<text>false</text>
</param>
<param name="@_prefix@" desc="Factor type (drives naming convention)">
<text>factor</text>
</param>
@ -254,16 +260,32 @@
<unless name="@generates@" eq="">
<t:assert failure="{@generates@} must not yield a value of 0 for
any index">
<t:match-gt on="@generates@" value="ZERO" />
<t:match-ne on="@generates@" value="ZERO" />
</t:assert>
</unless>
<unless name="@yields@" eq="">
<t:assert failure="{@yields@} must not yield a value of 0">
<t:match-gt on="@yields@" value="ZERO" />
<t:match-ne on="@yields@" value="ZERO" />
</t:assert>
</unless>
</unless>
</unless>
<!-- assertion for non-negative -->
<unless name="@allow-negative@" eq="true">
<unless name="@generates@" eq="">
<t:assert failure="{@generates@} must not yield a negative value
for any index">
<t:match-gt on="@generates@" value="ZERO" />
</t:assert>
</unless>
<unless name="@yields@" eq="">
<t:assert failure="{@yields@} must not yield a negative value">
<t:match-gt on="@yields@" value="ZERO" />
</t:assert>
</unless>
</unless>
</template>
</package>