Updates tests
This commit is contained in:
parent
e1d0a2d6d2
commit
f85cc9388f
2 changed files with 5 additions and 1 deletions
|
@ -10,7 +10,7 @@ keywords = ["PoW", "sha256", "proof-of-work"]
|
|||
readme = "readme.md"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/robkorn/pow"
|
||||
categories = [] # pr me!
|
||||
categories = ["pow", "sha256"]
|
||||
[dependencies]
|
||||
sha2 = "0.8.0"
|
||||
serde = { version = "1.0.97", features = ["derive"] }
|
||||
|
|
|
@ -102,6 +102,7 @@ mod test {
|
|||
let phrase = b"Ex nihilo nihil fit.".to_vec();
|
||||
let pw = PoW::prove_work(&phrase, DIFFICULTY).unwrap();
|
||||
assert!(pw.calculate(&phrase).unwrap() >= DIFFICULTY);
|
||||
assert!(pw.result >= DIFFICULTY);
|
||||
assert!(pw.is_valid_proof(&phrase));
|
||||
}
|
||||
|
||||
|
@ -112,6 +113,9 @@ mod test {
|
|||
let pwpw: PoW<PoW<String>> = PoW::prove_work(&pw, DIFFICULTY).unwrap();
|
||||
assert!(pw.calculate(&phrase).unwrap() >= DIFFICULTY);
|
||||
assert!(pwpw.calculate(&pw).unwrap() >= DIFFICULTY);
|
||||
assert!(pw.result >= DIFFICULTY);
|
||||
assert!(pwpw.result >= DIFFICULTY);
|
||||
assert!(pw.is_valid_proof(&phrase));
|
||||
assert!(pwpw.is_valid_proof(&pw));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue