From 61b8d5f82d844688e147fae20b57c6ee8365eaa1 Mon Sep 17 00:00:00 2001 From: Eric Willigers Date: Tue, 19 Dec 2023 18:58:10 +1100 Subject: [PATCH] Sync exercise tests We sync the following exercises: - allergies - anagram - flatten-array - matching-brackets - pangram - phone-number - roman-numerals - space-age With space-age, we exclude the new test as the type system prevents non-planets from being passed as planets. --- .../practice/allergies/.docs/instructions.md | 2 +- exercises/practice/allergies/.meta/tests.toml | 3 + exercises/practice/allergies/test.sml | 7 +- exercises/practice/anagram/.meta/tests.toml | 24 +++++++ exercises/practice/anagram/test.sml | 31 +++++---- .../practice/flatten-array/.meta/tests.toml | 15 +++++ exercises/practice/flatten-array/test.sml | 37 ++++++++++- .../matching-brackets/.meta/tests.toml | 9 +++ exercises/practice/matching-brackets/test.sml | 10 ++- exercises/practice/pangram/.meta/tests.toml | 5 ++ exercises/practice/pangram/test.sml | 25 ++++---- .../phone-number/.docs/instructions.md | 10 +-- .../practice/phone-number/.meta/tests.toml | 20 ++++++ exercises/practice/phone-number/test.sml | 30 +++++++-- .../roman-numerals/.docs/instructions.md | 2 +- .../practice/roman-numerals/.meta/tests.toml | 21 ++++++ exercises/practice/roman-numerals/test.sml | 64 +++++++++++++------ exercises/practice/space-age/.meta/tests.toml | 4 ++ 18 files changed, 258 insertions(+), 61 deletions(-) diff --git a/exercises/practice/allergies/.docs/instructions.md b/exercises/practice/allergies/.docs/instructions.md index a139492..daf8cfd 100644 --- a/exercises/practice/allergies/.docs/instructions.md +++ b/exercises/practice/allergies/.docs/instructions.md @@ -22,6 +22,6 @@ Now, given just that score of 34, your program should be able to say: - Whether Tom is allergic to any one of those allergens listed above. - All the allergens Tom is allergic to. -Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.). +Note: a given score may include allergens **not** listed above (i.e. allergens that score 256, 512, 1024, etc.). Your program should ignore those components of the score. For example, if the allergy score is 257, your program should only report the eggs (1) allergy. diff --git a/exercises/practice/allergies/.meta/tests.toml b/exercises/practice/allergies/.meta/tests.toml index 405bd3f..799ab85 100644 --- a/exercises/practice/allergies/.meta/tests.toml +++ b/exercises/practice/allergies/.meta/tests.toml @@ -155,3 +155,6 @@ description = "list when: -> everything" [12ce86de-b347-42a0-ab7c-2e0570f0c65b] description = "list when: -> no allergen score parts" + +[93c2df3e-4f55-4fed-8116-7513092819cd] +description = "list when: -> no allergen score parts without highest valid score" diff --git a/exercises/practice/allergies/test.sml b/exercises/practice/allergies/test.sml index 3d82d96..bcff33a 100644 --- a/exercises/practice/allergies/test.sml +++ b/exercises/practice/allergies/test.sml @@ -1,4 +1,4 @@ -(* version 1.0.0 *) +(* version 1.1.0 *) use "testlib.sml"; use "allergies.sml"; @@ -61,7 +61,10 @@ val testsuite = (fn _ => allergies (255) |> Expect.equalTo [Eggs, Peanuts, Shellfish, Strawberries, Tomatoes, Chocolate, Pollen, Cats]), test "ignore non allergen score parts" - (fn _ => allergies (509) |> Expect.equalTo [Eggs, Shellfish, Strawberries, Tomatoes, Chocolate, Pollen, Cats]) + (fn _ => allergies (509) |> Expect.equalTo [Eggs, Shellfish, Strawberries, Tomatoes, Chocolate, Pollen, Cats]), + + test "no allergen score parts without highest valid score" + (fn _ => allergies (257) |> Expect.equalTo [Eggs]) ] ] diff --git a/exercises/practice/anagram/.meta/tests.toml b/exercises/practice/anagram/.meta/tests.toml index 0b78a78..4f43811 100644 --- a/exercises/practice/anagram/.meta/tests.toml +++ b/exercises/practice/anagram/.meta/tests.toml @@ -14,6 +14,7 @@ description = "no matches" [b3cca662-f50a-489e-ae10-ab8290a09bdc] description = "detects two anagrams" +include = false [03eb9bbe-8906-4ea0-84fa-ffe711b52c8b] description = "detects two anagrams" @@ -45,12 +46,35 @@ description = "detects anagrams using case-insensitive possible matches" [7cc195ad-e3c7-44ee-9fd2-d3c344806a2c] description = "does not detect an anagram if the original word is repeated" +include = false + +[630abb71-a94e-4715-8395-179ec1df9f91] +description = "does not detect an anagram if the original word is repeated" +reimplements = "7cc195ad-e3c7-44ee-9fd2-d3c344806a2c" [9878a1c9-d6ea-4235-ae51-3ea2befd6842] description = "anagrams must use all letters exactly once" [85757361-4535-45fd-ac0e-3810d40debc1] description = "words are not anagrams of themselves (case-insensitive)" +include = false + +[68934ed0-010b-4ef9-857a-20c9012d1ebf] +description = "words are not anagrams of themselves" +reimplements = "85757361-4535-45fd-ac0e-3810d40debc1" + +[589384f3-4c8a-4e7d-9edc-51c3e5f0c90e] +description = "words are not anagrams of themselves even if letter case is partially different" +reimplements = "85757361-4535-45fd-ac0e-3810d40debc1" + +[ba53e423-7e02-41ee-9ae2-71f91e6d18e6] +description = "words are not anagrams of themselves even if letter case is completely different" +reimplements = "85757361-4535-45fd-ac0e-3810d40debc1" [a0705568-628c-4b55-9798-82e4acde51ca] description = "words other than themselves can be anagrams" +include = false + +[33d3f67e-fbb9-49d3-a90e-0beb00861da7] +description = "words other than themselves can be anagrams" +reimplements = "a0705568-628c-4b55-9798-82e4acde51ca" diff --git a/exercises/practice/anagram/test.sml b/exercises/practice/anagram/test.sml index f67ea16..d868679 100644 --- a/exercises/practice/anagram/test.sml +++ b/exercises/practice/anagram/test.sml @@ -1,4 +1,4 @@ -(* version 1.4.0 *) +(* version 1.5.0 *) use "testlib.sml"; use "anagram.sml"; @@ -11,14 +11,8 @@ val testsuite = test "no matches" (fn _ => anagramsFor "diaper" ["hello", "world", "zombies", "pants"] |> Expect.equalTo []), - test "detects simple anagram" - (fn _ => anagramsFor "ant" ["tan", "stand", "at"] |> Expect.equalTo ["tan"]), - - test "does not detect false positives" - (fn _ => anagramsFor "galea" ["eagle"] |> Expect.equalTo []), - test "detects two anagrams" - (fn _ => anagramsFor "master" ["stream", "pigeon", "maters"] |> Expect.equalTo ["stream", "maters"]), + (fn _ => anagramsFor "solemn" ["lemons", "cherry", "melons"] |> Expect.equalTo ["lemons", "melons"]), test "does not detect anagram subsets" (fn _ => anagramsFor "good" ["dog", "goody"] |> Expect.equalTo []), @@ -29,8 +23,8 @@ val testsuite = test "detects three anagrams" (fn _ => anagramsFor "allergy" ["gallery", "ballerina", "regally", "clergy", "largely", "leading"] |> Expect.equalTo ["gallery", "regally", "largely"]), - test "does not detect identical words" - (fn _ => anagramsFor "corn" ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"] |> Expect.equalTo ["cron"]), + test "detects multiple anagrams with different case" + (fn _ => anagramsFor "nose" ["Eons", "ONES"] |> Expect.equalTo ["Eons", "ONES"]), test "does not detect non-anagrams with identical checksum" (fn _ => anagramsFor "mass" ["last"] |> Expect.equalTo []), @@ -44,14 +38,23 @@ val testsuite = test "detects anagrams using case-insensitive possible matches" (fn _ => anagramsFor "orchestra" ["cashregister", "Carthorse", "radishes"] |> Expect.equalTo ["Carthorse"]), - test "does not detect a anagram if the original word is repeated" - (fn _ => anagramsFor "go" ["go Go GO"] |> Expect.equalTo []), + test "does not detect an anagram if the original word is repeated" + (fn _ => anagramsFor "go" ["goGoGO"] |> Expect.equalTo []), test "anagrams must use all letters exactly once" (fn _ => anagramsFor "tapper" ["patter"] |> Expect.equalTo []), - test "words are not anagrams of themselves (case-insensitive)" - (fn _ => anagramsFor "BANANA" ["BANANA", "Banana", "banana"] |> Expect.equalTo []) + test "words are not anagrams of themselves" + (fn _ => anagramsFor "BANANA" ["BANANA"] |> Expect.equalTo []), + + test "words are not anagrams of themselves even if letter case is partially different" + (fn _ => anagramsFor "BANANA" ["Banana"] |> Expect.equalTo []), + + test "words are not anagrams of themselves even if letter case is completely different" + (fn _ => anagramsFor "BANANA" ["banana"] |> Expect.equalTo []), + + test "words other than themselves can be anagrams" + (fn _ => anagramsFor "LISTEN" ["LISTEN", "Silent"] |> Expect.equalTo ["Silent"]) ] val _ = Test.run testsuite diff --git a/exercises/practice/flatten-array/.meta/tests.toml b/exercises/practice/flatten-array/.meta/tests.toml index e3b2fc9..6300219 100644 --- a/exercises/practice/flatten-array/.meta/tests.toml +++ b/exercises/practice/flatten-array/.meta/tests.toml @@ -9,9 +9,15 @@ # As user-added comments (using the # character) will be removed when this file # is regenerated, comments can be added via a `comment` key. +[8c71dabd-da60-422d-a290-4a571471fb14] +description = "empty" + [d268b919-963c-442d-9f07-82b93f1b518c] description = "no nesting" +[3f15bede-c856-479e-bb71-1684b20c6a30] +description = "flattens a nested array" + [c84440cc-bb3a-48a6-862c-94cf23f2815d] description = "flattens array with just integers present" @@ -21,6 +27,15 @@ description = "5 level nesting" [d572bdba-c127-43ed-bdcd-6222ac83d9f7] description = "6 level nesting" +[0705a8e5-dc86-4cec-8909-150c5e54fa9c] +description = "null values are omitted from the final result" + +[c6cf26de-8ccd-4410-84bd-b9efd88fd2bc] +description = "consecutive null values at the front of the list are omitted from the final result" + +[382c5242-587e-4577-b8ce-a5fb51e385a1] +description = "consecutive null values in the middle of the list are omitted from the final result" + [ef1d4790-1b1e-4939-a179-51ace0829dbd] description = "6 level nest list with null values" diff --git a/exercises/practice/flatten-array/test.sml b/exercises/practice/flatten-array/test.sml index 4eec6fc..78d99b3 100644 --- a/exercises/practice/flatten-array/test.sml +++ b/exercises/practice/flatten-array/test.sml @@ -1,4 +1,4 @@ -(* version 1.1.0 *) +(* version 1.2.0 *) use "testlib.sml"; use "flatten-array.sml"; @@ -8,6 +8,13 @@ fun x |> f = f x val testsuite = describe "flatten-array" [ + test "empty" + (fn _ => let + val nested = List [] + in + flatten nested |> Expect.equalTo [] + end), + test "no nesting" (fn _ => let val nested = List [Elem 0, Elem 1, Elem 2] @@ -15,6 +22,13 @@ val testsuite = flatten nested |> Expect.equalTo [0, 1, 2] end), + test "flattens a nested array" + (fn _ => let + val nested = List [List [List []]] + in + flatten nested |> Expect.equalTo [] + end), + test "flattens array with just integers present" (fn _ => let val nested = List [Elem 1, @@ -51,6 +65,27 @@ val testsuite = flatten nested |> Expect.equalTo [1, 2, 3, 4, 5, 6, 7, 8] end), + test "Empty values are omitted from the final result" + (fn _ => let + val nested = List [Elem 1, Elem 2, Empty] + in + flatten nested |> Expect.equalTo [1, 2] + end), + + test "consecutive Empty values at the front of the list are omitted from the final result" + (fn _ => let + val nested = List [Empty, Empty, Elem 3] + in + flatten nested |> Expect.equalTo [3] + end), + + test "consecutive Empty values in the middle of the list are omitted from the final result" + (fn _ => let + val nested = List [Elem 1, Empty, Empty, Elem 4] + in + flatten nested |> Expect.equalTo [1, 4] + end), + test "6 level nest list with Empty values" (fn _ => let val nested = List [Elem 0, diff --git a/exercises/practice/matching-brackets/.meta/tests.toml b/exercises/practice/matching-brackets/.meta/tests.toml index 65b5562..35a98a0 100644 --- a/exercises/practice/matching-brackets/.meta/tests.toml +++ b/exercises/practice/matching-brackets/.meta/tests.toml @@ -48,12 +48,21 @@ description = "unpaired and nested brackets" [a0205e34-c2ac-49e6-a88a-899508d7d68e] description = "paired and wrong nested brackets" +[1d5c093f-fc84-41fb-8c2a-e052f9581602] +description = "paired and wrong nested brackets but innermost are correct" + [ef47c21b-bcfd-4998-844c-7ad5daad90a8] description = "paired and incomplete brackets" [a4675a40-a8be-4fc2-bc47-2a282ce6edbe] description = "too many closing brackets" +[a345a753-d889-4b7e-99ae-34ac85910d1a] +description = "early unexpected brackets" + +[21f81d61-1608-465a-b850-baa44c5def83] +description = "early mismatched brackets" + [99255f93-261b-4435-a352-02bdecc9bdf2] description = "math expression" diff --git a/exercises/practice/matching-brackets/test.sml b/exercises/practice/matching-brackets/test.sml index 6f5d601..017f03d 100644 --- a/exercises/practice/matching-brackets/test.sml +++ b/exercises/practice/matching-brackets/test.sml @@ -1,4 +1,4 @@ -(* version 1.4.0 *) +(* version 1.5.0 *) use "testlib.sml"; use "matching-brackets.sml"; @@ -34,8 +34,16 @@ val testsuite = (fn _ => isBalanced "([{])" |> Expect.falsy), test "paired and wrong nested brackets" (fn _ => isBalanced "[({]})" |> Expect.falsy), + test "paired and wrong nested brackets but innermost are correct" + (fn _ => isBalanced "[({}])" |> Expect.falsy), test "paired and incomplete brackets" (fn _ => isBalanced "{}[" |> Expect.falsy), + test "too many closing brackets" + (fn _ => isBalanced "[]]" |> Expect.falsy), + test "early unexpected brackets" + (fn _ => isBalanced ")()" |> Expect.falsy), + test "early mismatched brackets" + (fn _ => isBalanced "{)()" |> Expect.falsy), test "math expression" (fn _ => isBalanced "(((185 + 223.85) * 15) - 543)/2" |> Expect.truthy), test "complex latex expression" diff --git a/exercises/practice/pangram/.meta/tests.toml b/exercises/practice/pangram/.meta/tests.toml index 7c35818..10b5a33 100644 --- a/exercises/practice/pangram/.meta/tests.toml +++ b/exercises/practice/pangram/.meta/tests.toml @@ -38,3 +38,8 @@ description = "mixed case and punctuation" [2577bf54-83c8-402d-a64b-a2c0f7bb213a] description = "case insensitive" +include = false + +[7138e389-83e4-4c6e-8413-1e40a0076951] +description = "a-m and A-M are 26 different characters but not a pangram" +reimplements = "2577bf54-83c8-402d-a64b-a2c0f7bb213a" diff --git a/exercises/practice/pangram/test.sml b/exercises/practice/pangram/test.sml index 8a1bddb..0ce2f39 100644 --- a/exercises/practice/pangram/test.sml +++ b/exercises/practice/pangram/test.sml @@ -1,4 +1,4 @@ -(* version 1.1.0 *) +(* version 1.2.0 *) use "pangram.sml"; use "testlib.sml"; @@ -9,32 +9,35 @@ fun x |> f = f x val testsuite = describe "pangram" [ describe "Check if the given string is an pangram" [ - test "sentence empty" + test "empty sentence" (fn _ => isPangram ("") |> Expect.falsy), - test "pangram with only lower case" + test "perfect lower case" + (fn _ => isPangram ("abcdefghijklmnopqrstuvwxyz") |> Expect.truthy), + + test "only lower case" (fn _ => isPangram ("the quick brown fox jumps over the lazy dog") |> Expect.truthy), - test "missing character 'x'" + test "missing the letter 'x'" (fn _ => isPangram ("a quick movement of the enemy will jeopardize five gunboats") |> Expect.falsy), - test "another missing character 'x'" - (fn _ => isPangram ("the quick brown fish jumps over the lazy dog") |> Expect.falsy), + test "missing the letter 'h'" + (fn _ => isPangram ("five boxing wizards jump quickly at it") |> Expect.falsy), - test "pangram with underscores" + test "with underscores" (fn _ => isPangram ("the_quick_brown_fox_jumps_over_the_lazy_dog") |> Expect.truthy), - test "pangram with numbers" + test "with numbers" (fn _ => isPangram ("the 1 quick brown fox jumps over the 2 lazy dogs") |> Expect.truthy), test "missing letters replaced by numbers" (fn _ => isPangram ("7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog") |> Expect.falsy), - test "pangram with mixed case and punctuation" + test "mixed case and punctuation" (fn _ => isPangram ("\"Five quacking Zephyrs jolt my wax bed.\"") |> Expect.truthy), - test "upper and lower case versions of the same character should not be counted separately" - (fn _ => isPangram ("the quick brown fox jumps over with lazy FX") |> Expect.falsy) + test "a-m and A-M are 26 different characters but not a pangram" + (fn _ => isPangram ("abcdefghijklm ABCDEFGHIJKLM") |> Expect.falsy) ] ] diff --git a/exercises/practice/phone-number/.docs/instructions.md b/exercises/practice/phone-number/.docs/instructions.md index 6d3275c..62ba48e 100644 --- a/exercises/practice/phone-number/.docs/instructions.md +++ b/exercises/practice/phone-number/.docs/instructions.md @@ -5,18 +5,20 @@ Clean up user-entered phone numbers so that they can be sent SMS messages. The **North American Numbering Plan (NANP)** is a telephone numbering system used by many countries in North America like the United States, Canada or Bermuda. All NANP-countries share the same international country code: `1`. -NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as *area code*, followed by a seven-digit local number. -The first three digits of the local number represent the *exchange code*, followed by the unique four-digit number which is the *subscriber number*. +NANP numbers are ten-digit numbers consisting of a three-digit Numbering Plan Area code, commonly known as _area code_, followed by a seven-digit local number. +The first three digits of the local number represent the _exchange code_, followed by the unique four-digit number which is the _subscriber number_. The format is usually represented as ```text -(NXX)-NXX-XXXX +NXX NXX-XXXX ``` where `N` is any digit from 2 through 9 and `X` is any digit from 0 through 9. -Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code (1) if present. +Sometimes they also have the country code (represented as `1` or `+1`) prefixed. + +Your task is to clean up differently formatted telephone numbers by removing punctuation and the country code if present. For example, the inputs diff --git a/exercises/practice/phone-number/.meta/tests.toml b/exercises/practice/phone-number/.meta/tests.toml index a0e16eb..24dbf07 100644 --- a/exercises/practice/phone-number/.meta/tests.toml +++ b/exercises/practice/phone-number/.meta/tests.toml @@ -20,6 +20,11 @@ description = "cleans numbers with multiple spaces" [598d8432-0659-4019-a78b-1c6a73691d21] description = "invalid when 9 digits" +include = false + +[2de74156-f646-42b5-8638-0ef1d8b58bc2] +description = "invalid when 9 digits" +reimplements = "598d8432-0659-4019-a78b-1c6a73691d21" [57061c72-07b5-431f-9766-d97da7c4399d] description = "invalid when 11 digits does not start with a 1" @@ -32,12 +37,27 @@ description = "valid when 11 digits and starting with 1 even with punctuation" [c6a5f007-895a-4fc5-90bc-a7e70f9b5cad] description = "invalid when more than 11 digits" +include = false + +[4a1509b7-8953-4eec-981b-c483358ff531] +description = "invalid when more than 11 digits" +reimplements = "c6a5f007-895a-4fc5-90bc-a7e70f9b5cad" [63f38f37-53f6-4a5f-bd86-e9b404f10a60] description = "invalid with letters" +include = false + +[eb8a1fc0-64e5-46d3-b0c6-33184208e28a] +description = "invalid with letters" +reimplements = "63f38f37-53f6-4a5f-bd86-e9b404f10a60" [4bd97d90-52fd-45d3-b0db-06ab95b1244e] description = "invalid with punctuations" +include = false + +[065f6363-8394-4759-b080-e6c8c351dd1f] +description = "invalid with punctuations" +reimplements = "4bd97d90-52fd-45d3-b0db-06ab95b1244e" [d77d07f8-873c-4b17-8978-5f66139bf7d7] description = "invalid if area code starts with 0" diff --git a/exercises/practice/phone-number/test.sml b/exercises/practice/phone-number/test.sml index e841521..9897cdd 100644 --- a/exercises/practice/phone-number/test.sml +++ b/exercises/practice/phone-number/test.sml @@ -1,4 +1,4 @@ -(* version 1.2.0 *) +(* version 1.3.0 *) use "testlib.sml"; use "phone-number.sml"; @@ -34,16 +34,34 @@ val testsuite = (fn _ => clean ("321234567890") |> Expect.equalTo NONE), test "invalid with letters" - (fn _ => clean ("123-abc-7890") |> Expect.equalTo NONE), + (fn _ => clean ("523-abc-7890") |> Expect.equalTo NONE), test "invalid with punctuations" - (fn _ => clean ("123-@:!-7890") |> Expect.equalTo NONE), + (fn _ => clean ("523-@:!-7890") |> Expect.equalTo NONE), - test "invalid if area code does not start with 2-9" + test "invalid if area code starts with 0" + (fn _ => clean ("(023) 456-7890") |> Expect.equalTo NONE), + + test "invalid if area code starts with 1" (fn _ => clean ("(123) 456-7890") |> Expect.equalTo NONE), - test "invalid if exchange code does not start with 2-9" - (fn _ => clean ("(223) 056-7890") |> Expect.equalTo NONE) + test "invalid if exchange code starts with 0" + (fn _ => clean ("(223) 056-7890") |> Expect.equalTo NONE), + + test "invalid if exchange code starts with 1" + (fn _ => clean ("(223) 156-7890") |> Expect.equalTo NONE), + + test "invalid if area code starts with 0 on valid 11-digit number" + (fn _ => clean ("1 (023) 456-7890") |> Expect.equalTo NONE), + + test "invalid if area code starts with 1 on valid 11-digit number" + (fn _ => clean ("1 (123) 456-7890") |> Expect.equalTo NONE), + + test "invalid if exchange code starts with 0 on valid 11-digit number" + (fn _ => clean ("1 (223) 056-7890") |> Expect.equalTo NONE), + + test "invalid if exchange code starts with 1 on valid 11-digit number" + (fn _ => clean ("1 (223) 156-7890") |> Expect.equalTo NONE) ] ] diff --git a/exercises/practice/roman-numerals/.docs/instructions.md b/exercises/practice/roman-numerals/.docs/instructions.md index bb7e909..247ea08 100644 --- a/exercises/practice/roman-numerals/.docs/instructions.md +++ b/exercises/practice/roman-numerals/.docs/instructions.md @@ -36,6 +36,6 @@ In Roman numerals 1990 is MCMXC: 2000=MM 8=VIII -Learn more about [Roman numberals on Wikipedia][roman-numerals]. +Learn more about [Roman numerals on Wikipedia][roman-numerals]. [roman-numerals]: https://wiki.imperivm-romanvm.com/wiki/Roman_Numerals diff --git a/exercises/practice/roman-numerals/.meta/tests.toml b/exercises/practice/roman-numerals/.meta/tests.toml index 630a42c..57c6c4b 100644 --- a/exercises/practice/roman-numerals/.meta/tests.toml +++ b/exercises/practice/roman-numerals/.meta/tests.toml @@ -30,6 +30,9 @@ description = "6 is VI" [ff3fb08c-4917-4aab-9f4e-d663491d083d] description = "9 is IX" +[6d1d82d5-bf3e-48af-9139-87d7165ed509] +description = "16 is XVI" + [2bda64ca-7d28-4c56-b08d-16ce65716cf6] description = "27 is XXVII" @@ -42,6 +45,9 @@ description = "49 is XLIX" [d5b283d4-455d-4e68-aacf-add6c4b51915] description = "59 is LIX" +[4465ffd5-34dc-44f3-ada5-56f5007b6dad] +description = "66 is LXVI" + [46b46e5b-24da-4180-bfe2-2ef30b39d0d0] description = "93 is XCIII" @@ -51,17 +57,32 @@ description = "141 is CXLI" [267f0207-3c55-459a-b81d-67cec7a46ed9] description = "163 is CLXIII" +[902ad132-0b4d-40e3-8597-ba5ed611dd8d] +description = "166 is CLXVI" + [cdb06885-4485-4d71-8bfb-c9d0f496b404] description = "402 is CDII" [6b71841d-13b2-46b4-ba97-dec28133ea80] description = "575 is DLXXV" +[dacb84b9-ea1c-4a61-acbb-ce6b36674906] +description = "666 is DCLXVI" + [432de891-7fd6-4748-a7f6-156082eeca2f] description = "911 is CMXI" [e6de6d24-f668-41c0-88d7-889c0254d173] description = "1024 is MXXIV" +[efbe1d6a-9f98-4eb5-82bc-72753e3ac328] +description = "1666 is MDCLXVI" + [bb550038-d4eb-4be2-a9ce-f21961ac3bc6] description = "3000 is MMM" + +[3bc4b41c-c2e6-49d9-9142-420691504336] +description = "3001 is MMMI" + +[4e18e96b-5fbb-43df-a91b-9cb511fe0856] +description = "3999 is MMMCMXCIX" diff --git a/exercises/practice/roman-numerals/test.sml b/exercises/practice/roman-numerals/test.sml index 0cc97af..cdca40b 100644 --- a/exercises/practice/roman-numerals/test.sml +++ b/exercises/practice/roman-numerals/test.sml @@ -1,4 +1,4 @@ -(* version 1.0.0 *) +(* version 1.1.0 *) use "testlib.sml"; use "roman-numerals.sml"; @@ -8,59 +8,83 @@ fun x |> f = f x val testsuite = describe "roman-numerals" [ - test "1 is a single I" + test "1 is I" (fn _ => roman (1) |> Expect.equalTo "I"), - test "2 is two I's" + test "2 is II" (fn _ => roman (2) |> Expect.equalTo "II"), - test "3 is three I's" + test "3 is III" (fn _ => roman (3) |> Expect.equalTo "III"), - test "4, being 5 - 1, is IV" + test "4 is IV" (fn _ => roman (4) |> Expect.equalTo "IV"), - test "5 is a single V" + test "5 is V" (fn _ => roman (5) |> Expect.equalTo "V"), - test "6, being 5 + 1, is VI" + test "6 is VI" (fn _ => roman (6) |> Expect.equalTo "VI"), - test "9, being 10 - 1, is IX" + test "9 is IX" (fn _ => roman (9) |> Expect.equalTo "IX"), - test "20 is two X's" + test "16 is XVI" + (fn _ => roman (16) |> Expect.equalTo "XVI"), + + test "27 is XXVII" (fn _ => roman (27) |> Expect.equalTo "XXVII"), - test "48 is not 50 - 2 but rather 40 + 8" + test "48 is XLVIII" (fn _ => roman (48) |> Expect.equalTo "XLVIII"), - test "50 is a single L" + test "49 is XLIX" + (fn _ => roman (49) |> Expect.equalTo "XLIX"), + + test "59 is LIX" (fn _ => roman (59) |> Expect.equalTo "LIX"), - test "90, being 100 - 10, is XC" + test "66 is LXVI" + (fn _ => roman (66) |> Expect.equalTo "LXVI"), + + test "93 is XCIII" (fn _ => roman (93) |> Expect.equalTo "XCIII"), - test "100 is a single C" + test "141 is CXLI" (fn _ => roman (141) |> Expect.equalTo "CXLI"), - test "60, being 50 + 10, is LX" + test "163 is CLXIII" (fn _ => roman (163) |> Expect.equalTo "CLXIII"), - test "400, being 500 - 100, is CD" + test "166 is CLXVI" + (fn _ => roman (166) |> Expect.equalTo "CLXVI"), + + test "402 is CDII" (fn _ => roman (402) |> Expect.equalTo "CDII"), - test "500 is a single D" + test "575 is DLXXV" (fn _ => roman (575) |> Expect.equalTo "DLXXV"), - test "900, being 1000 - 100, is CM" + test "666 is DCLXVI" + (fn _ => roman (666) |> Expect.equalTo "DCLXVI"), + + test "911 is CMXI" (fn _ => roman (911) |> Expect.equalTo "CMXI"), - test "1000 is a single M" + test "1024 is MXXIV" (fn _ => roman (1024) |> Expect.equalTo "MXXIV"), - test "3000 is three M's" - (fn _ => roman (3000) |> Expect.equalTo "MMM") + test "1666 is MDCLXVI" + (fn _ => roman (1666) |> Expect.equalTo "MDCLXVI"), + + test "3000 is MMM" + (fn _ => roman (3000) |> Expect.equalTo "MMM"), + + test "3001 is MMMI" + (fn _ => roman (3001) |> Expect.equalTo "MMMI"), + + test "3999 is MMMCMXCIX" + (fn _ => roman (3999) |> Expect.equalTo "MMMCMXCIX") ] val _ = Test.run testsuite \ No newline at end of file diff --git a/exercises/practice/space-age/.meta/tests.toml b/exercises/practice/space-age/.meta/tests.toml index 2c0555e..a62017e 100644 --- a/exercises/practice/space-age/.meta/tests.toml +++ b/exercises/practice/space-age/.meta/tests.toml @@ -32,3 +32,7 @@ description = "age on Uranus" [80096d30-a0d4-4449-903e-a381178355d8] description = "age on Neptune" + +[57b96e2a-1178-40b7-b34d-f3c9c34e4bf4] +description = "invalid planet causes error" +include = false