Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(*-check.rexx): bulk update change to symbolic comparator #124

Merged
merged 1 commit into from
Jul 20, 2024
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
10 changes: 5 additions & 5 deletions exercises/practice/accumulate/accumulate-check.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ context('Checking the Accumulate function')

/* Unit tests */
check('accumulate empty test' 'Accumulate("", "Dummy")',,
'Accumulate("", "Dummy")',, 'to be', '')
'Accumulate("", "Dummy")',, '=', '')

check('accumulate squares test' 'Accumulate("1 2 3", "Square")',,
'Accumulate("1 2 3", "Square")',, 'to be', '1 4 9')
'Accumulate("1 2 3", "Square")',, '=', '1 4 9')

check('accumulate upcases test' 'Accumulate("hello world", "ToUpperCase")',,
'Accumulate("hello world", "ToUpperCase")',, 'to be', 'HELLO WORLD')
'Accumulate("hello world", "ToUpperCase")',, '=', 'HELLO WORLD')

check('accumulate reversed strings test' 'Accumulate("the quick brown fox etc", "ReverseToken")',,
'Accumulate("the quick brown fox etc", "ReverseToken")',, 'to be', 'eht kciuq nworb xof cte')
'Accumulate("the quick brown fox etc", "ReverseToken")',, '=', 'eht kciuq nworb xof cte')

check('accumulate recursively test' 'Accumulate("1 2 3 4 5", "GenSeq")',,
'Accumulate("1 2 3 4 5", "GenSeq")',, 'to be', '1 1 2 1 2 3 1 2 3 4 1 2 3 4 5')
'Accumulate("1 2 3 4 5", "GenSeq")',, '=', '1 1 2 1 2 3 1 2 3 4 1 2 3 4 5')

18 changes: 9 additions & 9 deletions exercises/practice/acronym/acronym-check.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ context('Checking the Abbreviate function')

/* Unit tests */
check('basic' 'Abbreviate("Portable Network Graphics")',,
'Abbreviate("Portable Network Graphics")',, 'to be', 'PNG')
'Abbreviate("Portable Network Graphics")',, '=', 'PNG')

check('lowercase words' 'Abbreviate("Ruby on Rails")',,
'Abbreviate("Ruby on Rails")',, 'to be', 'ROR')
'Abbreviate("Ruby on Rails")',, '=', 'ROR')

check('punctuation' 'Abbreviate("First In, First Out")',,
'Abbreviate("First In, First Out")',, 'to be', 'FIFO')
'Abbreviate("First In, First Out")',, '=', 'FIFO')

check('all caps word' 'Abbreviate("GNU Image Manipulation Program")',,
'Abbreviate("GNU Image Manipulation Program")',, 'to be', 'GIMP')
'Abbreviate("GNU Image Manipulation Program")',, '=', 'GIMP')

check('punctuation without whitespace' 'Abbreviate("Complementary metal-oxide semiconductor")',,
'Abbreviate("Complementary metal-oxide semiconductor")',, 'to be', 'CMOS')
'Abbreviate("Complementary metal-oxide semiconductor")',, '=', 'CMOS')

check('very long abbreviation' 'Abbreviate("Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me")',,
'Abbreviate("Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me")',, 'to be', 'ROTFLSHTMDCOALM')
'Abbreviate("Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me")',, '=', 'ROTFLSHTMDCOALM')

check('consecutive delimiters' 'Abbreviate("Something - I made up from thin air")',,
'Abbreviate("Something - I made up from thin air")',, 'to be', 'SIMUFTA')
'Abbreviate("Something - I made up from thin air")',, '=', 'SIMUFTA')

check('apostrophes' 'Abbreviate("Halley''s Comet")',,
'Abbreviate("Halley''s Comet")',, 'to be', 'HC')
'Abbreviate("Halley''s Comet")',, '=', 'HC')

check('underscore emphasis' 'Abbreviate("The Road __Not__ Taken")',,
'Abbreviate("The Road __Not__ Taken")',, 'to be', 'TRNT')
'Abbreviate("The Road __Not__ Taken")',, '=', 'TRNT')

42 changes: 21 additions & 21 deletions exercises/practice/all-your-base/all-your-base-check.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,65 @@ context('Checking the Rebase function')

/* Unit tests */
check('single bit to one decimal' 'Rebase(2, "1", 10)',,
'Rebase(2, "1", 10)',, 'to be', '1')
'Rebase(2, "1", 10)',, '=', '1')

