Hi Tim,

On Mon, Aug 30, 2010 at 1:47 PM, Tim Daly <d...@axiom-developer.org> wrote:
> Tim (somebody, I can't find his name) was going to try the
> CATS integration test suite in Sage. It should be rather easy
> as Sage uses Maxima and the syntax is very close. I don't
> know what became of that effort.

I don't recall reading about any such effort.


> If you do a test suite on graphs I'd be happy to try to
> make it work in Axiom. This would likely involve writing new
> algebra code so it would be helpful if you included citations
> of algorithms (if you know them) as you develop it. It looks
> like Gross and Yellin includes high level algorithms so that
> would be exceptionally helpful. I strongly favor basing test
> suites on books containing algorithms.

As a start, one could gather known databases of graphs such as the
following page of Chris Godsil linking to various graph databases:

http://quoll.uwaterloo.ca/mine/theirs.html

or the book (Read & Wilson 2005) "An Atlas of Graphs".

For each graph and its associated properties as contained in the
database, we list that graph in some type of representation, e.g.
graph6 or sparse6, and the associated properties as extracted from the
database. We then read in that graph format and invoke graph theoretic
functions to confirm that the output of the system in question agrees
with the stated properties. That is, we're testing to ensure that
properties as contained in the database match the output of the
system.

One could also go beyond verifying properties contained in a database
and consider verifying mathematical properties of a graph itself.
Numerous known properties of graphs exist that could make valuable
test cases.

The above outline could be a start. This has been on my mind for
months now. I just haven't the luxury of time to devote to this task.


> For the CATS test suite each file contains the problem, the
> expected answer, and Axiom's answer. The format of the files
> makes it possible to run them automatically which I do with
> every system build. Does Sage have such a file format?

I don't think so. One way to write test cases at the moment is to
write them in a source file of the Sage library or contribute test
cases to a relevant upstream project whose source code makes up a
standard Sage package. There's also the option to write a list of test
cases, embed them in the docstring of a Python file that only has
those test cases (and no Python code whatsoever), and integrate that
file of test cases into the Sage library. When generating the Sage
standard documentation you have the choice of which files in the Sage
library to extract documentation from and pretty display the doc in
the reference manual.

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.

The idea described above is nothing new. One of my original intentions
was to write test cases with accompanying explanatory theory so any
future maintainer would have some documentation to help them update
the test suite. Of course this means that it would require more time
and effort than simply writing test cases. What you end up resembles
more of an expository document than a test suite.

[1] http://bitbucket.org/mvngu/sageutil/src/tip/textract.py

[2] https://code.google.com/p/factor-book/

-- 
Regards
Minh Van Nguyen

-- 
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

Reply via email to