[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Axiom-developer] input file examples
From: |
daly |
Subject: |
Re: [Axiom-developer] input file examples |
Date: |
Tue, 2 Dec 2014 15:36:40 -0600 |
Raymond,
Thanks for your input file.
There is a "best practices" version of regression test files
which is "in plan" for all test files as part of the continuous
integration effort. If something fails it should be possible
to know not only what was expected by WHY it was expected.
See the input file and its generated pdf at:
http://daly.axiom-developer.org/biquat.input.pamphlet
http://daly.axiom-developer.org/biquat.input.pdf
Since these are full latex files you can embed diagrams, images,
and bibligraphic references.
Axiom supports running an individual test file, e.g.
)cd src/input
)tangle biquat -- extract the default chunk named * from
-- biquat.input.pamplet to create biquat.input
)read biquat -- read the biquat.input file, creating biquat.output
)regress biquat -- compare --R with the newly generated results
Note that the ')read' will probably exit Axiom as most test files
have the line ')lisp (bye)' at the end (for automation reasons).
These regression tests are in src/input/*.input.pamphlet
These test files are latex source files. The actual code is
contained within \begin{chunk} and \end{chunk} delimiters.
At build time the actual code is extracted, executed, and
checked against known good results. So you'll see
\begin{document}
more latex
\begin{chunk}{*}
input file examples to run
\end{chunk}
\end{document}
within the {chunk} section there are a series of numbered tests
of the form (note that any line starting with -- is an Axiom comment)
--S 5 of 64
t1 := 3 + 4
--R
--R (5) 7
--R Type: PositiveInteger
--E 5
Axiom uses the fact that -- lines are comments in order to build the
test facility. If you run the above lines the interpreter only sees
the 't1 := 3 + 4' and ignores everything else.
So the hack is to run the input file with all the comment lines.
The result of the run looks like:
--S 5 of 64
t1 := 3 + 4
(5) 7
Type: PositiveInteger
--R
--R (5) 7
--R Type: PositiveInteger
--E 5
Now it is just a matter of comparing the lines generated by the
interpreter with the lines prefixed by --R. If they don't match
then something failed. The --S number lets you find the failing
test and checks for missing tests and early exit failures.
This makes it trivial to create test files. Just
make an input file,
use ')spool foo.output' at the beginning
use ')spool' at the end
run the input file
edit the foo.output by adding --S, --R, and --E lines
rename foo.output to foo.input
add latex
Note also that since this is latex it can be used to create a pdf.
Anything NOT in a chunk is just latex. Anything IN a chunk will be
extracted and executed. This makes it possible to generate really
pretty test cases with associated theory.
Tim
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Axiom-developer] input file examples,
daly <=