check('binary to single decimal' 'Rebase(2, "1 0 1", 10)',,
'Rebase(2, "1 0 1", 10)',, 'to be', '5')
'Rebase(2, "1 0 1", 10)',, '=', '5')

check('single decimal to binary' 'Rebase(10, "5", 2)',,
'Rebase(10, "5", 2)',, 'to be', '1 0 1')
'Rebase(10, "5", 2)',, '=', '1 0 1')

check('binary to multiple decimal' 'Rebase(2, "1 0 1 0 1 0", 10)',,
'Rebase(2, "1 0 1 0 1 0", 10)',, 'to be', '4 2')
'Rebase(2, "1 0 1 0 1 0", 10)',, '=', '4 2')

check('decimal to binary' 'Rebase(10, "4 2", 2)',,
'Rebase(10, "4 2", 2)',, 'to be', '1 0 1 0 1 0')
'Rebase(10, "4 2", 2)',, '=', '1 0 1 0 1 0')

check('trinary to hexadecimal' 'Rebase(3, "1 1 2 0", 16)',,
'Rebase(3, "1 1 2 0", 16)',, 'to be', '2 10')
'Rebase(3, "1 1 2 0", 16)',, '=', '2 10')

check('hexadecimal to trinary' 'Rebase(16, "2 10", 3)',,
'Rebase(16, "2 10", 3)',, 'to be', '1 1 2 0')
'Rebase(16, "2 10", 3)',, '=', '1 1 2 0')

check('15 bit integer' 'Rebase(97, "3 46 60", 73)',,
'Rebase(97, "3 46 60", 73)',, 'to be', '6 10 45')
'Rebase(97, "3 46 60", 73)',, '=', '6 10 45')

check('empty list' 'Rebase(2, "", 10)',,
'Rebase(2, "", 10)',, 'to be', '')
'Rebase(2, "", 10)',, '=', '')

check('single zero' 'Rebase(10, "0", 2)',,
'Rebase(10, "0", 2)',, 'to be', '')
'Rebase(10, "0", 2)',, '=', '')

check('multiple zeroes' 'Rebase(10, "0 0 0", 2)',,
'Rebase(10, "0 0 0", 2)',, 'to be', '')
'Rebase(10, "0 0 0", 2)',, '=', '')

check('leading zeros' 'Rebase(7, "0 6 0", 10)',,
'Rebase(7, "0 6 0", 10)',, 'to be', '4 2')
'Rebase(7, "0 6 0", 10)',, '=', '4 2')

check('input base is one' 'Rebase(1, "0", 10)',,
'Rebase(1, "0", 10)',, 'to be', '')
'Rebase(1, "0", 10)',, '=', '')

check('input base is zero' 'Rebase(0, "", 10)',,
'Rebase(0, "", 10)',, 'to be', '')
'Rebase(0, "", 10)',, '=', '')

check('input base is negative' 'Rebase(-2, "1", 10)',,
'Rebase(-2, "1", 10)',, 'to be', '')
'Rebase(-2, "1", 10)',, '=', '')

check('negative digit' 'Rebase(2, "1 -1 1 0 1 0", 10)',,
'Rebase(2, "1 -1 1 0 1 0", 10)',, 'to be', '')
'Rebase(2, "1 -1 1 0 1 0", 10)',, '=', '')

check('invalid positive digit' 'Rebase(2, "1 2 1 0 1 0", 10)',,
'Rebase(2, "1 2 1 0 1 0", 10)',, 'to be', '')
'Rebase(2, "1 2 1 0 1 0", 10)',, '=', '')

check('output base is one' 'Rebase(2, "1 0 1 0 1 0", 1)',,
'Rebase(2, "1 0 1 0 1 0", 1)',, 'to be', '')
'Rebase(2, "1 0 1 0 1 0", 1)',, '=', '')

check('output base is zero' 'Rebase(10, "7", 0)',,
'Rebase(10, "7", 0)',, 'to be', '')
'Rebase(10, "7", 0)',, '=', '')

check('output base is negative' 'Rebase(2, "1", -7)',,
'Rebase(2, "1", -7)',, 'to be', '')
'Rebase(2, "1", -7)',, '=', '')

check('both bases are negative' 'Rebase(-2, "1", -7)',,
'Rebase(-2, "1", -7)',, 'to be', '')
'Rebase(-2, "1", -7)',, '=', '')

32 changes: 16 additions & 16 deletions exercises/practice/anagram/anagram-check.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,50 @@ context('Checking the FindAnagrams function')

