viff

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 diff
     1.1 --- a/viff/test/test_runtime_prss.py	Tue May 13 16:08:39 2008 +0200
     1.2 +++ b/viff/test/test_runtime_prss.py	Tue May 13 16:09:07 2008 +0200
     1.3 @@ -114,3 +114,17 @@
     1.4          opened_a = runtime.open(a)
     1.5          opened_a.addCallback(self.assertIn, [self.Zp(0), self.Zp(1)])
     1.6          return opened_a
     1.7 +
     1.8 +    @protocol
     1.9 +    def test_prss_share_bit_double(self, runtime):
    1.10 +        """Tests sharing a bit over Zp and GF256."""
    1.11 +        bit_p, bit_b = runtime.prss_share_bit_double(self.Zp)
    1.12 +
    1.13 +        self.assert_type(bit_p, Share)
    1.14 +        self.assertEquals(bit_p.field, self.Zp)
    1.15 +        self.assert_type(bit_b, Share)
    1.16 +        self.assertEquals(bit_b.field, GF256)
    1.17 +
    1.18 +        result = gather_shares([runtime.open(bit_p), runtime.open(bit_b)])
    1.19 +        result.addCallback(lambda (a, b): self.assertEquals(a.value, b.value))
    1.20 +        return result