vector/stub: Add package.

* test/core/vector/stub.xml: Add specification.
* vector/stub.xml: Add package.
master
Mike Gerwitz 2018-01-04 10:49:22 -05:00
parent 108ada745a
commit 5267baa0e9
3 changed files with 131 additions and 0 deletions

View File

@ -31,6 +31,7 @@
<import package="numeric/percent" />
<import package="vector/interpolate" />
<import package="vector/length" />
<import package="vector/stub" />
<import package="insurance" />
<import package="tplgen" />

View File

@ -0,0 +1,49 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2018 R-T Specialty, LLC.
This file is part of tame-core.
tame-core is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<package xmlns="http://www.lovullo.com/rater"
xmlns:c="http://www.lovullo.com/calc"
xmlns:t="http://www.lovullo.com/rater/apply-template"
desc="Vector Stub Package Specification">
<import package="../../../test/spec" />
<import package="../../../base" />
<import package="../../../vector/stub" />
<t:n-vector n="5" name="TEST_N_VEC" value="1" />
<t:describe name="_n-vector_">
<t:it desc="generates vector of length N">
<t:given>
<c:sum of="TEST_N_VEC" />
</t:given>
<t:expect>
<t:match-result>
<c:eq>
<c:value-of name="#5" />
</c:eq>
</t:match-result>
</t:expect>
</t:it>
</t:describe>
</package>

View File

@ -0,0 +1,81 @@
<?xml version="1.0"?>
<!--
Copyright (C) 2018 R-T Specialty, LLC.
This file is part of tame-core.
tame-core is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<package xmlns="http://www.lovullo.com/rater"
xmlns:c="http://www.lovullo.com/calc"
xmlns:t="http://www.lovullo.com/rater/apply-template"
core="true"
desc="Stub Vectors and Classifications">
<import package="../base" />
<import package="../tplgen" export="true" />
Stub vectors and classifications of various lengths---%
as well as the means of producing arbitrary lengths---%
are provided for convenience and testing.
<section title="Stub Vectors">
Ten n-vectors with each element containing the value~$0$ are
provided.
<t:for-each-n start="1" end="10" step="1">
<t:n-vector n="@current_n@" name="NVEC{@current_n@}"
value="0" />
</t:for-each-n>
</section>
<section title="Stub Classifications">
Ten n-classes generated from the respective n-vectors are provided.
<t:for-each-n start="1" end="10" step="1">
<classify as="nclass{@current_n@}" yields="nClass{@current_n@}"
desc="Classification {@current_n@}-vector">
<match on="NVEC{@current_n@}" value="ZERO" />
</classify>
</t:for-each-n>
</section>
<section title="Vector Generation">
\ref{_n-vector_} generates vector constants of length~$n$ where each
element is assigned the provided value (or~$0$ if unspecified).
<template name="_n-vector_"
desc="Generate vector of length n">
<param name="@n@" desc="Number of vector elements" />
<param name="@name@" desc="Resulting vector constant name" />
<param name="@value@" desc="Value of elements (default n-1)">
<text>0</text>
</param>
<const name="@name@" desc="{@n@}-vector" set="vector">
<t:for-each-n start="1" end="@n@" step="1">
<item value="@value@" desc="Vector value" />
</t:for-each-n>
</const>
</template>
</section>
</package>