changeset 764:6377495664f8

Test case for prss_shamir_share_bit_double.
author Martin Geisler <mg@daimi.au.dk>
date Tue, 20 May 2008 12:53:57 +0200
parents 216660f40d01
children 563bcc37fe47
files viff/test/test_runtime_prss.py
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/viff/test/test_runtime_prss.py	Tue May 20 12:53:22 2008 +0200
+++ b/viff/test/test_runtime_prss.py	Tue May 20 12:53:57 2008 +0200
@@ -128,3 +128,17 @@
         result = gather_shares([runtime.open(bit_p), runtime.open(bit_b)])
         result.addCallback(lambda (a, b): self.assertEquals(a.value, b.value))
         return result
+
+    @protocol
+    def test_prss_shamir_share_bit_double(self, runtime):
+        """Tests Shamir sharing a bit over Zp and GF256."""
+        bit_p, bit_b = runtime.prss_shamir_share_bit_double(self.Zp)
+
+        self.assert_type(bit_p, Share)
+        self.assertEquals(bit_p.field, self.Zp)
+        self.assert_type(bit_b, Share)
+        self.assertEquals(bit_b.field, GF256)
+
+        result = gather_shares([runtime.open(bit_p), runtime.open(bit_b)])
+        result.addCallback(lambda (a, b): self.assertEquals(a.value, b.value))
+        return result