/* Unit tests */
check('no matches' 'FindAnagrams("diaper", "hello world zombies pants")',,
'FindAnagrams("diaper", "hello world zombies pants")',, 'to be', '')
'FindAnagrams("diaper", "hello world zombies pants")',, '=', '')

check('detects two anagrams' 'FindAnagrams("solemn", "lemons cherry melons")',,
'FindAnagrams("solemn", "lemons cherry melons")',, 'to be', 'lemons melons')
'FindAnagrams("solemn", "lemons cherry melons")',, '=', 'lemons melons')

check('does not detect anagram subsets' 'FindAnagrams("good", "dog goody")',,
'FindAnagrams("good", "dog goody")',, 'to be', '')
'FindAnagrams("good", "dog goody")',, '=', '')

check('detects anagram' 'FindAnagrams("listen", "enlists google inlets banana")',,
'FindAnagrams("listen", "enlists google inlets banana")',, 'to be', 'inlets')
'FindAnagrams("listen", "enlists google inlets banana")',, '=', 'inlets')

check('detects three anagrams' 'FindAnagrams("allergy", "gallery ballerina regally clergy largely leading")',,
'FindAnagrams("allergy", "gallery ballerina regally clergy largely leading")',, 'to be', 'gallery regally largely')
'FindAnagrams("allergy", "gallery ballerina regally clergy largely leading")',, '=', 'gallery regally largely')

check('detects multiple anagrams with different case' 'FindAnagrams("nose", "Eons ONES")',,
'FindAnagrams("nose", "Eons ONES")',, 'to be', 'Eons ONES')
'FindAnagrams("nose", "Eons ONES")',, '=', 'Eons ONES')

check('does not detect non-anagrams with identical checksum' 'FindAnagrams("mass", "last")',,
'FindAnagrams("mass", "last")',, 'to be', '')
'FindAnagrams("mass", "last")',, '=', '')

check('detects anagrams case-insensitively' 'FindAnagrams("Orchestra", "cashregister Carthorse radishes")',,
'FindAnagrams("Orchestra", "cashregister Carthorse radishes")',, 'to be', 'Carthorse')
'FindAnagrams("Orchestra", "cashregister Carthorse radishes")',, '=', 'Carthorse')

check('detects anagrams using case-insensitive subject' 'FindAnagrams("Orchestra", "cashregister carthorse radishes")',,
'FindAnagrams("Orchestra", "cashregister carthorse radishes")',, 'to be', 'carthorse')
'FindAnagrams("Orchestra", "cashregister carthorse radishes")',, '=', 'carthorse')

check('detects anagrams using case-insensitive possible matches' 'FindAnagrams("orchestra", "cashregister Carthorse radishes")',,
'FindAnagrams("orchestra", "cashregister Carthorse radishes")',, 'to be', 'Carthorse')
'FindAnagrams("orchestra", "cashregister Carthorse radishes")',, '=', 'Carthorse')

check('does not detect a anagram if the original word is repeated' 'FindAnagrams("go", "go Go GO")',,
'FindAnagrams("go", "go Go GO")',, 'to be', '')
'FindAnagrams("go", "go Go GO")',, '=', '')

check('anagrams must use all letters exactly once' 'FindAnagrams("tapper", "patter")',,
'FindAnagrams("tapper", "patter")',, 'to be', '')
'FindAnagrams("tapper", "patter")',, '=', '')

check('words are not anagrams of themselves' 'FindAnagrams("BANANA", "BANANA")',,
'FindAnagrams("BANANA", "BANANA")',, 'to be', '')
'FindAnagrams("BANANA", "BANANA")',, '=', '')

check('words are not anagrams of themselves even if letter case is partially different' 'FindAnagrams("BANANA", "Banana")',,
'FindAnagrams("BANANA", "Banana")',, 'to be', '')
'FindAnagrams("BANANA", "Banana")',, '=', '')

check('words are not anagrams of themselves even if letter case is completely different' 'FindAnagrams("BANANA", "banana")',,
'FindAnagrams("BANANA", "banana")',, 'to be', '')
'FindAnagrams("BANANA", "banana")',, '=', '')

check('words other than themselves can be anagrams' 'FindAnagrams("LISTEN", "LISTEN Silent")',,
'FindAnagrams("LISTEN", "LISTEN Silent")',, 'to be', 'Silent')
'FindAnagrams("LISTEN", "LISTEN Silent")',, '=', 'Silent')

Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ context('Checking the IsArmstrongNumber function')

/* Unit tests */
check('Zero is an Armstrong number' 'IsArmstrongNumber(0)',,
'IsArmstrongNumber(0)',, 'to be', 1)
'IsArmstrongNumber(0)',, '=', 1)

