changeset 750:b0bf45ad7dda

Test case for newly added bit-sharing method.
author Martin Geisler <mg@daimi.au.dk>
date Tue, 13 May 2008 16:09:07 +0200
parents 65a61fc798bc
children 5dd8c277268c
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 13 16:08:39 2008 +0200
+++ b/viff/test/test_runtime_prss.py	Tue May 13 16:09:07 2008 +0200
@@ -114,3 +114,17 @@
         opened_a = runtime.open(a)
         opened_a.addCallback(self.assertIn, [self.Zp(0), self.Zp(1)])
         return opened_a
+
+    @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)
+
+        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