Skip to content

Commit

Permalink
pop-count: rename to eliuds-eggs (#348)
Browse files Browse the repository at this point in the history
* Rename the `pop-count` exercise to `eliuds-eggs`.

* Update exercise to reflect name change

-Change names of test suite, example, main file
-Change name in config file

* Change function name

---------

Co-authored-by: glaxxie <[email protected]>
  • Loading branch information
ErikSchierboom and glaxxie authored Feb 6, 2024
1 parent d556172 commit 0b42957
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -586,8 +586,8 @@
"difficulty": 2
},
{
"slug": "pop-count",
"name": "Pop Count",
"slug": "eliuds-eggs",
"name": "Eliuds Eggs",
"uuid": "65fa1796-64de-4da7-8050-41b2a9addd9c",
"practices": [],
"prerequisites": [],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Function Invoke-PopCount() {
Function Invoke-Counter() {
<#
.SYNOPSIS
Count the number of '1' bit in the binary representation of a decimal number.
Expand All @@ -11,7 +11,7 @@ Function Invoke-PopCount() {
Integer represent the decimal value being displayed.
.EXAMPLE
Invoke-PopCount -Value 12345
Invoke-Counter -Value 12345
Returns: 6
#>
[CmdletBinding()]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
],
"files": {
"solution": [
"PopCount.ps1"
"EliudsEggs.ps1"
],
"test": [
"PopCount.tests.ps1"
"EliudsEggs.tests.ps1"
],
"example": [
".meta/PopCount.example.ps1"
".meta/EliudsEggs.example.ps1"
]
},
"blurb": "Help Eliud count the number of eggs in her chicken coop by counting the number of 1 bits in a binary representation.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Function Invoke-PopCount() {
Function Invoke-Counter() {
<#
.SYNOPSIS
Count the number of '1' bit in the binary representation of a decimal number.
Expand All @@ -11,7 +11,7 @@ Function Invoke-PopCount() {
Integer represent the decimal value being displayed.
.EXAMPLE
Invoke-PopCount -Value 12345
Invoke-Counter -Value 12345
Returns: 6
#>
[CmdletBinding()]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
BeforeAll {
. "./PopCount.ps1"
. "./EliudsEggs.ps1"
}

Describe "PopCount test cases" {
It "0 eggs" {
$got = Invoke-PopCount -Value 0
$got = Invoke-Counter -Value 0
$want = 0

$got | Should -BeExactly $want
}

It "1 egg" {
$got = Invoke-PopCount -Value 16
$got = Invoke-Counter -Value 16
$want = 1

$got | Should -BeExactly $want
}

It "4 eggs" {
$got = Invoke-PopCount -Value 89
$got = Invoke-Counter -Value 89
$want = 4

$got | Should -BeExactly $want
}

It "13 eggs" {
$got = Invoke-PopCount -Value 2000000000
$got = Invoke-Counter -Value 2000000000
$want = 13

$got | Should -BeExactly $want
Expand Down

0 comments on commit 0b42957

Please sign in to comment.