check('Single-digit numbers are Armstrong numbers' 'IsArmstrongNumber(5)',,
'IsArmstrongNumber(5)',, 'to be', 1)
'IsArmstrongNumber(5)',, '=', 1)

check('There are no two-digit Armstrong numbers' 'IsArmstrongNumber(10)',,
'IsArmstrongNumber(10)',, 'to be', 0)
'IsArmstrongNumber(10)',, '=', 0)

check('Three-digit number that is an Armstrong number' 'IsArmstrongNumber(153)',,
'IsArmstrongNumber(153)',, 'to be', 1)
'IsArmstrongNumber(153)',, '=', 1)

check('Three-digit number that is not an Armstrong number' 'IsArmstrongNumber(100)',,
'IsArmstrongNumber(100)',, 'to be', 0)
'IsArmstrongNumber(100)',, '=', 0)

check('Four-digit number that is an Armstrong number' 'IsArmstrongNumber(9474)',,
'IsArmstrongNumber(9474)',, 'to be', 1)
'IsArmstrongNumber(9474)',, '=', 1)

check('Four-digit number that is not an Armstrong number' 'IsArmstrongNumber(9475)',,
'IsArmstrongNumber(9475)',, 'to be', 0)
'IsArmstrongNumber(9475)',, '=', 0)

check('Seven-digit number that is an Armstrong number' 'IsArmstrongNumber(9926315)',,
'IsArmstrongNumber(9926315)',, 'to be', 1)
'IsArmstrongNumber(9926315)',, '=', 1)

check('Seven-digit number that is not an Armstrong number' 'IsArmstrongNumber(9926314)',,
'IsArmstrongNumber(9926314)',, 'to be', 0)
'IsArmstrongNumber(9926314)',, '=', 0)

28 changes: 14 additions & 14 deletions exercises/practice/atbash-cipher/atbash-cipher-check.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,44 @@ context('Checking the Encode and Decode functions')

/* Unit tests */
check('encode -> encode yes' 'Encode("yes")',,
'Encode("yes")',, 'to be', 'bvh')
'Encode("yes")',, '=', 'bvh')

check('encode -> encode no' 'Encode("no")',,
'Encode("no")',, 'to be', 'ml')
'Encode("no")',, '=', 'ml')

check('encode -> encode OMG' 'Encode("OMG")',,
'Encode("OMG")',, 'to be', 'lnt')
'Encode("OMG")',, '=', 'lnt')

check('encode -> encode spaces' 'Encode("O M G")',,
'Encode("O M G")',, 'to be', 'lnt')
'Encode("O M G")',, '=', 'lnt')

check('encode -> encode mindblowingly' 'Encode("mindblowingly")',,
'Encode("mindblowingly")',, 'to be', 'nrmwy oldrm tob')
'Encode("mindblowingly")',, '=', 'nrmwy oldrm tob')

check('encode -> encode numbers' 'Encode("Testing,1 2 3, testing.")',,
'Encode("Testing,1 2 3, testing.")',, 'to be', 'gvhgr mt123 gvhgr mt')
'Encode("Testing,1 2 3, testing.")',, '=', 'gvhgr mt123 gvhgr mt')

check('encode -> encode deep thought' 'Encode("Truth is fiction.")',,
'Encode("Truth is fiction.")',, 'to be', 'gifgs rhurx grlm')
'Encode("Truth is fiction.")',, '=', 'gifgs rhurx grlm')

check('encode -> encode all the letters' 'Encode("The quick brown fox jumps over the lazy dog.")',,
'Encode("The quick brown fox jumps over the lazy dog.")',, 'to be', 'gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt')
'Encode("The quick brown fox jumps over the lazy dog.")',, '=', 'gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt')

check('decode -> decode exercism' 'Decode("vcvix rhn")',,
'Decode("vcvix rhn")',, 'to be', 'exercism')
'Decode("vcvix rhn")',, '=', 'exercism')

check('decode -> decode a sentence' 'Decode("zmlyh gzxov rhlug vmzhg vkkrm thglm v")',,
'Decode("zmlyh gzxov rhlug vmzhg vkkrm thglm v")',, 'to be', 'anobstacleisoftenasteppingstone')
'Decode("zmlyh gzxov rhlug vmzhg vkkrm thglm v")',, '=', 'anobstacleisoftenasteppingstone')

