viff

changeset 663:8f2e45ecc8b4

Unit test for single_share_random.
author Martin Geisler <mg@daimi.au.dk>
date Sun, 13 Apr 2008 17:20:24 +0200
parents c0304d48fbba
children 77ad363d79ae
files viff/test/test_active_runtime.py
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- a/viff/test/test_active_runtime.py	Sun Apr 13 17:20:10 2008 +0200
     1.2 +++ b/viff/test/test_active_runtime.py	Sun Apr 13 17:20:24 2008 +0200
     1.3 @@ -62,6 +62,23 @@
     1.4          return gatherResults([x, y, z])
     1.5  
     1.6      @protocol
     1.7 +    def test_single_share_random(self, runtime):
     1.8 +        """Test sharing of random numbers."""
     1.9 +        T = runtime.num_players - 2 * runtime.threshold
    1.10 +
    1.11 +        def check(shares):
    1.12 +            # Check that we got the expected number of shares.
    1.13 +            self.assertEquals(len(shares), T)
    1.14 +
    1.15 +            results = []
    1.16 +            for share in shares:
    1.17 +                self.assert_type(share, Share)
    1.18 +
    1.19 +        shares = runtime.single_share_random(T, runtime.threshold, self.Zp)
    1.20 +        shares.addCallback(check)
    1.21 +        return shares
    1.22 +
    1.23 +    @protocol
    1.24      def test_double_share_random(self, runtime):
    1.25          """Test double-share random numbers."""
    1.26          T = runtime.num_players - 2 * runtime.threshold