From b0e4cf694994096f652bdeb21e12d6cbdac27881 Mon Sep 17 00:00:00 2001 From: glaxxie <86179463+glaxxie@users.noreply.github.com> Date: Wed, 28 Feb 2024 01:30:52 -0600 Subject: [PATCH] Update test suites (#360) Simplify test files for: - Armstrong Numbers - Isbn Verifier -Isogram -Matching Brackets -Pangram [no important files changed] --- .../ArmstrongNumbers.tests.ps1 | 27 +++++-------- .../isbn-verifier/IsbnVerifier.tests.ps1 | 38 +++++++++--------- exercises/practice/isogram/Isogram.tests.ps1 | 26 ++++++------ .../MatchingBrackets.tests.ps1 | 40 +++++++++---------- exercises/practice/pangram/Pangram.tests.ps1 | 20 +++++----- 5 files changed, 71 insertions(+), 80 deletions(-) diff --git a/exercises/practice/armstrong-numbers/ArmstrongNumbers.tests.ps1 b/exercises/practice/armstrong-numbers/ArmstrongNumbers.tests.ps1 index 24ebaa81..606dfeaf 100644 --- a/exercises/practice/armstrong-numbers/ArmstrongNumbers.tests.ps1 +++ b/exercises/practice/armstrong-numbers/ArmstrongNumbers.tests.ps1 @@ -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 } } diff --git a/exercises/practice/isbn-verifier/IsbnVerifier.tests.ps1 b/exercises/practice/isbn-verifier/IsbnVerifier.tests.ps1 index e106b4fd..fbf15e51 100644 --- a/exercises/practice/isbn-verifier/IsbnVerifier.tests.ps1 +++ b/exercises/practice/isbn-verifier/IsbnVerifier.tests.ps1 @@ -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 } } diff --git a/exercises/practice/isogram/Isogram.tests.ps1 b/exercises/practice/isogram/Isogram.tests.ps1 index f8922cfc..6dee57d1 100644 --- a/exercises/practice/isogram/Isogram.tests.ps1 +++ b/exercises/practice/isogram/Isogram.tests.ps1 @@ -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 } } diff --git a/exercises/practice/matching-brackets/MatchingBrackets.tests.ps1 b/exercises/practice/matching-brackets/MatchingBrackets.tests.ps1 index 593112ad..44e0c5fe 100644 --- a/exercises/practice/matching-brackets/MatchingBrackets.tests.ps1 +++ b/exercises/practice/matching-brackets/MatchingBrackets.tests.ps1 @@ -6,121 +6,121 @@ Describe "Matching brackets test cases" { It "paired square brackets" { $got = Test-MatchingBrackets("[]") - $got | Should -Be $true + $got | Should -BeTrue } It "empty string" { $got = Test-MatchingBrackets("") - $got | Should -Be $true + $got | Should -BeTrue } It "unpaired brackets" { $got = Test-MatchingBrackets("[[") - $got | Should -Be $false + $got | Should -BeFalse } It "wrong ordered brackets" { $got = Test-MatchingBrackets("}{") - $got | Should -Be $false + $got | Should -BeFalse } It "wrong closing bracket" { $got = Test-MatchingBrackets("{]") - $got | Should -Be $false + $got | Should -BeFalse } It "paired with whitespace" { $got = Test-MatchingBrackets("{ }") - $got | Should -Be $true + $got | Should -BeTrue } It "partially paired brackets" { $got = Test-MatchingBrackets("{[])") - $got | Should -Be $false + $got | Should -BeFalse } It "simple nested brackets" { $got = Test-MatchingBrackets("{[]}") - $got | Should -Be $true + $got | Should -BeTrue } It "several paired brackets" { $got = Test-MatchingBrackets("{}[]") - $got | Should -Be $true + $got | Should -BeTrue } It "paired and nested brackets" { $got = Test-MatchingBrackets("([{}({}[])])") - $got | Should -Be $true + $got | Should -BeTrue } It "unopened closing brackets" { $got = Test-MatchingBrackets("{[)][]}") - $got | Should -Be $false + $got | Should -BeFalse } It "unpaired and nested brackets" { $got = Test-MatchingBrackets("([{])") - $got | Should -Be $false + $got | Should -BeFalse } It "paired and wrong nested brackets" { $got = Test-MatchingBrackets("[({]})") - $got | Should -Be $false + $got | Should -BeFalse } It "paired and wrong nested brackets but innermost are correct" { $got = Test-MatchingBrackets("[({}])") - $got | Should -Be $false + $got | Should -BeFalse } It "paired and incomplete brackets" { $got = Test-MatchingBrackets("{}[") - $got | Should -Be $false + $got | Should -BeFalse } It "too many closing brackets" { $got = Test-MatchingBrackets("[]]") - $got | Should -Be $false + $got | Should -BeFalse } It "early unexpected brackets" { $got = Test-MatchingBrackets(")()") - $got | Should -Be $false + $got | Should -BeFalse } It "early mismatched brackets" { $got = Test-MatchingBrackets("{)()") - $got | Should -Be $false + $got | Should -BeFalse } It "math expression" { $got = Test-MatchingBrackets("(((185 + 223.85) * 15) - 543)/2") - $got | Should -Be $true + $got | Should -BeTrue } It "complex latex expression" { $complexString = "\\left(\\begin{array}{cc} \\frac{1}{3} & x\\\\ \\mathrm{e}^{x} &... x^2 \\end{array}\\right)" $got = Test-MatchingBrackets($complexString) - $got | Should -Be $true + $got | Should -BeTrue } } \ No newline at end of file diff --git a/exercises/practice/pangram/Pangram.tests.ps1 b/exercises/practice/pangram/Pangram.tests.ps1 index 30691916..b46dfebd 100644 --- a/exercises/practice/pangram/Pangram.tests.ps1 +++ b/exercises/practice/pangram/Pangram.tests.ps1 @@ -6,60 +6,60 @@ Describe "PangramTests" { It "empty sentence" { $got = Invoke-Panagram -Sentence "" - $got | Should -Be $false + $got | Should -BeFalse } It "perfect lower case" { $got = Invoke-Panagram -Sentence "abcdefghijklmnopqrstuvwxyz" - $got | Should -Be $true + $got | Should -BeTrue } It "only lower case" { $got = Invoke-Panagram -Sentence "the quick brown fox jumps over the lazy dog" - $got | Should -Be $true + $got | Should -BeTrue } It "missing the letter 'x'" { $got = Invoke-Panagram -Sentence "a quick movement of the enemy will jeopardize five gunboats" - $got | Should -Be $false + $got | Should -BeFalse } It "missing the letter 'h'" { $got = Invoke-Panagram -Sentence "five boxing wizards jump quickly at it" - $got | Should -Be $false + $got | Should -BeFalse } It "with underscores" { $got = Invoke-Panagram -Sentence "the_quick_brown_fox_jumps_over_the_lazy_dog" - $got | Should -Be $true + $got | Should -BeTrue } It "with numbers" { $got = Invoke-Panagram -Sentence "the 1 quick brown fox jumps over the 2 lazy dogs" - $got | Should -Be $true + $got | Should -BeTrue } It "missing letters replaced by numbers" { $got = Invoke-Panagram -Sentence "7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog" - $got | Should -Be $false + $got | Should -BeFalse } It "mixed case and punctuation" { $got = Invoke-Panagram -Sentence "`"Five quacking Zephyrs jolt my wax bed.`"" - $got | Should -Be $true + $got | Should -BeTrue } It "a-m and A-M are 26 different characters but not a pangram" { $got = Invoke-Panagram -Sentence "abcdefghijklm ABCDEFGHIJKLM" - $got | Should -Be $false + $got | Should -BeFalse } } \ No newline at end of file