File tree Expand file tree Collapse file tree 3 files changed +9
-5
lines changed
exercises/practice/pop-count Expand file tree Collapse file tree 3 files changed +9
-5
lines changed Original file line number Diff line number Diff line change 11#include "pop_count.h"
22
3- int egg_count (int value )
3+ unsigned int egg_count (unsigned int value )
44{
5- int count = 0 ;
5+ unsigned int count = 0 ;
66 while (value != 0 ) {
77 count += value & 1 ;
88 value = value >> 1 ;
Original file line number Diff line number Diff line change 11#ifndef POP_COUNT_H
22#define POP_COUNT_H
33
4- int egg_count (int value );
4+ unsigned int egg_count (unsigned int value );
55
66#endif
Original file line number Diff line number Diff line change @@ -11,33 +11,37 @@ void tearDown(void)
1111
1212static void test_0_eggs (void )
1313{
14- const int expected = 0 ;
14+ const unsigned int expected = 0 ;
1515 TEST_ASSERT_EQUAL_INT (expected , egg_count (0 ));
1616}
1717
1818static void test_1_eggs (void )
1919{
20+ TEST_IGNORE ();
2021 const int expected = 1 ;
2122 TEST_ASSERT_EQUAL_INT (expected , egg_count (16 ));
2223}
2324
2425static void test_4_eggs (void )
2526{
27+ TEST_IGNORE ();
2628 const int expected = 4 ;
2729 TEST_ASSERT_EQUAL_INT (expected , egg_count (89 ));
2830}
2931
3032static void test_13_eggs (void )
3133{
34+ TEST_IGNORE ();
3235 const int expected = 13 ;
3336 TEST_ASSERT_EQUAL_INT (expected , egg_count (2000000000 ));
3437}
3538
3639int main (void )
3740{
38- UnityBegin ("test_prime_factors .c" );
41+ UnityBegin ("test_pop_count .c" );
3942
4043 RUN_TEST (test_0_eggs );
44+
4145 RUN_TEST (test_1_eggs );
4246 RUN_TEST (test_4_eggs );
4347 RUN_TEST (test_13_eggs );
You can’t perform that action at this time.
0 commit comments