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

wordy: Test question What is? because it's too short #1401

Merged
merged 2 commits into from
Nov 22, 2018
Merged

wordy: Test question What is? because it's too short #1401

merged 2 commits into from
Nov 22, 2018

Conversation

petertseng
Copy link
Member

wordy 1.5.0

In keeping with 1.3.0, we want to test that these fail in an
expected way rather than an unexpected way.

For example, imagine a language that uses an optional as the answer. We
would want to make sure an implementation written in that language would
return None, rather than (say) accessing an out-of-bounds index due to
always assuming that the inputs will have at least three space-separated
elements (of the form "What is X...?").

"expected": {"error": "syntax error"}
},
{
"description": "reject empty string",
Copy link
Member

Choose a reason for hiding this comment

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

Is this test perhaps unnecessary because of #902?

Copy link
Member Author

Choose a reason for hiding this comment

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

Part of me wants to say "but then who will guard against people assuming that the input is always at least two words!" but I guess part of the question is what assumptions we're at liberty to make. Here's my deal. I'm going to leave that case for later. If there's a desire to add it, it'll be in 1.6.0

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we need a case that asks a valid question but doesn't start with "What is". "What is" shouldn't influence the outcome.

5 plus 6 is?

should work the same as:

What is 6 plus 5?

and

6 plus 2 plus 3?

For another PR perhaps......

Copy link
Member Author

Choose a reason for hiding this comment

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

These proposals, along with the empty string, do bring up interesting questions of how far we want to take the parsing aspect in this problem.

The arithmetic portion is not too complicated, but does bring up interesting questions of how to translate each operation from its verbal form to its code form. So there could be some room to do more parsing.

I have not yet decided what I would suggest in this realm.

@petertseng petertseng changed the title wordy: Test questions that are too short (What is? and empty string) wordy: Test question What is? because it's too short Nov 20, 2018
@@ -151,6 +151,14 @@
},
"expected": {"error": "syntax error"}
},
{
"description": "reject unstarted problem",
Copy link
Member

Choose a reason for hiding this comment

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

Is this unstarted or unfinished?

Copy link
Member Author

Choose a reason for hiding this comment

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

if I call it unfinished, I worry that the description sounds too similar to incomplete problem above (since I see unfinished and incomplete to have too similar meanings).

If we take for granted that "What is" is a common feature of all questions, then I see it making sense since they didn't even start saying anything else

But if this assumption gets broken in a later PR that adds questions that don't start with "What is", then this description won't make sense!!

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps ambiguous instead of unfinished.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the way out will be to say exactly in what way the two problems are incomplete. I have now made a proposal.

I will be adding another case soon that has a problem that is incomplete
in a different way
wordy 1.5.0

In keeping with [1.3.0][], we want to test that this fails in an
expected way rather than an unexpected way.

[1.3.0]: #1383

For example, imagine a language that uses an optional as the answer. We
would want to make sure an implementation written in that language would
return `None`, rather than (say) accessing an out-of-bounds index due to
always assuming that the inputs will have at least three space-separated
elements (of the form "What is X...?").
Copy link
Member

@rpottsoh rpottsoh left a comment

Choose a reason for hiding this comment

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

I like it! Thanks @petertseng.

@petertseng
Copy link
Member Author

All right, thanks! Everyone else I'd say you have about 24 hours to get a word in.

@petertseng petertseng merged commit e2590be into exercism:master Nov 22, 2018
@petertseng petertseng deleted the wordy branch November 22, 2018 23:32
petertseng added a commit to exercism/haskell that referenced this pull request Nov 23, 2018
…#779)

In keeping with [1.3.0][], we want to test that this fails in an
expected way rather than an unexpected way.

[1.3.0]: exercism/problem-specifications#1383

Specifically for Haskell, we want to make sure that this results in
`None` rather than accessing an out-of-bounds index due to always
assuming that the inputs will have at least three space-separated
elements (of the form "What is X...?").

exercism/problem-specifications#1401
petertseng added a commit to exercism/rust that referenced this pull request Nov 24, 2018
…764)

In keeping with [1.3.0][], we want to test that this fails in an
expected way rather than an unexpected way.

[1.3.0]: exercism/problem-specifications#1383

Specifically for Rust, we want to make sure that this results in `None`
rather than accessing an out-of-bounds index due to always assuming that
the inputs will have at least three space-separated elements (of the
form "What is X...?").

exercism/problem-specifications#1401
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants