Nicolas,
This is similar to the CATS pamphlet files.
They use noweb format but they could use the \begin...\end
latex environment. I plan to make that change anyway.
If we look at one of the files, e.g.
http://axiom-developer.org/axiom-website/CATS/schaum1.input.pamphlet
it is a sequence of blocks. The Axiom comment character is "--" so
any line beginning with "--" is ignored by Axiom.
Each block is of the form
--S (number)
An Axiom Command Line
--R
--R The expected output from Axiom
--R
--E (number)
So when this file is run Axiom sees a command line followed by
a set of comments. The comments contain the expected output.
A post-process reads the output from Axiom and compares it
to the comments. The --S/--E numbering scheme allow the compare
function to check that all tests run and list the number of the
failing function.
This allows us to automate the testing.
Tim Daly
Nicolas M. Thiery wrote:
On Mon, Aug 30, 2010 at 03:33:23PM +1000, Minh Nguyen wrote:
A few months ago I experimented with writing test cases in LaTeX as
part of a detailed discussion of underlying relevant theory. So for
example you want to write some test cases for graph theory. You start
by writing a short document explaining any relevant theory and runtime
complexity of algorithms you want to cover, with references to any
literature where appropriate. Next write down properties you're
interested in together with any expected results, followed by a
transcript of a Sage session that verify the stated properties. All of
these are written up as a LaTeX document just like your normal LaTeX
document. To run the test cases through Sage, I used a little tool [1]
to extract the test cases and run them through the Sage doctesting
framework. As an example of what I mean, refer to this document [2]
which is a work in progress.
For the record: the (relatively new) sageexample environment of
sagetex allows for including doctest like examples in the latex file:
\begin{sageexample}
sage: 1 + 1
2
\end{sageexample}
Upon compilation, those examples are all extracted to a separate file
which you can test using sage -t. That's what we use to check the
examples in our French introductory Sage book. This still has a couple
glitches, but the more people use it, the better it will become :-)
Best,
Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/
--
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org