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

state-of-tic-tac-toe: tweak error nessage and add test case #2012

Merged
merged 4 commits into from
Apr 20, 2022

Conversation

jiegillet
Copy link
Contributor

In the last test, the board is

XXX
OOO
   

and it's clear that X won and O kept playing, but for this board:

XXX
OOO
XOX

it's impossible to determine who won "first".

And really, it doesn't matter who won, what matters is that this is an impossible board because the players kept going after the game was won, so I'm proposing to tweak the error message to reflect that and add one more test case to justify the change.

Credits to @angelikatyborska for finding this incompleteness issue.

@jiegillet jiegillet added new test case idea x:action/improve Improve existing functionality/content labels Apr 18, 2022
Copy link
Contributor

@SaschaMann SaschaMann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is reimplementing required for changing the error message?

Either way, this looks good.

@jiegillet
Copy link
Contributor Author

jiegillet commented Apr 18, 2022

I guess so, I didn't think so either, but the CI didn't let me change just the error...
Link to failing CI.

@SaschaMann
Copy link
Contributor

The CI script doesn't really consider errors explicitly, it's mostly a side effect. @ErikSchierboom Should error messages be immutable too? To me they seem like descriptions.

@SaschaMann
Copy link
Contributor

I think the question here would be what the error text is. Is it like the description, an error that explains why it should be an error to the maintainers so that they interpret it in a way that makes sense in their language, or is it the actual error message that the student would have to return? To me it seems like it should be the former because it's impossible to write the latter in a language-agnostic way.

If it's the former, it should be mutable.

@jiegillet
Copy link
Contributor Author

jiegillet commented Apr 18, 2022

That's true, depending on how you want to implement the exercise, you might not return the error as this exact string, although I do feel that many track probably would do that, since returning an error with a string is a pretty standard. I usually choose to do that in Elixir/Elm. Since I can ask students to return strings, why wouldn't I use the one provided to me here?

Another point is that I would want the maintainers to see that an error message has been changed. Does configlet inform people of such a change if the test case has not been reimplemented? If it doesn't, then it's a point for immutable, but I can't remember if it does...

@ErikSchierboom
Copy link
Member

Another point is that I would want the maintainers to see that an error message has been changed. Does configlet inform people of such a change if the test case has not been reimplemented? If it doesn't, then it's a point for immutable, but I can't remember if it does...

No, we don't show these changes. We've had discussions on the error text before, but we hadn't yet reached a satisfactory conclusion I think. I think I'm still leaning towards reimplementation, as some tracks will be using the error description to influence what code is being generated.

Copy link
Contributor

@SaschaMann SaschaMann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think it might be better to have both test cases but with the same error message. I don't see an obvious reason to remove the old one entirely.

(This was nonsense; see below)

@jiegillet
Copy link
Contributor Author

I'm not sure I understand.
I haven't removed the old test case, I have reimplemented it with the updated error message, and also added a new one with the same error message.

Copy link
Contributor

@SaschaMann SaschaMann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, yes, I misread the files changed in that last message. Not sure what I had in mind.

},
{
"uuid": "4801cda2-f5b7-4c36-8317-3cdd167ac22c",
"description": "Invalid board",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that every test case for invalid board has the exact same description, which will definitely trip up test generators. It also not very descriptive. Maybe we could update the descriptions of the invalid board test cases to include the error?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that every test case for invalid board has the exact same description, which will definitely trip up test generators.

See #1991 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not just the invalid board, most descriptions repeat 3 times...
On the Elixir implementation I added (1) (2) (3)... To all descriptions. It was a bit tedious.
Shall I do the same, or better descriptions?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall I do the same, or better descriptions?

Adding the errors to the descriptions here seems reasonable but I'd leave the other descriptions for a different PR.

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. As suggested, the descriptions can be improved in a follow-up PR.

@SaschaMann SaschaMann merged commit e6be5ee into main Apr 20, 2022
@SaschaMann SaschaMann deleted the jie-state-of-tic-tac-toe branch April 20, 2022 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new test case idea x:action/improve Improve existing functionality/content
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants