Browse Source

test multiple updates

Chelsea H. Komlo 5 years ago
parent
commit
26644512c4
1 changed files with 21 additions and 0 deletions
  1. 21 0
      src/vss.rs

+ 21 - 0
src/vss.rs

@@ -294,4 +294,25 @@ mod tests {
         assert!(recres.is_ok());
         assert_eq!(recres.unwrap(), s);
     }
+
+    #[test]
+    fn share_update_valid_multiple_updates() {
+        let s = Secret::from(42u32);
+
+        let res = generate_shares(s, 5, 2);
+        assert!(res.is_ok());
+        let (com, shares) = res.unwrap();
+
+        for _ in 0..5 {
+            let update_res = update_shares(&com, &shares);
+            assert!(update_res.is_ok());
+            let (update_com, update_shares) = update_res.unwrap();
+
+            for share in update_shares {
+                let is_valid = verify_share(share, &update_com);
+                assert!(is_valid.is_ok());
+                assert!(is_valid.unwrap());
+            }
+        }
+    }
 }