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

Revise Hamming tests with missing cases from specification #48

Merged
merged 10 commits into from
Oct 15, 2017

Conversation

jerold
Copy link
Contributor

@jerold jerold commented Oct 4, 2017

Issues

#40

Updating tests for Dart hamming distance example.

// Put your code here
int compute(String a, String b) {
// Put your code here
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This can be reverted. The users will know it needs to be implemented from the tests. Best let them decide the details like the types used.

Copy link
Contributor

@Stargator Stargator left a comment

Choose a reason for hiding this comment

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

@jerold This is a great job.

But I feel like I may have misspoke my direction.

I meant to say, add the following 6 cases to the previous test suite. If any of the 6 cases are duplicates, then don't add them.

The first case (empty strands) from the json is not implemented.

And the following cases:

non-unique character in first strand
non-unique character in second strand
same nucleotides in different positions
disallow first strand longer
disallow second strand longer

Additionally, there some of the tests ended with }, skip: true);. Leave those in place, since only the first test should not be skipped.

Also, it may be an issue on Travis CI's side, but the build of this PR has been going on for 1 hour and 42 min. So I'm going to restart it.

@Stargator
Copy link
Contributor

@jerold Just checking in, how do you feel about my feedback?

@jerold
Copy link
Contributor Author

jerold commented Oct 10, 2017

@Stargator Sorry about the delay. I was out of town last weekend. I'm going to clean this up today.

@Stargator
Copy link
Contributor

@jerold No worries. Thanks for remembering us 😸

@jerold
Copy link
Contributor Author

jerold commented Oct 10, 2017

@Stargator restored the previous set of tests and implemented the 6 you've asked for. Run the new tests against the example hamming implementation and all pass. Ready for re-review.

Copy link
Contributor

@Stargator Stargator left a comment

Choose a reason for hiding this comment

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

All but the first test should be skipped.

I'll look over the tests Wed/Thurs and get back to you. I see some have moved around and I want to make sure I track that.

@jerold
Copy link
Contributor Author

jerold commented Oct 11, 2017

@Stargator Sorry for the churn. The previous commit by itself may look a little confusing. I effectively undid the previous commit (where I'd reordered/renamed the tests to exactly match the canonical-data.json file). Looking at the diff for the whole pr currently should show 6 tests added:

  • empty strands
  • non-unique character in first strand
  • non-unique character in second strand
  • same nucleotides in different positions
  • disallow first strand longer
  • disallow second strand longer

Do you mean to say the bottom 5 of those should be skipped, or should all tests in the file, minus the top test be skipped? Are these tests brought online one by one somehow as the coder works on their implementation? I'm curious what the process is for these tests that required them to be skipped initially? Are these part of multi-part tutorial?

@Stargator
Copy link
Contributor

@jerold The tests should be done one at a time. Generally, the top test is the first test (we don't skip the first test). Then all the tests that follow it will be appended with }, skip: true);

should all tests in the file, minus the top test be skipped?

Yes

The process is that we are signalling to the user that the first problem for them is the only test that is failing, the first test. Then they solve that problem by passing the first test.

Then they stop skipping the second test, see that it fails and work to resolve it. Then repeat the cycle until all the tests pass.

Copy link
Contributor

@Stargator Stargator left a comment

Choose a reason for hiding this comment

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

If you can convince me otherwise, I suggest changing two tests to make it more clear to the user.

final res = hamming.compute("AGG", "AGA");

expect(res, equals(1));
}, skip: true);
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't see a reasonable difference between the two tests.

For "non-unique character in first strand", if the first strand was "AAG" and the second strand was "AAA", then I would understand the problem.

Then reverse it for "non-unique character in second strand".

@jerold
Copy link
Contributor Author

jerold commented Oct 14, 2017

@Stargator give this a look. I've translated the full test suite described in canonical-data.json to dart tests. Each test has a counterpart. Same descriptions, cases, expectations. The diff is a little ugly, but take a look at the current raw test file next to canonical, and I think you'll like it. Otherwise I can revert, but in that case I would think a change really should be made to canonical first, and the tests then made to match here in hamming_test.dart.

@Stargator
Copy link
Contributor

Stargator commented Oct 14, 2017

@jerold Understood. But do understand, we don't have to follow the canonical-data 1 to 1.

So I opened a PR in the problem-specifications exercism/problem-specifications#953, feel free to comment.

Outside of that, the files need to be formatted they are failing the CI Build.

@Stargator Stargator added this to the LaunchPad milestone Oct 15, 2017
@Stargator Stargator changed the title 40_43 strong types in example Revise Hamming tests with missing cases from specification Oct 15, 2017
@Stargator Stargator merged commit 3a9996b into exercism:master Oct 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants