-
-
Notifications
You must be signed in to change notification settings - Fork 216
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
Sync nucleotide-count with problem-specifications #550
Conversation
This removes an unimplemented test from the tests.toml.
This deletes some tests that are not in the canonical-data in problem-specifications.
This reorders the tests to match the order in the canonical-data.
This reformats the config.json to make configlet happy.
This updates the existing tests to use the inputs and test names from canonical-data.
This brings the nucleotide-count exercise up to date with the specification in problem-specifications. The sync brought in changes to the instructions and metadata, as well as adding a new test.
The tests no longer reference the count function. This deletes it.
I completely missed this back in November. Previously implementing this task with a class made sense. A Now that the member function To me that looks now like a task for a regular function that performs the validation (it might |
Probably not! I was likely just following what was already there, and then tweaking it to follow the current canonical data. I don't actually write C++, and I don't even remember making this PR (which is a bit disconcerting). Please feel free to change the implementation, if you have something better in mind. |
Before PR exercism#550 the constructor was required to validate the input, the member function `count(char)` had to return the count for a specific nucleotide, the member function `nucleotide_counts()` had to return a `std::map` with all four counts. But PR exercism#550 has changed that significantly. After syncing the tests with the canonical data there's no call to `count(char)` anymore, so each test looks like a two-step function call: ``` const nucleotide_count::counter dna("G"); const auto actual = dna.nucleotide_counts(); ``` I'd call that unnecessarily complicated and unidiomatic, there's no longer a good reason to require a `class`. Let's turn the class `counter` into a function: ``` const auto actual = nucleotide_count::count("G"); ```
Before PR #550 the constructor was required to validate the input, the member function `count(char)` had to return the count for a specific nucleotide, the member function `nucleotide_counts()` had to return a `std::map` with all four counts. But PR #550 has changed that significantly. After syncing the tests with the canonical data there's no call to `count(char)` anymore, so each test looks like a two-step function call: ``` const nucleotide_count::counter dna("G"); const auto actual = dna.nucleotide_counts(); ``` I'd call that unnecessarily complicated and unidiomatic, there's no longer a good reason to require a `class`. Let's turn the class `counter` into a function: ``` const auto actual = nucleotide_count::count("G"); ```
This brings the nucleotide-counts exercise up to date with problem-specifications.
For clarity, it makes the change in several commits:
tests.toml
that are not reflected in the test suite (per Update each tracks tests.toml file #370)canonical-data.json
canonical-data.json
configlet fmt
on nucleotide-count to normalize theconfig.json
configlet sync
for the exercise and implementing the missing test.Closes #544
Closes #539