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

Tests for protein-translation don't match its README #267

Closed
jgallagher opened this issue Mar 15, 2017 · 3 comments · Fixed by #305
Closed

Tests for protein-translation don't match its README #267

jgallagher opened this issue Mar 15, 2017 · 3 comments · Fixed by #305
Labels
good first issue An improvement or bug fix that favors new contributors

Comments

@jgallagher
Copy link

The README for this exercise describe the problem as (roughly) "given a sequence of codons, output the sequence of proteins". However, the tests in protein-translation (a) only seem to expect a single protein name from a single codon and (b) talk about codon "compression" which is not mentioned in the README; e.g.,

fn test_cysteine_tgy() { // "compressed" name for TGT and TGC
    let info = proteins::parse(make_pairs());
    assert_eq!(info.name_for("TGT"), info.name_for("TGY"));
    assert_eq!(info.name_for("TGC"), info.name_for("TGY"));
}

...

fn test_arginine_name() {
    // In arginine CGA can be "compresed" both as CGN and as MGR
    let info = proteins::parse(make_pairs());
    assert_eq!(info.name_for("CGA"), Ok("arginine"));
    assert_eq!(info.name_for("CGN"), Ok("arginine"));
    assert_eq!(info.name_for("MGR"), Ok("arginine"));
}

I glanced at a couple other languages' versions of this exercise and saw tests that look much more like the README and don't talk about compressed names (go, elixir).

@petertseng
Copy link
Member

The questions arising from this:

@jgallagher
Copy link
Author

jgallagher commented Mar 15, 2017

It appears to me that exercism/problem-specifications#268 is correct at a high level:

both these exercises do the exact same thing: they translate codons to their correct names.

but "exact" isn't quite right since the two exercises do so quite differently:

I would cast a vote for changing the protein-translation Rust track tests to match the README (and what the protein-translation tracks in other languages check for). I have no opinion about reintroducing nucleotide-codons.

@petertseng
Copy link
Member

petertseng commented Mar 15, 2017

Thanks for the initial report and the subsequent evaluation!

I also wish to express no opinion on nucleotide-codons, but I will leave on a note for whoever decides to work on exercism/problem-specifications#577 that they may consider whether to include the old tests of nucleotide-codons. At this point we may consider the discussion of nucleotide-codons deferred to that issue.

For the Rust track, I would also agree that the protein-translation tests should change to match the readme.

@petertseng petertseng added the good first issue An improvement or bug fix that favors new contributors label May 2, 2017
go717franciswang added a commit to go717franciswang/xrust that referenced this issue Jun 15, 2017
* Added test cases for function `of_rna`, which translates a strand of
  RNA into a sequence of proteins per README. The test cases are copied
  from the test cases in
  [xpython](https://github.com/exercism/xpython/blob/master/exercises/protein-translation/protein_translation_test.py).
* Added example for `of_rna`.
petertseng added a commit that referenced this issue Jun 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An improvement or bug fix that favors new contributors
Projects
None yet
2 participants