Açıklama Yok
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

task1.rs 876B

123456789101112131415161718192021222324252627282930313233343536
  1. extern crate task1;
  2. #[test]
  3. fn test_no_difference_between_empty_strands() {
  4. assert_eq!(task1::hamming_distance("", "").unwrap(), 0);
  5. }
  6. #[test]
  7. fn test_no_difference_between_identical_strands() {
  8. assert_eq!(task1::hamming_distance("GGACTGA", "GGACTGA").unwrap(), 0);
  9. }
  10. #[test]
  11. fn test_complete_hamming_distance_in_small_strand() {
  12. assert_eq!(task1::hamming_distance("ACT", "GGA").unwrap(), 3);
  13. }
  14. #[test]
  15. fn test_small_hamming_distance_in_the_middle_somewhere() {
  16. assert_eq!(task1::hamming_distance("GGACG", "GGTCG").unwrap(), 1);
  17. }
  18. #[test]
  19. fn test_larger_distance() {
  20. assert_eq!(task1::hamming_distance("ACCAGGG", "ACTATGG").unwrap(), 2);
  21. }
  22. #[test]
  23. fn test_first_string_is_longer() {
  24. assert!(task1::hamming_distance("AAA", "AA").is_err());
  25. }
  26. #[test]
  27. fn test_second_string_is_longer() {
  28. assert!(task1::hamming_distance("A", "AA").is_err());
  29. }