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 wrap: on
line diff
--- a/viff/runtime.py	Wed May 14 16:08:38 2008 +0200
+++ b/viff/runtime.py	Wed May 14 16:09:30 2008 +0200
@@ -1101,7 +1101,8 @@
             # Verify the sharings. If any of the assertions fail and
             # raise an exception, the errbacks will be called on the
             # share returned by single_share_random.
-            assert shamir.verify_sharing(shares, degree), "Could not verify"
+            assert shamir.verify_sharing(shares, degree), \
+                   "Could not verify %s, degree %d" % (shares, degree)
 
             # If we reach this point the n - T shares were verified
             # and we can safely return the first T shares.
@@ -1191,8 +1192,10 @@
             # Verify the sharings. If any of the assertions fail and
             # raise an exception, the errbacks will be called on the
             # double share returned by double_share_random.
-            assert shamir.verify_sharing(si_1, d1), "Could not verify si_1"
-            assert shamir.verify_sharing(si_2, d2), "Could not verify si_2"
+            assert shamir.verify_sharing(si_1, d1), \
+                   "Could not verify %s, degree %d" % (si_1, d1)
+            assert shamir.verify_sharing(si_2, d2), \
+                   "Could not verify %s, degree %d" % (si_2, d2)
             assert shamir.recombine(si_1[:d1+1]) == shamir.recombine(si_2[:d2+1]), \
                 "Shares do not recombine to the same value"