-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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.Equal(null, RnaTranscription.ToRna("U")); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either way has it's pros and cons, but now that I think about other exercises they're mostly throwing exceptions, so for consistency it probably makes sense to head in that direction. |
||
} | ||
|
||
[Fact(Skip = "Remove to run test")] | ||
public void Correctly_handles_completely_invalid_dna_input() | ||
{ | ||
Assert.Equal(null, RnaTranscription.ToRna("XXX")); | ||
} | ||
|
||
[Fact(Skip = "Remove to run test")] | ||
public void Correctly_handles_partially_invalid_dna_input() | ||
{ | ||
Assert.Equal(null, RnaTranscription.ToRna("ACGTXXXCTTAA")); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Generators.Input; | ||
using Generators.Output; | ||
|
||
namespace Generators.Exercises | ||
{ | ||
public class RnaTranscription : Exercise | ||
{ | ||
protected override void UpdateCanonicalData(CanonicalData canonicalData) | ||
{ | ||
foreach (var canonicalDataCase in CanonicalData.Cases) | ||
{ | ||
canonicalDataCase.Expected = canonicalDataCase.Expected ?? new UnescapedValue("null"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not ideal and should not be necessary. A |
||
} | ||
} | ||
} | ||
} |
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.