-
-
Notifications
You must be signed in to change notification settings - Fork 182
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
Add pop-count (#940) #944
Add pop-count (#940) #944
Conversation
config.json
Outdated
@@ -2,14 +2,14 @@ | |||
"language": "C", | |||
"slug": "c", | |||
"active": true, | |||
"blurb": "C is a small, general-purpose, imperative programming language with a static type system, scopes, and structures. It's typically used as an alternative to assembly programming, such as in operating systems.", |
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.
Same as for the other PR applies: This was modified by configlet create
. Let me know if I should revert it or put it into a different PR.
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.
Personally I would prefer an unsigned type for the argument because the behavior of right-shifting a negative number is implementation-defined.
But that's probably a subjective choice to some degree.
|
||
static void test_1_eggs(void) | ||
{ | ||
const int expected = 1; |
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.
In the tests for almost all other exercises there is a line TEST_IGNORE();
(except in the first test), with an explaining comment in the second test.
see https://github.com/exercism/c/blob/main/exercises/practice/grains/test_grains.c#L19
That allows the tests to be enabled one by one so that the student can focus on one test at a time, similarly to Test-Driven Development.
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.
I was wondering about all of those TEST_IGNORE()
, the explanation makes sense. Adapted it now.
|
||
int main(void) | ||
{ | ||
UnityBegin("test_prime_factors.c"); |
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.
This should be "test_pop_count.c"
I agree -- it should be unsigned. |
If you pass in only positive numbers, it doesn't make a difference. But you're right of course, unsigned is cleaner here. Adapted it now. |
I hope I addressed all comments, would be great if you could have another look! |
Implements one of the missing exercises from #940.