You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current tests for the point-mutations exercise assumes that both strings are of the same length. hamming_distance() should return an error when strings of different lengths are passed. I think the idiomatic way to this in Rust would be to change the function signature to return a Result
For expected tests cases a call to unwrap() needs to be added, for error cases we can compare with the error.
#[test]fntest_no_difference_between_empty_strands(){assert_eq!(dna::hamming_distance("", "").unwrap(), 0);}#[test]fntest_second_string_is_longer(){assert_eq!(dna::hamming_distance("A", "AA"), Result::Err("inputs of different length"));}
I will send a pull request for this issue.
The text was updated successfully, but these errors were encountered:
The current tests for the point-mutations exercise assumes that both strings are of the same length.
hamming_distance()
should return an error when strings of different lengths are passed. I think the idiomatic way to this in Rust would be to change the function signature to return a ResultFor expected tests cases a call to unwrap() needs to be added, for error cases we can compare with the error.
I will send a pull request for this issue.
The text was updated successfully, but these errors were encountered: