changeset 860:b6ae408a0b4f

Test of prss_double_share.
author Martin Geisler <mg@daimi.au.dk>
date Wed, 30 Jul 2008 22:45:42 +0200
parents 885a17b767ef
children f0aa454c9b91
files viff/test/test_runtime_prss.py
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/viff/test/test_runtime_prss.py	Wed Jul 30 22:45:19 2008 +0200
+++ b/viff/test/test_runtime_prss.py	Wed Jul 30 22:45:42 2008 +0200
@@ -136,6 +136,21 @@
         return opened_a
 
     @protocol
+    def test_prss_double_share(self, runtime):
+        """Test double-sharing of random numbers using PRSS."""
+        r_t, r_2t = runtime.prss_double_share(self.Zp)
+
+        self.assert_type(r_t, Share)
+        self.assertEquals(r_t.field, self.Zp)
+        self.assert_type(r_2t, Share)
+        self.assertEquals(r_2t.field, self.Zp)
+
+        result = gather_shares([runtime.open(r_t),
+                                runtime.open(r_2t, threshold=2 * runtime.threshold)])
+        result.addCallback(lambda (a, b): self.assertEquals(a, b))
+        return result
+
+    @protocol
     def test_prss_share_bit_double(self, runtime):
         """Tests sharing a bit over Zp and GF256."""
         bit_p, bit_b = runtime.prss_share_bit_double(self.Zp)