Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

unit_tests.rs 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #[cfg(test)]
  2. mod tests {
  3. use hash256;
  4. #[test]
  5. fn test_verify1() {
  6. assert_eq!(
  7. hash256::verify_product(42, 567621, "12345"),
  8. Some(hash256::Solution(
  9. 567621,
  10. "b6bea2a40ed1bd6d9999b2232072092f3df0e02c4b507aa3ad947367b9712345"
  11. .to_string(),
  12. ))
  13. );
  14. }
  15. #[test]
  16. #[should_panic]
  17. fn test_verify2() {
  18. assert_eq!(
  19. hash256::verify_product(41, 567621, "12345"),
  20. Some(hash256::Solution(
  21. 567621,
  22. "b6bea2a40ed1bd6d9999b2232072092f3df0e02c4b507aa3ad947367b9712345"
  23. .to_string(),
  24. ))
  25. );
  26. }
  27. #[test]
  28. #[should_panic]
  29. fn test_verify3() {
  30. assert_eq!(
  31. hash256::verify_product(42, 567620, "12345"),
  32. Some(hash256::Solution(
  33. 567621,
  34. "b6bea2a40ed1bd6d9999b2232072092f3df0e02c4b507aa3ad947367b9712345"
  35. .to_string(),
  36. ))
  37. );
  38. }
  39. #[test]
  40. fn test_verify4() {
  41. assert_eq!(hash256::verify_product(41, 567621, "12345"), None);
  42. }
  43. #[test]
  44. fn test_verify5() {
  45. assert_eq!(hash256::verify_product(42, 567622, "12345"), None);
  46. }
  47. }