check('decode -> decode numbers' 'Decode("gvhgr mt123 gvhgr mt")',,
'Decode("gvhgr mt123 gvhgr mt")',, 'to be', 'testing123testing')
'Decode("gvhgr mt123 gvhgr mt")',, '=', 'testing123testing')

check('decode -> decode all the letters' 'Decode("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt")',,
'Decode("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt")',, 'to be', 'thequickbrownfoxjumpsoverthelazydog')
'Decode("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt")',, '=', 'thequickbrownfoxjumpsoverthelazydog')

check('decode -> decode with too many spaces' 'Decode("vc vix r hn")',,
'Decode("vc vix r hn")',, 'to be', 'exercism')
'Decode("vc vix r hn")',, '=', 'exercism')

check('decode -> decode with no spaces' 'Decode("zmlyhgzxovrhlugvmzhgvkkrmthglmv")',,
'Decode("zmlyhgzxovrhlugvmzhgvkkrmthglmv")',, 'to be', 'anobstacleisoftenasteppingstone')
'Decode("zmlyhgzxovrhlugvmzhgvkkrmthglmv")',, '=', 'anobstacleisoftenasteppingstone')

34 changes: 17 additions & 17 deletions exercises/practice/bank-account/bank-account-check.rexx
Original file line number Diff line number Diff line change
Expand Up @@ -22,53 +22,53 @@ account_16 = Deposit(-50, account_15)

/* Unit tests */
check('Create a (dormant) new bank account' 'Balance(account_0)',,
'Balance(account_0)',, 'to be', -1)
'Balance(account_0)',, '=', -1)

check('Close a dormant bank account - no account status change' 'Balance(account_1)',,
'Balance(account_1)',, 'to be', -1)
'Balance(account_1)',, '=', -1)

check('Open a dormant bank account - dormant account now open' 'Balance(account_2)',,
'Balance(account_2)',, 'to be', 0)
'Balance(account_2)',, '=', 0)

check('Open an already open bank account - no account status change' 'Balance(account_3)',,
'Balance(account_3)',, 'to be', 0)
'Balance(account_3)',, '=', 0)

check('Close an already open bank account - account becomes dormant' 'Balance(account_4)',,
'Balance(account_4)',, 'to be', -1)
'Balance(account_4)',, '=', -1)

check('Deposit money into a dormant bank account - deposit not accepted' 'Balance(account_5)',,
'Balance(account_5)',, 'to be', -1)
'Balance(account_5)',, '=', -1)

check('Withdraw money from a dormant bank account - withdrawal unsuccessful' 'Balance(account_6)',,
'Balance(account_6)',, 'to be', -1)
'Balance(account_6)',, '=', -1)

check('Attempt overdraw from a dormant bank account - withdrawal unsuccessful' 'Balance(account_7)',,
'Balance(account_7)',, 'to be', -1)
'Balance(account_7)',, '=', -1)

check('Withdraw negative amount from a dormant bank account - withdrawal unsuccessful' 'Balance(account_8)',,
'Balance(account_8)',, 'to be', -1)
'Balance(account_8)',, '=', -1)

check('Deposit negative amount into a dormant bank account - deposit unsuccessful' 'Balance(account_9)',,
'Balance(account_9)',, 'to be', -1)
'Balance(account_9)',, '=', -1)

check('Open a dormant bank account - dormant account now open' 'Balance(account_10)',,
'Balance(account_10)',, 'to be', 0)
'Balance(account_10)',, '=', 0)

check('Deposit money into an open bank account - deposit accepted' 'Balance(account_11)',,
'Balance(account_11)',, 'to be', 100)
'Balance(account_11)',, '=', 100)

check('Deposit more money into an open bank account - deposit accepted' 'Balance(account_12)',,
'Balance(account_12)',, 'to be', 250)
'Balance(account_12)',, '=', 250)

check('Withdraw money from an open bank account - withdrawal successful' 'Balance(account_13)',,
'Balance(account_13)',, 'to be', 200)
'Balance(account_13)',, '=', 200)

check('Attempt overdraw from an open bank account - withdrawal unsuccessful, no account status change' 'Balance(account_14)',,
'Balance(account_14)',, 'to be', 200)
'Balance(account_14)',, '=', 200)

check('Withdraw negative amount from an open bank account - withdrawal unsuccessful, no account status change' 'Balance(account_15)',,
'Balance(account_15)',, 'to be', 200)
'Balance(account_15)',, '=', 200)

check('Deposit negative amount into an open bank account - deposit unsuccessful, no account status change' 'Balance(account_16)',,
'Balance(account_16)',, 'to be', 200)
'Balance(account_16)',, '=', 200)

Loading