-
-
Notifications
You must be signed in to change notification settings - Fork 356
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
Add test generator for rna transcription exercise #353
Merged
ErikSchierboom
merged 3 commits into
exercism:master
from
robkeim:generator-rna-transcription
Aug 19, 2017
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,20 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
public class Complement | ||
public static class RnaTranscription | ||
{ | ||
private static readonly Dictionary<char, char> DnaToRna = new Dictionary<char, char> | ||
{ | ||
{ 'G', 'C' }, { 'C', 'G' }, { 'T', 'A' }, { 'A', 'U' } | ||
}; | ||
|
||
public static string OfDna(string nucleotide) | ||
public static string ToRna(string nucleotide) | ||
{ | ||
if (nucleotide.Any(x => !DnaToRna.ContainsKey(x))) | ||
{ | ||
return null; | ||
} | ||
|
||
return string.Concat(nucleotide.Select(x => DnaToRna[x])); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,54 @@ | ||
// This file was auto-generated based on version 1.0.1 of the canonical data. | ||
|
||
using Xunit; | ||
|
||
public class ComplementTest | ||
public class RnaTranscriptionTest | ||
{ | ||
[Fact] | ||
public void Rna_complement_of_cytosine_is_guanine() | ||
{ | ||
Assert.Equal("G", Complement.OfDna("C")); | ||
Assert.Equal("G", RnaTranscription.ToRna("C")); | ||
} | ||
|
||
[Fact(Skip = "Remove to run test")] | ||
public void Rna_complement_of_guanine_is_cytosine() | ||
{ | ||
Assert.Equal("C", Complement.OfDna("G")); | ||
Assert.Equal("C", RnaTranscription.ToRna("G")); | ||
} | ||
|
||
[Fact(Skip = "Remove to run test")] | ||
public void Rna_complement_of_thymine_is_adenine() | ||
{ | ||
Assert.Equal("A", Complement.OfDna("T")); | ||
Assert.Equal("A", RnaTranscription.ToRna("T")); | ||
} | ||
|
||
[Fact(Skip = "Remove to run test")] | ||
public void Rna_complement_of_adenine_is_uracil() | ||
{ | ||
Assert.Equal("U", Complement.OfDna("A")); | ||
Assert.Equal("U", RnaTranscription.ToRna("A")); | ||
} | ||
|
||
[Fact(Skip = "Remove to run test")] | ||
public void Rna_complement() | ||
{ | ||
Assert.Equal("UGCACCAGAAUU", Complement.OfDna("ACGTGGTCTTAA")); | ||
Assert.Equal("UGCACCAGAAUU", RnaTranscription.ToRna("ACGTGGTCTTAA")); | ||
} | ||
|
||
[Fact(Skip = "Remove to run test")] | ||
public void Correctly_handles_invalid_input_rna_instead_of_dna_() | ||
{ | ||
Assert.Null(RnaTranscription.ToRna("U")); | ||
} | ||
|
||
[Fact(Skip = "Remove to run test")] | ||
public void Correctly_handles_completely_invalid_dna_input() | ||
{ | ||
Assert.Null(RnaTranscription.ToRna("XXX")); | ||
} | ||
|
||
[Fact(Skip = "Remove to run test")] | ||
public void Correctly_handles_partially_invalid_dna_input() | ||
{ | ||
Assert.Null(RnaTranscription.ToRna("ACGTXXXCTTAA")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Generators.Exercises | ||
{ | ||
public class RnaTranscription : Exercise | ||
{ | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build fails because this (example) class' name has not been renamed to
RnaTranscription
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I fixed that and updated the PR.