viff

changeset 757:585e6f4c7c77

Better messages for assertions.
author Martin Geisler <mg@daimi.au.dk>
date Wed, 14 May 2008 16:09:30 +0200
parents 2467d814530c
children 5c83d5ff31fa
files viff/runtime.py
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/viff/runtime.py	Wed May 14 16:08:38 2008 +0200
     1.2 +++ b/viff/runtime.py	Wed May 14 16:09:30 2008 +0200
     1.3 @@ -1101,7 +1101,8 @@
     1.4              # Verify the sharings. If any of the assertions fail and
     1.5              # raise an exception, the errbacks will be called on the
     1.6              # share returned by single_share_random.
     1.7 -            assert shamir.verify_sharing(shares, degree), "Could not verify"
     1.8 +            assert shamir.verify_sharing(shares, degree), \
     1.9 +                   "Could not verify %s, degree %d" % (shares, degree)
    1.10  
    1.11              # If we reach this point the n - T shares were verified
    1.12              # and we can safely return the first T shares.
    1.13 @@ -1191,8 +1192,10 @@
    1.14              # Verify the sharings. If any of the assertions fail and
    1.15              # raise an exception, the errbacks will be called on the
    1.16              # double share returned by double_share_random.
    1.17 -            assert shamir.verify_sharing(si_1, d1), "Could not verify si_1"
    1.18 -            assert shamir.verify_sharing(si_2, d2), "Could not verify si_2"
    1.19 +            assert shamir.verify_sharing(si_1, d1), \
    1.20 +                   "Could not verify %s, degree %d" % (si_1, d1)
    1.21 +            assert shamir.verify_sharing(si_2, d2), \
    1.22 +                   "Could not verify %s, degree %d" % (si_2, d2)
    1.23              assert shamir.recombine(si_1[:d1+1]) == shamir.recombine(si_2[:d2+1]), \
    1.24                  "Shares do not recombine to the same value"
    1.25