Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-01-04 10:49:22 -0500
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2018-09-11 09:30:51 -0400
commit5267baa0e9d8544280a0721f6240fac8afa0f0af (patch)
treefdbb4657d095471e5c9b7c0ac84166d8300799f6
parent108ada745a0c4ba6d7a681a23811ed52dd0a250c (diff)
downloadtame-5267baa0e9d8544280a0721f6240fac8afa0f0af.tar.gz
tame-5267baa0e9d8544280a0721f6240fac8afa0f0af.tar.bz2
tame-5267baa0e9d8544280a0721f6240fac8afa0f0af.zip
vector/stub: Add package.
* test/core/vector/stub.xml: Add specification. * vector/stub.xml: Add package.
-rw-r--r--core/test/core/suite.xml1
-rw-r--r--core/test/core/vector/stub.xml49
-rw-r--r--core/vector/stub.xml81
3 files changed, 131 insertions, 0 deletions
diff --git a/core/test/core/suite.xml b/core/test/core/suite.xml
index ce02b4b..c3c4505 100644
--- a/core/test/core/suite.xml
+++ b/core/test/core/suite.xml
@@ -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" />
diff --git a/core/test/core/vector/stub.xml b/core/test/core/vector/stub.xml
new file mode 100644
index 0000000..087c22a
--- /dev/null
+++ b/core/test/core/vector/stub.xml
@@ -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>
diff --git a/core/vector/stub.xml b/core/vector/stub.xml
new file mode 100644
index 0000000..dead60b
--- /dev/null
+++ b/core/vector/stub.xml
@@ -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>