Re: [viff-devel] VIFF unit tests
Janus Dam Nielsen [EMAIL PROTECTED] writes: I think that having parametrized tests is good, however I just wanted to point out that defining the parameters in the Runtime class/object might not be suffienciently expressive to what we want. We might would like a kind of grouping/system of tests so that it is easy to run the tests without any particular knowledge of which protocols support which parameters. Those tests for which a given set of parameters is invalid, the test could return an undefined value, or the test could be elided from the set of tests since it doesn't make any sense for these parameters anyhow. The test suite is implemented using Trial, a Twisted tool which extends the standard Python unittest module with support for Deferreds. The Python unittest module is modelled after JUnit. In Trial there is support for marking a test as skipped, and that might be useful for what you are describing -- we could query the tests for their requirements and if they do not match the parameters of the current test, then we skip that test. Something like that could work, but I don't know if it is the best way... Have you looked at the Trial documentation to see how it could be done? There is a tutorial here: http://twistedmatrix.com/trac/browser/branches/trial-tutorial-2443/doc/core/howto/trial.xhtml?format=raw and the API documentation is here: http://twistedmatrix.com/documents/current/api/twisted.trial.unittest.TestCase.html Trial is not so well documented as the rest of Twisted, so looking at the source code has helped me a bit until I found the above tutorial. -- Martin Geisler ___ viff-devel mailing list (http://viff.dk/) viff-devel@viff.dk http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk
Re: [viff-devel] VIFF unit tests
Janus Dam Nielsen [EMAIL PROTECTED] writes: Does it make sense to run all unit tests with the same configuations of players and thresholds. That is, for all protocols p, is p executed with x players and threshold t is p welldefined? Well, no, not in general. If you write a protocol for seven people Shamir sharing would look like this in VIFF: a, b, c, d, e, f, g = rt.shamir_share(range(1, 8), input) and that breaks down (I guess quite spectacularly...) when you run it with fewer than seven players. I think Thomas wants us to write protocols that are generic in the sense that they don't assume a particular number of players. So the above line becomes: shares = rt.shamir_share(range(1, len(rt.players)+1), input) If the next step is to add all inputs, then this is easily changed from sum = a + b + c + d + e + f + g to import operator sum = reduce(operator.add, shares) which works any number of shares. So it is only carefully written protocols that can be adapted like that. Examples could be: * Find the minimum input, the median input, the sum, or the average. * Sort the inputs (using a simple bubble-sort or similar). The Yao millionaires example already sorts three elements via three comparisons. -- Martin Geisler ___ viff-devel mailing list (http://viff.dk/) viff-devel@viff.dk http://lists.viff.dk/listinfo.cgi/viff-devel-viff.dk