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 wrap: on
line diff
--- a/viff/test/test_active_runtime.py	Sun Apr 13 17:20:10 2008 +0200
+++ b/viff/test/test_active_runtime.py	Sun Apr 13 17:20:24 2008 +0200
@@ -62,6 +62,23 @@
         return gatherResults([x, y, z])
 
     @protocol
+    def test_single_share_random(self, runtime):
+        """Test sharing of random numbers."""
+        T = runtime.num_players - 2 * runtime.threshold
+
+        def check(shares):
+            # Check that we got the expected number of shares.
+            self.assertEquals(len(shares), T)
+
+            results = []
+            for share in shares:
+                self.assert_type(share, Share)
+
+        shares = runtime.single_share_random(T, runtime.threshold, self.Zp)
+        shares.addCallback(check)
+        return shares
+
+    @protocol
     def test_double_share_random(self, runtime):
         """Test double-share random numbers."""
         T = runtime.num_players - 2 * runtime.threshold