Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 9 additions & 18 deletions exercises/practice/armstrong-numbers/ArmstrongNumbers.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,55 @@ BeforeAll {
Describe "Test Invoke-ArmstrongNumbers.ps1" {
It "Zero is an Armstrong number" {
$got = Invoke-ArmstrongNumbers -Number 0
$want = $True

$got | Should -Be $want
$got | Should -BeTrue
}

It "Single-digit numbers are Armstrong numbers" {
$got = Invoke-ArmstrongNumbers -Number 5
$want = $True

$got | Should -BeExactly $want
$got | Should -BeTrue
}

It "There are no two-digit Armstrong numbers" {
$got = Invoke-ArmstrongNumbers -Number 10
$want = $False

$got | Should -BeExactly $want
$got | Should -BeFalse
}

It "Three-digit number that is an Armstrong number" {
$got = Invoke-ArmstrongNumbers -Number 153
$want = $True

$got | Should -BeExactly $want
$got | Should -BeTrue
}

It "Three-digit number that is not an Armstrong number" {
$got = Invoke-ArmstrongNumbers -Number 100
$want = $False

$got | Should -BeExactly $want
$got | Should -BeFalse
}

It "Four-digit number that is an Armstrong number" {
$got = Invoke-ArmstrongNumbers -Number 9474
$want = $True

$got | Should -BeExactly $want
$got | Should -BeTrue
}

It "Four-digit number that is not an Armstrong number" {
$got = Invoke-ArmstrongNumbers -Number 9475
$want = $False

$got | Should -BeExactly $want
$got | Should -BeFalse
}

It "Seven-digit number that is an Armstrong number" {
$got = Invoke-ArmstrongNumbers -Number 9926315
$want = $True

$got | Should -BeExactly $want
$got | Should -BeTrue
}

It "Seven-digit number that is not an Armstrong number" {
$got = Invoke-ArmstrongNumbers -Number 9926314
$want = $False

$got | Should -BeExactly $want
$got | Should -BeFalse
}
}
38 changes: 19 additions & 19 deletions exercises/practice/isbn-verifier/IsbnVerifier.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,114 +6,114 @@ Describe "IsbnVerifierTests" {
It "valid isbn" {
$got = Test-Isbn -Isbn "3-598-21508-8"

$got | Should -Be $true
$got | Should -BeTrue
}

It "invalid isbn check digit" {
$got = Test-Isbn -Isbn "3-598-21508-9"

$got | Should -Be $false
$got | Should -BeFalse
}

It "valid isbn with a check digit of 10" {
$got = Test-Isbn -Isbn "3-598-21507-X"

$got | Should -Be $true
$got | Should -BeTrue
}

It "check digit is a character other than X" {
$got = Test-Isbn -Isbn "3-598-21507-A"

$got | Should -Be $false
$got | Should -BeFalse
}

It "invalid check digit in isbn is not treated as zero" {
$got = Test-Isbn -Isbn "4-598-21507-B"

$got | Should -Be $false
$got | Should -BeFalse
}

It "invalid character in isbn is not treated as zero" {
$got = Test-Isbn -Isbn "3-598-P1581-X"

$got | Should -Be $false
$got | Should -BeFalse
}

It "X is only valid as a check digit" {
$got = Test-Isbn -Isbn "3-598-2X507-9"

$got | Should -Be $false
$got | Should -BeFalse
}

It "valid isbn without separating dashes" {
$got = Test-Isbn -Isbn "3598215088"

$got | Should -Be $true
$got | Should -BeTrue
}

It "isbn without separating dashes and X as check digit" {
$got = Test-Isbn -Isbn "359821507X"

$got | Should -Be $true
$got | Should -BeTrue
}

It "isbn without check digit and dashes" {
$got = Test-Isbn -Isbn "359821507"

$got | Should -Be $false
$got | Should -BeFalse
}

It "too long isbn and no dashes" {
$got = Test-Isbn -Isbn "3598215078X"

$got | Should -Be $false
$got | Should -BeFalse
}

It "too short isbn" {
$got = Test-Isbn -Isbn "00"

$got | Should -Be $false
$got | Should -BeFalse
}

It "isbn without check digit" {
$got = Test-Isbn -Isbn "3-598-21507"

$got | Should -Be $false
$got | Should -BeFalse
}

It "check digit of X should not be used for 0" {
$got = Test-Isbn -Isbn "3-598-21515-X"

$got | Should -Be $false
$got | Should -BeFalse
}

It "empty isbn" {
$got = Test-Isbn -Isbn ""

$got | Should -Be $false
$got | Should -BeFalse
}

It "input is 9 characters" {
$got = Test-Isbn -Isbn "134456729"

$got | Should -Be $false
$got | Should -BeFalse
}

It "invalid characters are not ignored after checking length" {
$got = Test-Isbn -Isbn "3132P34035"

$got | Should -Be $false
$got | Should -BeFalse
}

It "invalid characters are not ignored before checking length" {
$got = Test-Isbn -Isbn "3598P215088"

$got | Should -Be $false
$got | Should -BeFalse
}

It "input is too long but contains a valid isbn" {
$got = Test-Isbn -Isbn "98245726788"

$got | Should -Be $false
$got | Should -BeFalse
}
}
26 changes: 13 additions & 13 deletions exercises/practice/isogram/Isogram.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,78 +6,78 @@ Describe "IsogramTests" {
It "empty string" {
$got = Invoke-Isogram -Phrase ""

$got | Should -Be $true
$got | Should -BeTrue
}

It "isogram with only lower case characters" {
$got = Invoke-Isogram -Phrase "isogram"

$got | Should -Be $true
$got | Should -BeTrue
}

It "word with one duplicated character" {
$got = Invoke-Isogram -Phrase "eleven"

$got | Should -Be $false
$got | Should -BeFalse
}

It "word with one duplicated character from the end of the alphabet" {
$got = Invoke-Isogram -Phrase "zzyzx"

$got | Should -Be $false
$got | Should -BeFalse
}

It "longest reported english isogram" {
$got = Invoke-Isogram -Phrase "subdermatoglyphic"

$got | Should -Be $true
$got | Should -BeTrue
}

It "word with duplicated character in mixed case" {
$got = Invoke-Isogram -Phrase "Alphabet"

$got | Should -Be $false
$got | Should -BeFalse
}

It "word with duplicated character in mixed case, lowercase first" {
$got = Invoke-Isogram -Phrase "alphAbet"

$got | Should -Be $false
$got | Should -BeFalse
}

It "hypothetical isogrammic word with hyphen" {
$got = Invoke-Isogram -Phrase "thumbscrew-japingly"

$got | Should -Be $true
$got | Should -BeTrue
}

It "hypothetical word with duplicated character following hyphen" {
$got = Invoke-Isogram -Phrase "thumbscrew-jappingly"

$got | Should -Be $false
$got | Should -BeFalse
}

It "isogram with duplicated hyphen" {
$got = Invoke-Isogram -Phrase "six-year-old"

$got | Should -Be $true
$got | Should -BeTrue
}

It "made-up name that is an isogram" {
$got = Invoke-Isogram -Phrase "Emily Jung Schwartzkopf"

$got | Should -Be $true
$got | Should -BeTrue
}

It "duplicated character in the middle" {
$got = Invoke-Isogram -Phrase "accentor"

$got | Should -Be $false
$got | Should -BeFalse
}

It "word with duplicated character and with two hyphens" {
$got = Invoke-Isogram -Phrase "up-to-date"

$got | Should -Be $false
$got | Should -BeFalse
}
}
Loading