Skip to content

Commit

Permalink
Tidy up Pop Count practice exercise
Browse files Browse the repository at this point in the history
- Use snake case for function names
- Fix exercise order
  • Loading branch information
kahgoh committed Oct 27, 2023
1 parent aefb29d commit 99878da
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
24 changes: 12 additions & 12 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1582,6 +1582,18 @@
],
"difficulty": 3
},
{
"slug": "pop-count",
"name": "Pop Count",
"uuid": "8a9d6e1e-9188-44c9-8681-ade84d340dd0",
"practices": [
"bit-manipulation"
],
"prerequisites": [
"bit-manipulation"
],
"difficulty": 3
},
{
"slug": "prime-factors",
"name": "Prime Factors",
Expand Down Expand Up @@ -1701,18 +1713,6 @@
],
"difficulty": 3
},
{
"slug": "pop-count",
"name": "Pop Count",
"uuid": "8a9d6e1e-9188-44c9-8681-ade84d340dd0",
"practices": [
"bit-manipulation"
],
"prerequisites": [
"bit-manipulation"
],
"difficulty": 3
},
{
"slug": "word-count",
"name": "Word Count",
Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/pop-count/.meta/example.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ defmodule PopCount do
@doc """
Given the number, count the number of eggs.
"""
@spec eggCount(number :: integer()) :: non_neg_integer()
def eggCount(number) do
@spec egg_count(number :: integer()) :: non_neg_integer()
def egg_count(number) do
do_count(number, 0)
end

Expand Down
4 changes: 2 additions & 2 deletions exercises/practice/pop-count/lib/pop_count.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule PopCount do
@doc """
Given the number, count the number of eggs.
"""
@spec eggCount(number :: integer()) :: non_neg_integer()
def eggCount(number) do
@spec egg_count(number :: integer()) :: non_neg_integer()
def egg_count(number) do
end
end
8 changes: 4 additions & 4 deletions exercises/practice/pop-count/test/pop_count_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ defmodule PopCountTest do

describe "egg count" do
test "0 eggs" do
assert PopCount.eggCount(0) == 0
assert PopCount.egg_count(0) == 0
end

@tag :pending
test "1 egg" do
assert PopCount.eggCount(16) == 1
assert PopCount.egg_count(16) == 1
end

@tag :pending
test "4 eggs" do
assert PopCount.eggCount(89) == 4
assert PopCount.egg_count(89) == 4
end

@tag :pending
test "13 eggs" do
assert PopCount.eggCount(2_000_000_000) == 13
assert PopCount.egg_count(2_000_000_000) == 13
end
end
end

0 comments on commit 99878da

Please sign in to comment.