Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguity in some test cases for the anagram problem #690

Closed
Anmol-Sharma opened this issue Oct 21, 2018 · 4 comments
Closed

Ambiguity in some test cases for the anagram problem #690

Anmol-Sharma opened this issue Oct 21, 2018 · 4 comments

Comments

@Anmol-Sharma
Copy link

In the anagram problem of the problem set, there are two conflicting test sets, namely test_case_insensitive_anagrams and test_does_not_detect_a_differently_cased_word_as_its_own_anagram.

The testcase for former is :

#[test]
#[ignore]
fn test_case_insensitive_anagrams() {
    let word = "Orchestra";

    let inputs = ["cashregister", "Carthorse", "radishes"];

    let outputs = vec!["Carthorse"];

    process_anagram_case(word, &inputs, &outputs);
}

While the test case for latter is :

#[test]
#[ignore]
fn test_does_not_detect_a_differently_cased_word_as_its_own_anagram() {
    let word = "banana";

    let inputs = ["bAnana"];

    let outputs = vec![];

    process_anagram_case(word, &inputs, &outputs);
}

You can only pass either of these, and not both due to the conflicting nature of both. So i think this will require a fix to remove one of these.

@coriolinus
Copy link
Member

The rules implied by these tests are:

  1. Anagram rules ignore case
  2. A word may not be its own anagram

It is definitely possible to construct an implementation which obeys both of these rules, and passes all test cases. If you are stuck, try looking at anagram/example.rs.

Closing as Not a Bug.

@Anmol-Sharma
Copy link
Author

@coriolinus got it... But it would be better to include the 1st point in instructions for the problem so that it makes it clear. The main reason for opening the issue was that there was no confirmation about if the alphabet casing is being taken into consideration or not due to the "bAnana" test case.

The rules implied by these tests are:

1. Anagram rules ignore case

2. A word may not be its own anagram

It is definitely possible to construct an implementation which obeys both of these rules, and passes all test cases. If you are stuck, try looking at anagram/example.rs.

Closing as Not a Bug.

@BartMassey
Copy link

@coriolinus Both rules 1 and 2 should be provided by the problem specification. Neither is obvious, and both might be reasonably be the other way.

@petertseng
Copy link
Member

You are correct that the problem description https://github.com/exercism/problem-specifications/blob/master/exercises/anagram/description.md does not say either of those things, and I agree with you that it would be an improvement (clearer to the student solving the problem) if it would say those two things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants