-
-
Notifications
You must be signed in to change notification settings - Fork 365
Implement Queen Attack generator #393
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
Implement Queen Attack generator #393
Conversation
beb5f6d
to
d14e62a
Compare
I'm a bit confused. I would expect the |
d14e62a
to
f7eac6f
Compare
That was my initial approach as well. I added the Create() method in the stub and had it return type Queen. Though the canonical data has it returning 0 for success, and -1 for failure, I'm not sure why it uses a number for creation, but a boolean for attacking. Though now that I'm thinking aloud, it may be better to not take the canonical data so literally, and actually go back to Create returning Queen, but throw an exception. |
Agreed! The canonical data can be quite weird sometimes. |
Lets give that approach a whirl. |
In case the github ping didn't go off for some reason, this has been changed to throw exceptions. |
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.
Looking great! Some small nits.
public void Cannot_occupy_same_space() | ||
public void Queen_with_a_valid_position() | ||
{ | ||
var actual = QueenAttack.Create(2, 2); |
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.
Perhaps add a comment below this line to indicate that we are testing that no exception is thrown.
generators/Exercises/QueenAttack.cs
Outdated
return RenderCanAttackAssert(testMethodBody); | ||
} | ||
|
||
if(testMethodBody.UseVariableForTested) |
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.
Add space after if
generators/Exercises/QueenAttack.cs
Outdated
{ | ||
foreach(var canonicalDataCase in canonicalData.Cases) | ||
{ | ||
if(canonicalDataCase.Property == "create") |
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.
Add space after if
generators/Exercises/QueenAttack.cs
Outdated
{ | ||
protected override void UpdateCanonicalData(CanonicalData canonicalData) | ||
{ | ||
foreach(var canonicalDataCase in canonicalData.Cases) |
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.
Add space after foreach
I really need to remember to update my visual studio formatting preferences. |
You really shouldn't have to remember, we should have the tooling do that! I've created an issue for this: #398 |
I don't think it's worth making a special template for the initial case of making a comment, so I just added it to the test description. |
@jpreese Did you re-run the test generator after making that change? It doesn't appear in the test file :) |
Thanks a lot! 🎉 |
One thing to note is that our Example for this one isn't quite complete, so I'm going to start that now.
I'm open to suggestions on the generator for this one.. it feels like a lot, but it could just be a more complicated test to generate. Nothing felt too hacky, and most of it made sense to me.
Edit: Example updated to pass new tests.