From e7bad8485fee549bf5607f5e6e7051796706e251 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Fri, 6 Oct 2023 10:47:25 +0200 Subject: [PATCH 01/12] Convert backtick (`) admonition fences to tildes (~). (#668) --- exercises/practice/atbash-cipher/.approaches/introduction.md | 4 ++-- exercises/practice/gigasecond/.docs/introduction.md | 4 ++-- exercises/practice/pangram/.docs/introduction.md | 4 ++-- .../practice/rotational-cipher/.approaches/introduction.md | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/exercises/practice/atbash-cipher/.approaches/introduction.md b/exercises/practice/atbash-cipher/.approaches/introduction.md index c1fb04e1..7e3c4322 100644 --- a/exercises/practice/atbash-cipher/.approaches/introduction.md +++ b/exercises/practice/atbash-cipher/.approaches/introduction.md @@ -170,7 +170,7 @@ end A solution by [halfdan](https://exercism.io/tracks/julia/exercises/atbash-cipher/solutions/419b6f4d04974a63b7f8531e8ad2808c). -```exercism/warning +~~~~exercism/warning This solution will mangle non-[ascii][ascii] letter characters and pass-through symbols, separators, etc. because it assumes that `isletter(c)` is the same as `c in 'a':'z' || c in 'A':'Z'` (it actually matches all unicode letters). @@ -178,7 +178,7 @@ This is a common mistake and can cause real issues! If you want to ensure your input is ascii you can use `ascii()`, or `isascii()`, or the Strs.jl package. -``` +~~~~ ```julia encode(input) = atbash(input, group=true) diff --git a/exercises/practice/gigasecond/.docs/introduction.md b/exercises/practice/gigasecond/.docs/introduction.md index 74afaa99..18a3dc20 100644 --- a/exercises/practice/gigasecond/.docs/introduction.md +++ b/exercises/practice/gigasecond/.docs/introduction.md @@ -13,7 +13,7 @@ Then we can use metric system prefixes for writing large numbers of seconds in m - Perhaps you and your family would travel to somewhere exotic for two megaseconds (that's two million seconds). - And if you and your spouse were married for _a thousand million_ seconds, you would celebrate your one gigasecond anniversary. -```exercism/note +~~~~exercism/note If we ever colonize Mars or some other planet, measuring time is going to get even messier. If someone says "year" do they mean a year on Earth or a year on Mars? @@ -21,4 +21,4 @@ The idea for this exercise came from the science fiction novel ["A Deepness in t In it the author uses the metric system as the basis for time measurements. [vinge-novel]: https://www.tor.com/2017/08/03/science-fiction-with-something-for-everyone-a-deepness-in-the-sky-by-vernor-vinge/ -``` +~~~~ diff --git a/exercises/practice/pangram/.docs/introduction.md b/exercises/practice/pangram/.docs/introduction.md index d38fa341..32b6f1fc 100644 --- a/exercises/practice/pangram/.docs/introduction.md +++ b/exercises/practice/pangram/.docs/introduction.md @@ -7,10 +7,10 @@ To give a comprehensive sense of the font, the random sentences should use **all They're running a competition to get suggestions for sentences that they can use. You're in charge of checking the submissions to see if they are valid. -```exercism/note +~~~~exercism/note Pangram comes from Greek, παν γράμμα, pan gramma, which means "every letter". The best known English pangram is: > The quick brown fox jumps over the lazy dog. -``` +~~~~ diff --git a/exercises/practice/rotational-cipher/.approaches/introduction.md b/exercises/practice/rotational-cipher/.approaches/introduction.md index 8097d117..1251b690 100644 --- a/exercises/practice/rotational-cipher/.approaches/introduction.md +++ b/exercises/practice/rotational-cipher/.approaches/introduction.md @@ -56,7 +56,7 @@ This works because: └─ The beginning/base of the alphabet. ``` -```exercism/advanced +~~~~exercism/advanced Iterating a UTF-8 string is slow because it's a variable length encoding. It is often faster to iterate a collection with elements of a fixed size (a vector of `UInt8`s from `transcode()` or an `ASCIIStr` (from Strs.jl), perhaps). @@ -67,7 +67,7 @@ See the dig deeper pages for the [pangram][dd-pg], [nucleotide count][dd-nc], an [dd-nc]: https://exercism.org/tracks/julia/exercises/nucleotide-count/dig_deeper [dd-l]: https://exercism.org/tracks/julia/exercises/luhn/dig_deeper -``` +~~~~ ## Bonus macro task From b80c76a1ed751e6babac27a161031c2b2fa0d90a Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Tue, 14 Nov 2023 14:28:43 +0100 Subject: [PATCH 02/12] Pin GitHub Actions runners to a specific version (#673) --- .github/workflows/auto-rebase.yml | 2 +- .github/workflows/exercise-tests.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-rebase.yml b/.github/workflows/auto-rebase.yml index 956ebfb9..11422e4e 100644 --- a/.github/workflows/auto-rebase.yml +++ b/.github/workflows/auto-rebase.yml @@ -6,7 +6,7 @@ jobs: rebase: name: Rebase if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - name: Automatic Rebase diff --git a/.github/workflows/exercise-tests.yml b/.github/workflows/exercise-tests.yml index 30485e41..18533da3 100644 --- a/.github/workflows/exercise-tests.yml +++ b/.github/workflows/exercise-tests.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false matrix: julia-version: ["1.6", "1", nightly] - os: [ubuntu-latest, windows-latest, macOS-latest] + os: [ubuntu-22.04, windows-2022, macOS-latest] steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 @@ -42,7 +42,7 @@ jobs: test-runner: name: Julia Test Runner - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 From 741cb38f1f1bba47f4a0c2d46ce5edc9702b6aee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 16:34:05 +0100 Subject: [PATCH 03/12] Bump actions/checkout from 3.5.3 to 4.1.1 (#670) Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 4.1.1. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/c85c95e3d7251135ab7dc9ce3241c5835cc595a9...b4ffde65f46336ab88eb53be808477a3936bae11) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/auto-rebase.yml | 2 +- .github/workflows/exercise-tests.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-rebase.yml b/.github/workflows/auto-rebase.yml index 11422e4e..d325e971 100644 --- a/.github/workflows/auto-rebase.yml +++ b/.github/workflows/auto-rebase.yml @@ -8,7 +8,7 @@ jobs: if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Automatic Rebase uses: cirrus-actions/rebase@b87d48154a87a85666003575337e27b8cd65f691 env: diff --git a/.github/workflows/exercise-tests.yml b/.github/workflows/exercise-tests.yml index 18533da3..e01e04f9 100644 --- a/.github/workflows/exercise-tests.yml +++ b/.github/workflows/exercise-tests.yml @@ -26,7 +26,7 @@ jobs: os: [ubuntu-22.04, windows-2022, macOS-latest] steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - uses: julia-actions/setup-julia@f40c4b69330df1d22e7590c12e76dc2f9c66e0bc with: @@ -45,7 +45,7 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Pull julia-test-runner image run: docker pull exercism/julia-test-runner From 6a88ad20e575da87a1f2d6b37ff965abd1802c2f Mon Sep 17 00:00:00 2001 From: yctai1994 <154885296+yctai1994@users.noreply.github.com> Date: Thu, 11 Jan 2024 16:32:38 +0900 Subject: [PATCH 04/12] Nested Testing - pangram (#680) Use verbose unit testing to output a more comprehensive testing summary (particularly for the CLI users). [no important files changed] --- exercises/practice/pangram/runtests.jl | 100 +++++++++++++------------ 1 file changed, 51 insertions(+), 49 deletions(-) diff --git a/exercises/practice/pangram/runtests.jl b/exercises/practice/pangram/runtests.jl index cf516587..16d521e7 100644 --- a/exercises/practice/pangram/runtests.jl +++ b/exercises/practice/pangram/runtests.jl @@ -2,58 +2,60 @@ using Test include("pangram.jl") -@testset "empty sentence" begin - @test !ispangram("") -end - -@testset "perfect lower case" begin - @test ispangram("abcdefghijklmnopqrstuvwxyz") -end +@testset verbose = true "pangram" begin + @testset "empty sentence" begin + @test !ispangram("") + end + + @testset "perfect lower case" begin + @test ispangram("abcdefghijklmnopqrstuvwxyz") + end -@testset "pangram with only lower case" begin - @test ispangram("the quick brown fox jumps over the lazy dog") -end - -@testset "missing character 'x'" begin - @test !ispangram("a quick movement of the enemy will jeopardize five gunboats") -end - -@testset "another missing character 'x'" begin - @test !ispangram("the quick brown fish jumps over the lazy dog") -end + @testset "pangram with only lower case" begin + @test ispangram("the quick brown fox jumps over the lazy dog") + end + + @testset "missing character 'x'" begin + @test !ispangram("a quick movement of the enemy will jeopardize five gunboats") + end + + @testset "another missing character 'x'" begin + @test !ispangram("the quick brown fish jumps over the lazy dog") + end -@testset "missing character 'h'" begin - @test !ispangram("five boxing wizards jump quickly at it") -end - -@testset "pangram with underscores" begin - @test ispangram("the_quick_brown_fox_jumps_over_the_lazy_dog") -end - -@testset "pangram with numbers" begin - @test ispangram("the 1 quick brown fox jumps over the 2 lazy dogs") -end - -@testset "missing letters replaced by numbers" begin - @test !ispangram("7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog") -end - -@testset "pangram with mixed case and punctuation" begin - @test ispangram("\"Five quacking Zephyrs jolt my wax bed.\"") -end - -@testset "upper and lower case versions of the same character should not be counted separately" begin - @test !ispangram("the quick brown fox jumped over the lazy FOX") -end + @testset "missing character 'h'" begin + @test !ispangram("five boxing wizards jump quickly at it") + end + + @testset "pangram with underscores" begin + @test ispangram("the_quick_brown_fox_jumps_over_the_lazy_dog") + end + + @testset "pangram with numbers" begin + @test ispangram("the 1 quick brown fox jumps over the 2 lazy dogs") + end + + @testset "missing letters replaced by numbers" begin + @test !ispangram("7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog") + end + + @testset "pangram with mixed case and punctuation" begin + @test ispangram("\"Five quacking Zephyrs jolt my wax bed.\"") + end + + @testset "upper and lower case versions of the same character should not be counted separately" begin + @test !ispangram("the quick brown fox jumped over the lazy FOX") + end -@testset "a-m and A-M are 26 different letters but not a pangram" begin - @test !ispangram("abcdefghijklm ABCDEFGHIJKLM") -end + @testset "a-m and A-M are 26 different letters but not a pangram" begin + @test !ispangram("abcdefghijklm ABCDEFGHIJKLM") + end -@testset "pangram with more than 26 letters (if case sensitive)" begin - @test ispangram("the 1 quick brown fox jumps Over the 2 lazy dogs") -end + @testset "pangram with more than 26 letters (if case sensitive)" begin + @test ispangram("the 1 quick brown fox jumps Over the 2 lazy dogs") + end -@testset "An Arabic pangram is not an English pangram" begin - @test !ispangram("The scholar and poet Al Farāhīdi wrote this Arabic pangram: صِف خَلقَ خَودِ كَمِثلِ الشَمسِ إِذ بَزَغَت — يَحظى الضَجيعُ بِها نَجلاءَ مِعطارِ") + @testset "An Arabic pangram is not an English pangram" begin + @test !ispangram("The scholar and poet Al Farāhīdi wrote this Arabic pangram: صِف خَلقَ خَودِ كَمِثلِ الشَمسِ إِذ بَزَغَت — يَحظى الضَجيعُ بِها نَجلاءَ مِعطارِ") + end end From 20ba4261768426879f96845083ae727cf483eccf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 08:34:49 +0100 Subject: [PATCH 05/12] Bump actions/upload-artifact from 3.1.2 to 4.1.0 (#685) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3.1.2 to 4.1.0. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/0b7f8abb1508181956e8e162db84b466c27e18ce...1eb3cb2b3e0f29609092a73eb033bb759a334595) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/exercise-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/exercise-tests.yml b/.github/workflows/exercise-tests.yml index e01e04f9..e1cf4fa8 100644 --- a/.github/workflows/exercise-tests.yml +++ b/.github/workflows/exercise-tests.yml @@ -58,7 +58,7 @@ jobs: run: julia --color=yes --project runtestrunner.jl - name: Upload reports as artifact - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce + uses: actions/upload-artifact@1eb3cb2b3e0f29609092a73eb033bb759a334595 with: name: test-reports path: ${{ steps.generate-reports.outputs.results-path }} From 0f57523a2eb2fbeb90c8ad275192a64556878586 Mon Sep 17 00:00:00 2001 From: yctai1994 <154885296+yctai1994@users.noreply.github.com> Date: Tue, 16 Jan 2024 02:44:42 +0900 Subject: [PATCH 06/12] Verbose Unit Testing for Comprehensive Testing Part 1/3 (#686) * add: verbose testing - killer-sudoku-helper - hamming - saddle-points - pangram (fix) - leap * add: verbose testing - pythagorean-triplet - collatz-conjecture - hello-world - complex-numbers - raindrops * saddle-points: Type Specification Specify the input type to align the output type for easier unit testing. * add: verbose testing - nucleotide-count - rotational-cipher - difference-of-squares - secret-handshake - darts * add: verbose testing - rna-transcription - scrabble-score - reverse-string - isogram - anagram * fix: coding style (rotational-cipher) --- exercises/practice/anagram/runtests.jl | 158 +++++++++--------- .../practice/collatz-conjecture/runtests.jl | 18 +- .../practice/complex-numbers/runtests.jl | 118 ++++++------- exercises/practice/darts/runtests.jl | 79 ++++----- .../difference-of-squares/runtests.jl | 38 +++-- exercises/practice/hamming/runtests.jl | 80 ++++----- exercises/practice/hello-world/runtests.jl | 6 +- exercises/practice/isogram/runtests.jl | 110 ++++++------ .../practice/killer-sudoku-helper/runtests.jl | 32 ++-- exercises/practice/leap/runtests.jl | 78 ++++----- .../practice/nucleotide-count/runtests.jl | 30 ++-- exercises/practice/pangram/runtests.jl | 2 +- .../practice/pythagorean-triplet/runtests.jl | 72 ++++---- exercises/practice/raindrops/runtests.jl | 118 ++++++------- exercises/practice/reverse-string/runtests.jl | 59 +++---- .../practice/rna-transcription/runtests.jl | 58 +++---- .../practice/rotational-cipher/runtests.jl | 83 ++++----- exercises/practice/saddle-points/runtests.jl | 88 +++++----- exercises/practice/scrabble-score/runtests.jl | 94 ++++++----- .../practice/secret-handshake/runtests.jl | 94 ++++++----- 20 files changed, 726 insertions(+), 689 deletions(-) diff --git a/exercises/practice/anagram/runtests.jl b/exercises/practice/anagram/runtests.jl index 0f12518c..dd94be17 100644 --- a/exercises/practice/anagram/runtests.jl +++ b/exercises/practice/anagram/runtests.jl @@ -2,82 +2,84 @@ using Test include("anagram.jl") -@testset "no matches" begin - @test detect_anagrams("diaper", ["hello", "world", "zombies", "pants"]) == [] -end - -@testset "detects simple anagram" begin - @test detect_anagrams("ant", ["tan", "stand", "at"]) == ["tan"] -end - -@testset "does not detect false positives" begin - @test detect_anagrams("galea", ["eagle"]) == [] -end - -@testset "detects two anagrams" begin - @test detect_anagrams("master", ["stream", "pigeon", "maters"]) == ["stream", "maters"] -end - -@testset "does not detect anagram subsets" begin - @test detect_anagrams("good", ["dog", "goody"]) == [] -end - -@testset "detects anagram" begin - @test detect_anagrams("listen", ["enlists", "google", "inlets", "banana"]) == ["inlets"] -end - -@testset "detects three anagrams" begin - @test detect_anagrams("allergy", ["gallery", "ballerina", "regally", "clergy", "largely", "leading"]) == ["gallery", "regally", "largely"] -end - -@testset "detects multiple anagrams with different case" begin - @test detect_anagrams("nose", ["Eons", "ONES"]) == ["Eons", "ONES"] -end - -@testset "does not detect identical words" begin - @test detect_anagrams("corn", ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"]) == ["cron"] -end - -@testset "does not detect non-anagrams with identical checksum" begin - @test detect_anagrams("mass", ["last"]) == [] -end - -@testset "detects anagrams case-insensitively" begin - @test detect_anagrams("Orchestra", ["cashregister", "Carthorse", "radishes"]) == ["Carthorse"] -end - -@testset "detects anagrams using case-insensitive subject" begin - @test detect_anagrams("Orchestra", ["cashregister", "carthorse", "radishes"]) == ["carthorse"] -end - -@testset "detects anagrams using case-insensitive possible matches" begin - @test detect_anagrams("orchestra", ["cashregister", "Carthorse", "radishes"]) == ["Carthorse"] -end - -@testset "does not detect an anagram if the original word is repeated" begin - @test detect_anagrams("go", ["go Go GO"]) == [] -end - -@testset "does not detect a word as its own anagram" begin - @test detect_anagrams("banana", ["Banana"]) == [] -end - -@testset "does not detect a anagram if the original word is repeated" begin - @test detect_anagrams("go", ["go Go GO"]) == [] -end - -@testset "anagrams must use all letters exactly once" begin - @test detect_anagrams("tapper", ["patter"]) == [] -end - -@testset "words are not anagrams of themselves (case-insensitive)" begin - @test detect_anagrams("BANANA", ["BANANA", "Banana", "banana"]) == [] -end - -@testset "words other than themselves can be anagrams" begin - @test detect_anagrams("LISTEN", ["Listen", "Silent", "LISTEN"]) == ["Silent"] -end - -@testset "capital word is not own anagram" begin - @test detect_anagrams("BANANA", ["Banana"]) == [] +@testset verbose = true "Anagram" begin + @testset "no matches" begin + @test detect_anagrams("diaper", ["hello", "world", "zombies", "pants"]) == String[] + end + + @testset "detects simple anagram" begin + @test detect_anagrams("ant", ["tan", "stand", "at"]) == ["tan"] + end + + @testset "does not detect false positives" begin + @test detect_anagrams("galea", ["eagle"]) == String[] + end + + @testset "detects two anagrams" begin + @test detect_anagrams("master", ["stream", "pigeon", "maters"]) == ["stream", "maters"] + end + + @testset "does not detect anagram subsets" begin + @test detect_anagrams("good", ["dog", "goody"]) == String[] + end + + @testset "detects anagram" begin + @test detect_anagrams("listen", ["enlists", "google", "inlets", "banana"]) == ["inlets"] + end + + @testset "detects three anagrams" begin + @test detect_anagrams("allergy", ["gallery", "ballerina", "regally", "clergy", "largely", "leading"]) == ["gallery", "regally", "largely"] + end + + @testset "detects multiple anagrams with different case" begin + @test detect_anagrams("nose", ["Eons", "ONES"]) == ["Eons", "ONES"] + end + + @testset "does not detect identical words" begin + @test detect_anagrams("corn", ["corn", "dark", "Corn", "rank", "CORN", "cron", "park"]) == ["cron"] + end + + @testset "does not detect non-anagrams with identical checksum" begin + @test detect_anagrams("mass", ["last"]) == String[] + end + + @testset "detects anagrams case-insensitively" begin + @test detect_anagrams("Orchestra", ["cashregister", "Carthorse", "radishes"]) == ["Carthorse"] + end + + @testset "detects anagrams using case-insensitive subject" begin + @test detect_anagrams("Orchestra", ["cashregister", "carthorse", "radishes"]) == ["carthorse"] + end + + @testset "detects anagrams using case-insensitive possible matches" begin + @test detect_anagrams("orchestra", ["cashregister", "Carthorse", "radishes"]) == ["Carthorse"] + end + + @testset "does not detect an anagram if the original word is repeated" begin + @test detect_anagrams("go", ["go Go GO"]) == String[] + end + + @testset "does not detect a word as its own anagram" begin + @test detect_anagrams("banana", ["Banana"]) == String[] + end + + @testset "does not detect a anagram if the original word is repeated" begin + @test detect_anagrams("go", ["go Go GO"]) == String[] + end + + @testset "anagrams must use all letters exactly once" begin + @test detect_anagrams("tapper", ["patter"]) == String[] + end + + @testset "words are not anagrams of themselves (case-insensitive)" begin + @test detect_anagrams("BANANA", ["BANANA", "Banana", "banana"]) == String[] + end + + @testset "words other than themselves can be anagrams" begin + @test detect_anagrams("LISTEN", ["Listen", "Silent", "LISTEN"]) == ["Silent"] + end + + @testset "capital word is not own anagram" begin + @test detect_anagrams("BANANA", ["Banana"]) == String[] + end end diff --git a/exercises/practice/collatz-conjecture/runtests.jl b/exercises/practice/collatz-conjecture/runtests.jl index 5d0a1c26..90bd274d 100644 --- a/exercises/practice/collatz-conjecture/runtests.jl +++ b/exercises/practice/collatz-conjecture/runtests.jl @@ -2,12 +2,14 @@ using Test include("collatz-conjecture.jl") -# canonical data -@testset "Canonical data" begin - @test collatz_steps(1) == 0 - @test collatz_steps(16) == 4 - @test collatz_steps(12) == 9 - @test collatz_steps(1000000) == 152 - @test_throws DomainError collatz_steps(0) - @test_throws DomainError collatz_steps(-15) +@testset verbose = true "Collatz Conjecture" begin + # canonical data + @testset "Canonical data" begin + @test collatz_steps(1) == 0 + @test collatz_steps(16) == 4 + @test collatz_steps(12) == 9 + @test collatz_steps(1000000) == 152 + @test_throws DomainError collatz_steps(0) + @test_throws DomainError collatz_steps(-15) + end end diff --git a/exercises/practice/complex-numbers/runtests.jl b/exercises/practice/complex-numbers/runtests.jl index 6560f2f1..1179bbc8 100644 --- a/exercises/practice/complex-numbers/runtests.jl +++ b/exercises/practice/complex-numbers/runtests.jl @@ -2,74 +2,76 @@ using Test include("complex-numbers.jl") -@test ComplexNumber <: Number +@testset verbose = true "Complex Numbers" begin + @test ComplexNumber <: Number -@test ComplexNumber(0, 1)^2 == ComplexNumber(-1, 0) + @test ComplexNumber(0, 1)^2 == ComplexNumber(-1, 0) -@testset "Arithmetic" begin - @testset "Addition" begin - @test ComplexNumber(1, 0) + ComplexNumber(2, 0) == ComplexNumber(3, 0) - @test ComplexNumber(0, 1) + ComplexNumber(0, 2) == ComplexNumber(0, 3) - @test ComplexNumber(1, 2) + ComplexNumber(3, 4) == ComplexNumber(4, 6) - end + @testset "Arithmetic" begin + @testset "Addition" begin + @test ComplexNumber(1, 0) + ComplexNumber(2, 0) == ComplexNumber(3, 0) + @test ComplexNumber(0, 1) + ComplexNumber(0, 2) == ComplexNumber(0, 3) + @test ComplexNumber(1, 2) + ComplexNumber(3, 4) == ComplexNumber(4, 6) + end - @testset "Subtraction" begin - @test ComplexNumber(1, 0) - ComplexNumber(2, 0) == ComplexNumber(-1, 0) - @test ComplexNumber(0, 1) - ComplexNumber(0, 2) == ComplexNumber(0, -1) - @test ComplexNumber(1, 2) - ComplexNumber(3, 4) == ComplexNumber(-2, -2) - end + @testset "Subtraction" begin + @test ComplexNumber(1, 0) - ComplexNumber(2, 0) == ComplexNumber(-1, 0) + @test ComplexNumber(0, 1) - ComplexNumber(0, 2) == ComplexNumber(0, -1) + @test ComplexNumber(1, 2) - ComplexNumber(3, 4) == ComplexNumber(-2, -2) + end - @testset "Multiplication" begin - @test ComplexNumber(1, 0) * ComplexNumber(2, 0) == ComplexNumber(2, 0) - @test ComplexNumber(0, 1) * ComplexNumber(0, 2) == ComplexNumber(-2, 0) - @test ComplexNumber(1, 2) * ComplexNumber(3, 4) == ComplexNumber(-5, 10) - end + @testset "Multiplication" begin + @test ComplexNumber(1, 0) * ComplexNumber(2, 0) == ComplexNumber(2, 0) + @test ComplexNumber(0, 1) * ComplexNumber(0, 2) == ComplexNumber(-2, 0) + @test ComplexNumber(1, 2) * ComplexNumber(3, 4) == ComplexNumber(-5, 10) + end - @testset "Division" begin - @test ComplexNumber(1, 0) / ComplexNumber(2, 0) == ComplexNumber(0.5, 0) - @test ComplexNumber(0, 1) / ComplexNumber(0, 2) == ComplexNumber(0.5, 0) - @test ComplexNumber(1, 2) / ComplexNumber(3, 4) ≈ ComplexNumber(0.44, 0.08) + @testset "Division" begin + @test ComplexNumber(1, 0) / ComplexNumber(2, 0) == ComplexNumber(0.5, 0) + @test ComplexNumber(0, 1) / ComplexNumber(0, 2) == ComplexNumber(0.5, 0) + @test ComplexNumber(1, 2) / ComplexNumber(3, 4) ≈ ComplexNumber(0.44, 0.08) + end end -end -@testset "Absolute value" begin - @test abs(ComplexNumber(5, 0)) == 5 - @test abs(ComplexNumber(-5, 0)) == 5 - @test abs(ComplexNumber(0, 5)) == 5 - @test abs(ComplexNumber(0, -5)) == 5 - @test abs(ComplexNumber(3, 4)) == 5 -end + @testset "Absolute value" begin + @test abs(ComplexNumber(5, 0)) == 5 + @test abs(ComplexNumber(-5, 0)) == 5 + @test abs(ComplexNumber(0, 5)) == 5 + @test abs(ComplexNumber(0, -5)) == 5 + @test abs(ComplexNumber(3, 4)) == 5 + end -@testset "Complex conjugate" begin - @test conj(ComplexNumber(5, 0)) == ComplexNumber(5, 0) - @test conj(ComplexNumber(0, 5)) == ComplexNumber(0, -5) - @test conj(ComplexNumber(1, 1)) == ComplexNumber(1, -1) -end + @testset "Complex conjugate" begin + @test conj(ComplexNumber(5, 0)) == ComplexNumber(5, 0) + @test conj(ComplexNumber(0, 5)) == ComplexNumber(0, -5) + @test conj(ComplexNumber(1, 1)) == ComplexNumber(1, -1) + end -@testset "Real part" begin - @test real(ComplexNumber(1, 0)) == 1 - @test real(ComplexNumber(0, 1)) == 0 - @test real(ComplexNumber(1, 2)) == 1 -end + @testset "Real part" begin + @test real(ComplexNumber(1, 0)) == 1 + @test real(ComplexNumber(0, 1)) == 0 + @test real(ComplexNumber(1, 2)) == 1 + end -@testset "Imaginary part" begin - @test imag(ComplexNumber(1, 0)) == 0 - @test imag(ComplexNumber(0, 1)) == 1 - @test imag(ComplexNumber(1, 2)) == 2 -end + @testset "Imaginary part" begin + @test imag(ComplexNumber(1, 0)) == 0 + @test imag(ComplexNumber(0, 1)) == 1 + @test imag(ComplexNumber(1, 2)) == 2 + end -# Bonus A -@testset "Complex exponential" begin - @test_skip exp(ComplexNumber(0, π)) ≈ ComplexNumber(-1, 0) - @test_skip exp(ComplexNumber(0, 0)) == ComplexNumber(1, 0) - @test_skip exp(ComplexNumber(1, 0)) ≈ ComplexNumber(ℯ, 0) - @test_skip exp(ComplexNumber(log(2), π)) ≈ ComplexNumber(-2, 0) -end + # Bonus A + @testset "Complex exponential" begin + @test_skip exp(ComplexNumber(0, π)) ≈ ComplexNumber(-1.0, 0.0) atol = 1e-15 + @test_skip exp(ComplexNumber(0, 0)) == ComplexNumber(1.0, 0.0) + @test_skip exp(ComplexNumber(1, 0)) ≈ ComplexNumber(ℯ, 0.0) atol = 1e-15 + @test_skip exp(ComplexNumber(log(2), π)) ≈ ComplexNumber(-2.0, 0.0) atol = 1e-15 + end -# Bonus B -@testset "Syntax sugar jm" begin - @test_skip ComplexNumber(0, 1) == jm - @test_skip ComplexNumber(1, 0) == 1 + 0jm - @test_skip ComplexNumber(1, 1) == 1 + 1jm - @test_skip ComplexNumber(-1, 0) == jm^2 + # Bonus B + @testset "Syntax sugar jm" begin + @test_skip ComplexNumber(0, 1) == jm + @test_skip ComplexNumber(1, 0) == 1 + 0jm + @test_skip ComplexNumber(1, 1) == 1 + 1jm + @test_skip ComplexNumber(-1, 0) == jm^2 + end end diff --git a/exercises/practice/darts/runtests.jl b/exercises/practice/darts/runtests.jl index 9035a6b7..d07f062d 100644 --- a/exercises/practice/darts/runtests.jl +++ b/exercises/practice/darts/runtests.jl @@ -2,55 +2,56 @@ using Test include("darts.jl") -@testset "Missed target" begin - @test score(-9, 9) == 0 -end +@testset verbose = true "Darts" begin + @testset "Missed target" begin + @test score(-9, 9) == 0 + end -@testset "On the outer circle" begin - @test score(0, 10) == 1 -end + @testset "On the outer circle" begin + @test score(0, 10) == 1 + end -@testset "On the middle circle" begin - @test score(-5, 0) == 5 -end + @testset "On the middle circle" begin + @test score(-5, 0) == 5 + end -@testset "On the inner circle" begin - @test score(0, -1) == 10 -end + @testset "On the inner circle" begin + @test score(0, -1) == 10 + end -@testset "Exactly on centre" begin - @test score(0, 0) == 10 -end + @testset "Exactly on centre" begin + @test score(0, 0) == 10 + end -@testset "Near the centre" begin - @test score(-0.1, -0.1) == 10 -end + @testset "Near the centre" begin + @test score(-0.1, -0.1) == 10 + end -@testset "Just within the inner circle" begin - @test score(0.7, 0.7) == 10 -end + @testset "Just within the inner circle" begin + @test score(0.7, 0.7) == 10 + end -@testset "Just outside the inner circle" begin - @test score(0.8, -0.8) == 5 -end + @testset "Just outside the inner circle" begin + @test score(0.8, -0.8) == 5 + end -@testset "Just within the middle circle" begin - @test score(-3.5, 3.5) == 5 -end + @testset "Just within the middle circle" begin + @test score(-3.5, 3.5) == 5 + end -@testset "Just outside the middle circle" begin - @test score(-3.6, -3.6) == 1 -end + @testset "Just outside the middle circle" begin + @test score(-3.6, -3.6) == 1 + end -@testset "Just within the outer circle" begin - @test score(-7.0, 7.0) == 1 -end + @testset "Just within the outer circle" begin + @test score(-7.0, 7.0) == 1 + end -@testset "Just outside the outer circle" begin - @test score(7.1, -7.1) == 0 -end + @testset "Just outside the outer circle" begin + @test score(7.1, -7.1) == 0 + end -@testset "Asymmetric position between the inner and middle circles" begin - @test score(0.5, -4) == 5 + @testset "Asymmetric position between the inner and middle circles" begin + @test score(0.5, -4) == 5 + end end - diff --git a/exercises/practice/difference-of-squares/runtests.jl b/exercises/practice/difference-of-squares/runtests.jl index 7f9327fc..45c3061d 100644 --- a/exercises/practice/difference-of-squares/runtests.jl +++ b/exercises/practice/difference-of-squares/runtests.jl @@ -2,24 +2,26 @@ using Test include("difference-of-squares.jl") -@testset "Square the sum of the numbers up to the given number" begin - @test square_of_sum(1)::Integer == 1 - @test square_of_sum(5)::Integer == 225 - @test square_of_sum(10)::Integer == 3025 - @test square_of_sum(100)::Integer == 25502500 -end +@testset verbose = true "Difference of Squares" begin + @testset "Square the sum of the numbers up to the given number" begin + @test square_of_sum(1)::Integer == 1 + @test square_of_sum(5)::Integer == 225 + @test square_of_sum(10)::Integer == 3025 + @test square_of_sum(100)::Integer == 25502500 + end -@testset "Sum the squares of the numbers up to the given number" begin - @test sum_of_squares(1)::Integer == 1 - @test sum_of_squares(5)::Integer == 55 - @test sum_of_squares(10)::Integer == 385 - @test sum_of_squares(100)::Integer == 338350 -end + @testset "Sum the squares of the numbers up to the given number" begin + @test sum_of_squares(1)::Integer == 1 + @test sum_of_squares(5)::Integer == 55 + @test sum_of_squares(10)::Integer == 385 + @test sum_of_squares(100)::Integer == 338350 + end -@testset "Subtract sum of squares from square of sums" begin - @test difference(0)::Integer == 0 - @test difference(1)::Integer == 0 - @test difference(5)::Integer == 170 - @test difference(10)::Integer == 2640 - @test difference(100)::Integer == 25164150 + @testset "Subtract sum of squares from square of sums" begin + @test difference(0)::Integer == 0 + @test difference(1)::Integer == 0 + @test difference(5)::Integer == 170 + @test difference(10)::Integer == 2640 + @test difference(100)::Integer == 25164150 + end end diff --git a/exercises/practice/hamming/runtests.jl b/exercises/practice/hamming/runtests.jl index 22afc087..caaed8b9 100644 --- a/exercises/practice/hamming/runtests.jl +++ b/exercises/practice/hamming/runtests.jl @@ -2,43 +2,45 @@ using Test include("hamming.jl") -@testset "identical strands" begin - @test distance("A", "A") == 0 - @test distance("GGACTGA", "GGACTGA") == 0 -end - -@testset "complete distance" begin - @test distance("A", "G") == 1 - @test distance("AG", "CT") == 2 -end - -@testset "small distance" begin - @test distance("AT", "CT") == 1 - @test distance("GGACG", "GGTCG") == 1 - @test distance("ACCAGGG", "ACTATGG") == 2 -end - -@testset "non-unique characters" begin - @test distance("AGA", "AGG") == 1 - @test distance("AGG", "AGA") == 1 -end - -@testset "same nucleotides in different positions" begin - @test distance("TAG", "GAT") == 2 -end - -@testset "large distance" begin - @test distance("GATACA", "GCATAA") == 4 - @test distance("GGACGGATTCTG", "AGGACGGATTCT") == 9 -end - -@testset "empty strands" begin - @test distance("", "") == 0 -end - -@testset "different strand lengths" begin - @test_throws ArgumentError distance("AATG", "AAA") - @test_throws ArgumentError distance("ATA", "AGTG") - @test_throws ArgumentError distance("", "G") - @test_throws ArgumentError distance("G", "") +@testset verbose = true "Hamming" begin + @testset "identical strands" begin + @test distance("A", "A") == 0 + @test distance("GGACTGA", "GGACTGA") == 0 + end + + @testset "complete distance" begin + @test distance("A", "G") == 1 + @test distance("AG", "CT") == 2 + end + + @testset "small distance" begin + @test distance("AT", "CT") == 1 + @test distance("GGACG", "GGTCG") == 1 + @test distance("ACCAGGG", "ACTATGG") == 2 + end + + @testset "non-unique characters" begin + @test distance("AGA", "AGG") == 1 + @test distance("AGG", "AGA") == 1 + end + + @testset "same nucleotides in different positions" begin + @test distance("TAG", "GAT") == 2 + end + + @testset "large distance" begin + @test distance("GATACA", "GCATAA") == 4 + @test distance("GGACGGATTCTG", "AGGACGGATTCT") == 9 + end + + @testset "empty strands" begin + @test distance("", "") == 0 + end + + @testset "different strand lengths" begin + @test_throws ArgumentError distance("AATG", "AAA") + @test_throws ArgumentError distance("ATA", "AGTG") + @test_throws ArgumentError distance("", "G") + @test_throws ArgumentError distance("G", "") + end end diff --git a/exercises/practice/hello-world/runtests.jl b/exercises/practice/hello-world/runtests.jl index e6e1f16b..6abdee84 100644 --- a/exercises/practice/hello-world/runtests.jl +++ b/exercises/practice/hello-world/runtests.jl @@ -2,6 +2,8 @@ using Test include("hello-world.jl") -@testset "Say Hi!" begin - @test hello() == "Hello, World!" +@testset verbose = true "Hello World" begin + @testset "Say Hi!" begin + @test hello() == "Hello, World!" + end end diff --git a/exercises/practice/isogram/runtests.jl b/exercises/practice/isogram/runtests.jl index 17182d25..68949abf 100644 --- a/exercises/practice/isogram/runtests.jl +++ b/exercises/practice/isogram/runtests.jl @@ -2,58 +2,60 @@ using Test include("isogram.jl") -@testset "empty string" begin - @test isisogram("") -end - -@testset "isogram with only lower case characters" begin - @test isisogram("isogram") -end - -@testset "word with one duplicated character" begin - @test !isisogram("eleven") -end - -@testset "longest reported english isogram" begin - @test isisogram("subdermatoglyphic") -end - -@testset "word with duplicated character in mixed case" begin - @test !isisogram("Alphabet") -end - -@testset "hypothetical isogrammic word with hyphen" begin - @test isisogram("thumbscrew-japingly") -end - -@testset "isogram with duplicated non letter character" begin - @test isisogram("Hjelmqvist-Gryb-Zock-Pfund-Wax") -end - -@testset "made-up name that is an isogram" begin - @test isisogram("Emily Jung Schwartzkopf") -end - -@testset "word with one duplicated character from the end of the alphabet" begin - @test !isisogram("zzyzx") -end - -@testset "word with duplicated character in mixed case, lowercase first" begin - @test !isisogram("alphAbet") -end - -@testset "hypothetical word with duplicated character following hyphen" begin - @test !isisogram("thumbscrew-jappingly") -end - -@testset "isogram with duplicated hyphen" begin - @test isisogram("six-year-old") -end - -@testset "duplicated character in the middle" begin - @test !isisogram("accentor") -end - -@testset "same first and last characters" begin - @test !isisogram("angola") +@testset verbose = true "Isogram" begin + @testset "empty string" begin + @test isisogram("") + end + + @testset "isogram with only lower case characters" begin + @test isisogram("isogram") + end + + @testset "word with one duplicated character" begin + @test !isisogram("eleven") + end + + @testset "longest reported english isogram" begin + @test isisogram("subdermatoglyphic") + end + + @testset "word with duplicated character in mixed case" begin + @test !isisogram("Alphabet") + end + + @testset "hypothetical isogrammic word with hyphen" begin + @test isisogram("thumbscrew-japingly") + end + + @testset "isogram with duplicated non letter character" begin + @test isisogram("Hjelmqvist-Gryb-Zock-Pfund-Wax") + end + + @testset "made-up name that is an isogram" begin + @test isisogram("Emily Jung Schwartzkopf") + end + + @testset "word with one duplicated character from the end of the alphabet" begin + @test !isisogram("zzyzx") + end + + @testset "word with duplicated character in mixed case, lowercase first" begin + @test !isisogram("alphAbet") + end + + @testset "hypothetical word with duplicated character following hyphen" begin + @test !isisogram("thumbscrew-jappingly") + end + + @testset "isogram with duplicated hyphen" begin + @test isisogram("six-year-old") + end + + @testset "duplicated character in the middle" begin + @test !isisogram("accentor") + end + + @testset "same first and last characters" begin + @test !isisogram("angola") + end end diff --git a/exercises/practice/killer-sudoku-helper/runtests.jl b/exercises/practice/killer-sudoku-helper/runtests.jl index 11ccbe53..5be2ad02 100644 --- a/exercises/practice/killer-sudoku-helper/runtests.jl +++ b/exercises/practice/killer-sudoku-helper/runtests.jl @@ -2,24 +2,26 @@ using Test include("sudoku-util.jl") -@testset "Trivial 1-digit cages" begin - for n in 1:9 - @test combinations_in_cage(n, 1) == [[n]] +@testset verbose = true "Killer Sudoku Helper" begin + @testset "Trivial 1-digit cages" begin + for n in 1:9 + @test combinations_in_cage(n, 1) == [[n]] + end end -end -@testset "Cage with sum 45 contains all digits 1:9" begin - @test combinations_in_cage(45, 9) == [[1, 2, 3, 4, 5, 6, 7, 8, 9]] -end + @testset "Cage with sum 45 contains all digits 1:9" begin + @test combinations_in_cage(45, 9) == [[1, 2, 3, 4, 5, 6, 7, 8, 9]] + end -@testset "Cage with only 1 possible combination" begin - @test combinations_in_cage(7, 3) == [[1, 2, 4]] -end + @testset "Cage with only 1 possible combination" begin + @test combinations_in_cage(7, 3) == [[1, 2, 4]] + end -@testset "Cage with several combinations" begin - @test combinations_in_cage(10, 2) == [[1, 9], [2, 8], [3, 7], [4, 6]] -end + @testset "Cage with several combinations" begin + @test combinations_in_cage(10, 2) == [[1, 9], [2, 8], [3, 7], [4, 6]] + end -@testset "Cage with several combinations that is restricted" begin - @test combinations_in_cage(10, 2, [1, 4]) == [[2, 8], [3, 7]] + @testset "Cage with several combinations that is restricted" begin + @test combinations_in_cage(10, 2, [1, 4]) == [[2, 8], [3, 7]] + end end diff --git a/exercises/practice/leap/runtests.jl b/exercises/practice/leap/runtests.jl index 9b922e62..28aa95aa 100644 --- a/exercises/practice/leap/runtests.jl +++ b/exercises/practice/leap/runtests.jl @@ -2,42 +2,44 @@ using Test include("leap.jl") -@testset "Year not divisible by 4: common year" begin - @test !is_leap_year(2015) -end - -@testset "Year divisible by 2, not divisible by 4: common year" begin - @test !is_leap_year(1970) -end - -@testset "Year divisible by 4, not divisible by 100: leap year" begin - @test is_leap_year(1996) -end - -@testset "Year divisible by 4 and 5: leap year" begin - @test is_leap_year(1960) -end - -@testset "Year divisible by 4, not divisible by 100: leap year" begin - @test is_leap_year(2016) -end - -@testset "Year divisible by 100, not divisible by 400: common year" begin - @test !is_leap_year(2100) -end - -@testset "Year divisible by 100 but not by 3: common year" begin - @test !is_leap_year(1900) -end - -@testset "Year divisible by 400: leap year" begin - @test is_leap_year(2000) -end - -@testset "Year divisible by 400 but not by 125: leap year" begin - @test is_leap_year(2400) -end - -@testset "Year divisible by 200, not divisible by 400: common year" begin - @test !is_leap_year(1800) +@testset verbose = true "Leap" begin + @testset "Year not divisible by 4: common year" begin + @test !is_leap_year(2015) + end + + @testset "Year divisible by 2, not divisible by 4: common year" begin + @test !is_leap_year(1970) + end + + @testset "Year divisible by 4, not divisible by 100: leap year" begin + @test is_leap_year(1996) + end + + @testset "Year divisible by 4 and 5: leap year" begin + @test is_leap_year(1960) + end + + @testset "Year divisible by 4, not divisible by 100: leap year" begin + @test is_leap_year(2016) + end + + @testset "Year divisible by 100, not divisible by 400: common year" begin + @test !is_leap_year(2100) + end + + @testset "Year divisible by 100 but not by 3: common year" begin + @test !is_leap_year(1900) + end + + @testset "Year divisible by 400: leap year" begin + @test is_leap_year(2000) + end + + @testset "Year divisible by 400 but not by 125: leap year" begin + @test is_leap_year(2400) + end + + @testset "Year divisible by 200, not divisible by 400: common year" begin + @test !is_leap_year(1800) + end end diff --git a/exercises/practice/nucleotide-count/runtests.jl b/exercises/practice/nucleotide-count/runtests.jl index ad22b400..168fe914 100644 --- a/exercises/practice/nucleotide-count/runtests.jl +++ b/exercises/practice/nucleotide-count/runtests.jl @@ -2,22 +2,24 @@ using Test include("nucleotide-count.jl") -@testset "empty strand" begin - @test count_nucleotides("") == Dict('A' => 0, 'C' => 0, 'G' => 0, 'T' => 0) -end +@testset verbose = true "Nucleotide Count" begin + @testset "empty strand" begin + @test count_nucleotides("") == Dict('A' => 0, 'C' => 0, 'G' => 0, 'T' => 0) + end -@testset "strand with one nucleotide in single-character input" begin - @test count_nucleotides("G") == Dict('A' => 0, 'C' => 0, 'G' => 1, 'T' => 0) -end + @testset "strand with one nucleotide in single-character input" begin + @test count_nucleotides("G") == Dict('A' => 0, 'C' => 0, 'G' => 1, 'T' => 0) + end -@testset "strand with repeated nucleotide" begin - @test count_nucleotides("GGGGGGG") == Dict('A' => 0, 'C' => 0, 'G' => 7, 'T' => 0) -end + @testset "strand with repeated nucleotide" begin + @test count_nucleotides("GGGGGGG") == Dict('A' => 0, 'C' => 0, 'G' => 7, 'T' => 0) + end -@testset "strand with multiple nucleotides" begin - @test count_nucleotides("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC") == Dict('A' => 20, 'C' => 12, 'G' => 17, 'T' => 21) -end + @testset "strand with multiple nucleotides" begin + @test count_nucleotides("AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC") == Dict('A' => 20, 'C' => 12, 'G' => 17, 'T' => 21) + end -@testset "strand with invalid nucleotides" begin - @test_throws DomainError count_nucleotides("AGXXACT") + @testset "strand with invalid nucleotides" begin + @test_throws DomainError count_nucleotides("AGXXACT") + end end diff --git a/exercises/practice/pangram/runtests.jl b/exercises/practice/pangram/runtests.jl index 16d521e7..31c96f4e 100644 --- a/exercises/practice/pangram/runtests.jl +++ b/exercises/practice/pangram/runtests.jl @@ -2,7 +2,7 @@ using Test include("pangram.jl") -@testset verbose = true "pangram" begin +@testset verbose = true "Pangram" begin @testset "empty sentence" begin @test !ispangram("") end diff --git a/exercises/practice/pythagorean-triplet/runtests.jl b/exercises/practice/pythagorean-triplet/runtests.jl index d4c3ffcd..e747147c 100644 --- a/exercises/practice/pythagorean-triplet/runtests.jl +++ b/exercises/practice/pythagorean-triplet/runtests.jl @@ -1,45 +1,47 @@ using Test include("pythagorean-triplet.jl") -@testset "triplets whose sum is 12" begin - @test pythagorean_triplets(12) == [(3, 4, 5)] -end +@testset verbose = true "Pythagorean Triplet" begin + @testset "triplets whose sum is 12" begin + @test pythagorean_triplets(12) == [(3, 4, 5)] + end -@testset "triplets whose sum is 108" begin - @test pythagorean_triplets(108) == [(27, 36, 45)] -end + @testset "triplets whose sum is 108" begin + @test pythagorean_triplets(108) == [(27, 36, 45)] + end -@testset "triplets whose sum is 1000" begin - @test pythagorean_triplets(1000) == [(200, 375, 425)] -end + @testset "triplets whose sum is 1000" begin + @test pythagorean_triplets(1000) == [(200, 375, 425)] + end -@testset "triplets whose sum is 1001" begin - @test pythagorean_triplets(1001) == [] -end + @testset "triplets whose sum is 1001" begin + @test pythagorean_triplets(1001) == [] + end -@testset "returns all matching triplets" begin - @test pythagorean_triplets(90) == [(9, 40, 41), (15, 36, 39)] -end + @testset "returns all matching triplets" begin + @test pythagorean_triplets(90) == [(9, 40, 41), (15, 36, 39)] + end -@testset "several matching triplets" begin - @test pythagorean_triplets(840) == [ - (40, 399, 401), - (56, 390, 394), - (105, 360, 375), - (120, 350, 370), - (140, 336, 364), - (168, 315, 357), - (210, 280, 350), - (240, 252, 348), - ] -end + @testset "several matching triplets" begin + @test pythagorean_triplets(840) == [ + (40, 399, 401), + (56, 390, 394), + (105, 360, 375), + (120, 350, 370), + (140, 336, 364), + (168, 315, 357), + (210, 280, 350), + (240, 252, 348), + ] + end -@testset "triplets for large number" begin - @test pythagorean_triplets(30000) == [ - (1200, 14375, 14425), - (1875, 14000, 14125), - (5000, 12000, 13000), - (6000, 11250, 12750), - (7500, 10000, 12500), - ] + @testset "triplets for large number" begin + @test pythagorean_triplets(30000) == [ + (1200, 14375, 14425), + (1875, 14000, 14125), + (5000, 12000, 13000), + (6000, 11250, 12750), + (7500, 10000, 12500), + ] + end end diff --git a/exercises/practice/raindrops/runtests.jl b/exercises/practice/raindrops/runtests.jl index c06a6180..2292e2a2 100644 --- a/exercises/practice/raindrops/runtests.jl +++ b/exercises/practice/raindrops/runtests.jl @@ -2,71 +2,73 @@ using Test include("raindrops.jl") -@testset "detect numbers" begin - @testset "the sound for 1 is 1" begin - @test raindrops(1) == "1" +@testset verbose = true "Raindrops" begin + @testset "detect numbers" begin + @testset "the sound for 1 is 1" begin + @test raindrops(1) == "1" + end + @testset "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base" begin + @test raindrops(8) == "8" + end + @testset "the sound for 52 is 52" begin + @test raindrops(52) == "52" + end end - @testset "2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base" begin - @test raindrops(8) == "8" - end - @testset "the sound for 52 is 52" begin - @test raindrops(52) == "52" - end -end -@testset "detect pling" begin - @testset "the sound for 3 is Pling" begin - @test raindrops(3) == "Pling" - end - @testset "the sound for 6 is Pling as it has a factor 3" begin - @test raindrops(6) == "Pling" - end - @testset "the sound for 9 is Pling as it has a factor 3" begin - @test raindrops(9) == "Pling" + @testset "detect pling" begin + @testset "the sound for 3 is Pling" begin + @test raindrops(3) == "Pling" + end + @testset "the sound for 6 is Pling as it has a factor 3" begin + @test raindrops(6) == "Pling" + end + @testset "the sound for 9 is Pling as it has a factor 3" begin + @test raindrops(9) == "Pling" + end + @testset "the sound for 27 is Pling as it has a factor 3" begin + @test raindrops(27) == "Pling" + end end - @testset "the sound for 27 is Pling as it has a factor 3" begin - @test raindrops(27) == "Pling" - end -end -@testset "detect plang" begin - @testset "the sound for 5 is Plang" begin - @test raindrops(5) == "Plang" - end - @testset "the sound for 10 is Plang as it has a factor 5" begin - @test raindrops(10) == "Plang" - end - @testset "the sound for 25 is Plang as it has a factor 5" begin - @test raindrops(25) == "Plang" + @testset "detect plang" begin + @testset "the sound for 5 is Plang" begin + @test raindrops(5) == "Plang" + end + @testset "the sound for 10 is Plang as it has a factor 5" begin + @test raindrops(10) == "Plang" + end + @testset "the sound for 25 is Plang as it has a factor 5" begin + @test raindrops(25) == "Plang" + end + @testset "the sound for 3125 is Plang as it has a factor 5" begin + @test raindrops(3125) == "Plang" + end end - @testset "the sound for 3125 is Plang as it has a factor 5" begin - @test raindrops(3125) == "Plang" - end -end -@testset "detect plong" begin - @testset "the sound for 7 is Plong" begin - @test raindrops(7) == "Plong" - end - @testset "the sound for 14 is Plong as it has a factor of 7" begin - @test raindrops(14) == "Plong" - end - @testset "the sound for 49 is Plong as it has a factor 7" begin - @test raindrops(49) == "Plong" + @testset "detect plong" begin + @testset "the sound for 7 is Plong" begin + @test raindrops(7) == "Plong" + end + @testset "the sound for 14 is Plong as it has a factor of 7" begin + @test raindrops(14) == "Plong" + end + @testset "the sound for 49 is Plong as it has a factor 7" begin + @test raindrops(49) == "Plong" + end end -end -@testset "detect multiple sounds" begin - @testset "the sound for 15 is PlingPlang as it has factors 3 and 5" begin - @test raindrops(15) == "PlingPlang" - end - @testset "the sound for 21 is PlingPlong as it has factors 3 and 7" begin - @test raindrops(21) == "PlingPlong" - end - @testset "the sound for 35 is PlangPlong as it has factors 5 and 7" begin - @test raindrops(35) == "PlangPlong" - end - @testset "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7" begin - @test raindrops(105) == "PlingPlangPlong" + @testset "detect multiple sounds" begin + @testset "the sound for 15 is PlingPlang as it has factors 3 and 5" begin + @test raindrops(15) == "PlingPlang" + end + @testset "the sound for 21 is PlingPlong as it has factors 3 and 7" begin + @test raindrops(21) == "PlingPlong" + end + @testset "the sound for 35 is PlangPlong as it has factors 5 and 7" begin + @test raindrops(35) == "PlangPlong" + end + @testset "the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7" begin + @test raindrops(105) == "PlingPlangPlong" + end end end diff --git a/exercises/practice/reverse-string/runtests.jl b/exercises/practice/reverse-string/runtests.jl index 34e116b4..7f9fd3a8 100644 --- a/exercises/practice/reverse-string/runtests.jl +++ b/exercises/practice/reverse-string/runtests.jl @@ -2,42 +2,43 @@ using Test include("reverse-string.jl") +@testset verbose = true "Reverse String" begin + @testset "an empty string" begin + @test myreverse("") == "" + end -@testset "an empty string" begin - @test myreverse("") == "" -end - -@testset "a word" begin - @test myreverse("robot") == "tobor" -end + @testset "a word" begin + @test myreverse("robot") == "tobor" + end -@testset "a capitalized word" begin - @test myreverse("Ramen") == "nemaR" -end + @testset "a capitalized word" begin + @test myreverse("Ramen") == "nemaR" + end -@testset "a sentence with punctuation" begin - @test myreverse("I'm hungry!") == "!yrgnuh m'I" -end + @testset "a sentence with punctuation" begin + @test myreverse("I'm hungry!") == "!yrgnuh m'I" + end -@testset "a palindrome" begin - @test myreverse("racecar") == "racecar" -end + @testset "a palindrome" begin + @test myreverse("racecar") == "racecar" + end -@testset "an even-sized word" begin - @test myreverse("drawer") == "reward" -end + @testset "an even-sized word" begin + @test myreverse("drawer") == "reward" + end -@testset "reversing a string twice" begin - @test myreverse(myreverse("gift")) == "gift" -end + @testset "reversing a string twice" begin + @test myreverse(myreverse("gift")) == "gift" + end -@testset "emoji" begin - @test myreverse("hi 🐱") == "🐱 ih" -end + @testset "emoji" begin + @test myreverse("hi 🐱") == "🐱 ih" + end -if @isdefined(TEST_GRAPHEMES) - @eval @testset "graphemes" begin - @test myreverse("as⃝df̅") == "f̅ds⃝a" - @test myreverse("hi 👋🏾") == "👋🏾 ih" + if @isdefined(TEST_GRAPHEMES) + @eval @testset "graphemes" begin + @test myreverse("as⃝df̅") == "f̅ds⃝a" + @test myreverse("hi 👋🏾") == "👋🏾 ih" + end end end diff --git a/exercises/practice/rna-transcription/runtests.jl b/exercises/practice/rna-transcription/runtests.jl index f12a8006..676c641a 100644 --- a/exercises/practice/rna-transcription/runtests.jl +++ b/exercises/practice/rna-transcription/runtests.jl @@ -2,42 +2,44 @@ using Test include("rna-transcription.jl") -@testset "basic transformations" begin - @testset "empty rna sequence" begin - @test to_rna("") == "" - end +@testset verbose = true "RNA Transcription" begin + @testset "basic transformations" begin + @testset "empty rna sequence" begin + @test to_rna("") == "" + end - @testset "rna complement of cytosine is guanine" begin - @test to_rna("C") == "G" - end + @testset "rna complement of cytosine is guanine" begin + @test to_rna("C") == "G" + end - @testset "rna complement of guanine is cytosine" begin - @test to_rna("G") == "C" - end + @testset "rna complement of guanine is cytosine" begin + @test to_rna("G") == "C" + end - @testset "rna complement of thymine is adenine" begin - @test to_rna("T") == "A" - end + @testset "rna complement of thymine is adenine" begin + @test to_rna("T") == "A" + end - @testset "rna complement of adenine is uracil" begin - @test to_rna("A") == "U" + @testset "rna complement of adenine is uracil" begin + @test to_rna("A") == "U" + end end -end -@testset "rna complement" begin - @test to_rna("ACGTGGTCTTAA") == "UGCACCAGAAUU" -end - -@testset "error handling" begin - @testset "dna correctly handles invalid input" begin - @test_throws ErrorException to_rna("U") + @testset "rna complement" begin + @test to_rna("ACGTGGTCTTAA") == "UGCACCAGAAUU" end - @testset "dna correctly handles completely invalid input" begin - @test_throws ErrorException to_rna("XXX") - end + @testset "error handling" begin + @testset "dna correctly handles invalid input" begin + @test_throws ErrorException to_rna("U") + end + + @testset "dna correctly handles completely invalid input" begin + @test_throws ErrorException to_rna("XXX") + end - @testset "dna correctly handles partially invalid input" begin - @test_throws ErrorException to_rna("ACGTXXXCTTAA") + @testset "dna correctly handles partially invalid input" begin + @test_throws ErrorException to_rna("ACGTXXXCTTAA") + end end end diff --git a/exercises/practice/rotational-cipher/runtests.jl b/exercises/practice/rotational-cipher/runtests.jl index 4d33478c..e98ed0fc 100644 --- a/exercises/practice/rotational-cipher/runtests.jl +++ b/exercises/practice/rotational-cipher/runtests.jl @@ -2,53 +2,56 @@ using Test include("rotational-cipher.jl") -@testset "rotate function" begin - @testset "rotate by n" begin - @testset "no wrap" begin - @test rotate(1, "a") == "b" - @test rotate(1, 'a') == 'b' - @test rotate(13, "m") == "z" - @test rotate(13, 'm') == 'z' - end - @testset "wrap around" begin - @test rotate(13, "n") == "a" - @test rotate(13, 'n') == 'a' +@testset verbose = true "Rotational Cipher" begin + @testset "rotate function" begin + @testset "rotate by n" begin + @testset "no wrap" begin + @test rotate(1, "a") == "b" + @test rotate(1, 'a') == 'b' + @test rotate(13, "m") == "z" + @test rotate(13, 'm') == 'z' + end + + @testset "wrap around" begin + @test rotate(13, "n") == "a" + @test rotate(13, 'n') == 'a' + end end - end - @testset "full rotation" begin - @test rotate(26, "a") == "a" - @test rotate(26, 'a') == 'a' - @test rotate(0, "a") == "a" - @test rotate(0, 'a') == 'a' - end + @testset "full rotation" begin + @test rotate(26, "a") == "a" + @test rotate(26, 'a') == 'a' + @test rotate(0, "a") == "a" + @test rotate(0, 'a') == 'a' + end - @testset "full strings" begin - @test rotate(5, "OMG") == "TRL" - @test rotate(5, "O M G") == "T R L" - @test rotate(4, "Testing 1 2 3 testing") == "Xiwxmrk 1 2 3 xiwxmrk" - @test rotate(21, "Let's eat, Grandma!") == "Gzo'n zvo, Bmviyhv!" - @test rotate(13, "The quick brown fox jumps over the lazy dog.") == "Gur dhvpx oebja sbk whzcf bire gur ynml qbt." + @testset "full strings" begin + @test rotate(5, "OMG") == "TRL" + @test rotate(5, "O M G") == "T R L" + @test rotate(4, "Testing 1 2 3 testing") == "Xiwxmrk 1 2 3 xiwxmrk" + @test rotate(21, "Let's eat, Grandma!") == "Gzo'n zvo, Bmviyhv!" + @test rotate(13, "The quick brown fox jumps over the lazy dog.") == "Gur dhvpx oebja sbk whzcf bire gur ynml qbt." + end end -end -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# Additional exercises # -# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # + # Bonus tests # + # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # -# Bonus A -if isdefined(@__MODULE__, Symbol("@R13_str")) - @eval @testset "Bonus A: string literal R13" begin - @test R13"The quick brown fox jumps over the lazy dog." == "Gur dhvpx oebja sbk whzcf bire gur ynml qbt." + # Bonus A + if isdefined(@__MODULE__, Symbol("@R13_str")) + @eval @testset "Bonus A: string literal R13" begin + @test R13"The quick brown fox jumps over the lazy dog." == "Gur dhvpx oebja sbk whzcf bire gur ynml qbt." + end end -end -# Bonus B -if isdefined(@__MODULE__, Symbol("@R1_str")) - @eval @testset "Bonus B: string literals" begin - @test R5"OMG" == "TRL" - @test R4"Testing 1 2 3 testing" == "Xiwxmrk 1 2 3 xiwxmrk" - @test R21"Let's eat, Grandma!" == "Gzo'n zvo, Bmviyhv!" - @test R13"The quick brown fox jumps over the lazy dog." == "Gur dhvpx oebja sbk whzcf bire gur ynml qbt." + # Bonus B + if isdefined(@__MODULE__, Symbol("@R1_str")) + @eval @testset "Bonus B: string literals" begin + @test R5"OMG" == "TRL" + @test R4"Testing 1 2 3 testing" == "Xiwxmrk 1 2 3 xiwxmrk" + @test R21"Let's eat, Grandma!" == "Gzo'n zvo, Bmviyhv!" + @test R13"The quick brown fox jumps over the lazy dog." == "Gur dhvpx oebja sbk whzcf bire gur ynml qbt." + end end end diff --git a/exercises/practice/saddle-points/runtests.jl b/exercises/practice/saddle-points/runtests.jl index d87626c4..f10f88c4 100644 --- a/exercises/practice/saddle-points/runtests.jl +++ b/exercises/practice/saddle-points/runtests.jl @@ -2,47 +2,49 @@ using Test include("saddle-points.jl") -@testset "Can identify single saddle point" begin - M = [9 8 7; 5 3 2; 6 6 7] - @test saddlepoints(M) == [(2, 1)] -end - -@testset "Can identify that empty matrix has no saddle points" begin - M = [] - @test saddlepoints(M) == [] -end - -@testset "Can identify lack of saddle points when there are none" begin - M = [1 2 3; 3 1 2; 2 3 1] - @test saddlepoints(M) == [] -end - -@testset "Can identify multiple saddle points in a column" begin - M = [4 5 4; 3 5 5; 1 5 4] - @test saddlepoints(M) == [(1, 2), (2, 2), (3, 2)] -end - -@testset "Can identify multiple saddle points in a row" begin - M = [6 7 8; 5 5 5; 7 5 6] - @test saddlepoints(M) == [(2, 1), (2, 2), (2, 3)] -end - -@testset "Can identify saddle point in bottom right corner" begin - M = [8 7 9; 6 7 6; 3 2 5] - @test saddlepoints(M) == [(3, 3)] -end - -@testset "Can identify saddle points in a non square matrix" begin - M = [3 1 3; 3 2 4] - @test saddlepoints(M) == [(1, 1), (1, 3)] -end - -@testset "Can identify that saddle points in a single column matrix are those with the minimum value" begin - M = reshape([2, 1, 4, 1], :, 1) - @test saddlepoints(M) == [(2, 1), (4, 1)] -end - -@testset "Can identify that saddle points in a single row matrix are those with the maximum value" begin - M = [2 5 3 5] - @test saddlepoints(M) == [(1, 2), (1, 4)] +@testset verbose = true "Saddle Points" begin + @testset "Can identify single saddle point" begin + M = Int[9 8 7; 5 3 2; 6 6 7] + @test saddlepoints(M) == NTuple{2,Int}[(2, 1)] + end + + @testset "Can identify that empty matrix has no saddle points" begin + M = Int[] + @test saddlepoints(M) == NTuple{2,Int}[] + end + + @testset "Can identify lack of saddle points when there are none" begin + M = Int[1 2 3; 3 1 2; 2 3 1] + @test saddlepoints(M) == NTuple{2,Int}[] + end + + @testset "Can identify multiple saddle points in a column" begin + M = Int[4 5 4; 3 5 5; 1 5 4] + @test saddlepoints(M) == NTuple{2,Int}[(1, 2), (2, 2), (3, 2)] + end + + @testset "Can identify multiple saddle points in a row" begin + M = Int[6 7 8; 5 5 5; 7 5 6] + @test saddlepoints(M) == NTuple{2,Int}[(2, 1), (2, 2), (2, 3)] + end + + @testset "Can identify saddle point in bottom right corner" begin + M = Int[8 7 9; 6 7 6; 3 2 5] + @test saddlepoints(M) == NTuple{2,Int}[(3, 3)] + end + + @testset "Can identify saddle points in a non square matrix" begin + M = Int[3 1 3; 3 2 4] + @test saddlepoints(M) == NTuple{2,Int}[(1, 1), (1, 3)] + end + + @testset "Can identify that saddle points in a single column matrix are those with the minimum value" begin + M = reshape(Int[2, 1, 4, 1], :, 1) + @test saddlepoints(M) == NTuple{2,Int}[(2, 1), (4, 1)] + end + + @testset "Can identify that saddle points in a single row matrix are those with the maximum value" begin + M = Int[2 5 3 5] + @test saddlepoints(M) == NTuple{2,Int}[(1, 2), (1, 4)] + end end diff --git a/exercises/practice/scrabble-score/runtests.jl b/exercises/practice/scrabble-score/runtests.jl index 99611a4c..e8bcf175 100644 --- a/exercises/practice/scrabble-score/runtests.jl +++ b/exercises/practice/scrabble-score/runtests.jl @@ -2,50 +2,52 @@ using Test include("scrabble-score.jl") -@testset "lowercase letter" begin - @test score("a") == 1 -end - -@testset "uppercase letter" begin - @test score("A") == 1 -end - -@testset "valuable letter" begin - @test score("f") == 4 -end - -@testset "short word" begin - @test score("at") == 2 -end - -@testset "short, valuable word" begin - @test score("zoo") == 12 -end - -@testset "medium word" begin - @test score("street") == 6 -end - -@testset "medium, valuable word" begin - @test score("quirky") == 22 -end - -@testset "long, mixed-case word" begin - @test score("OxyphenButazone") == 41 -end - -@testset "english-like word" begin - @test score("pinata") == 8 -end - -@testset "non-english letter is not scored" begin - @test score("piñata") == 7 -end - -@testset "empty input" begin - @test score("") == 0 -end - -@testset "entire alphabet available" begin - @test score("abcdefghijklmnopqrstuvwxyz") == 87 +@testset verbose = true "Scrabble Score" begin + @testset "lowercase letter" begin + @test score("a") == 1 + end + + @testset "uppercase letter" begin + @test score("A") == 1 + end + + @testset "valuable letter" begin + @test score("f") == 4 + end + + @testset "short word" begin + @test score("at") == 2 + end + + @testset "short, valuable word" begin + @test score("zoo") == 12 + end + + @testset "medium word" begin + @test score("street") == 6 + end + + @testset "medium, valuable word" begin + @test score("quirky") == 22 + end + + @testset "long, mixed-case word" begin + @test score("OxyphenButazone") == 41 + end + + @testset "english-like word" begin + @test score("pinata") == 8 + end + + @testset "non-english letter is not scored" begin + @test score("piñata") == 7 + end + + @testset "empty input" begin + @test score("") == 0 + end + + @testset "entire alphabet available" begin + @test score("abcdefghijklmnopqrstuvwxyz") == 87 + end end diff --git a/exercises/practice/secret-handshake/runtests.jl b/exercises/practice/secret-handshake/runtests.jl index 5c34b127..5c64d967 100644 --- a/exercises/practice/secret-handshake/runtests.jl +++ b/exercises/practice/secret-handshake/runtests.jl @@ -2,50 +2,52 @@ using Test include("secret-handshake.jl") -@testset "wink for 1" begin - @test secret_handshake(1) == ["wink"] -end - -@testset "double blink for 10" begin - @test secret_handshake(2) == ["double blink"] -end - -@testset "close your eyes for 100" begin - @test secret_handshake(4) == ["close your eyes"] -end - -@testset "jump for 1000" begin - @test secret_handshake(8) == ["jump"] -end - -@testset "combine two actions" begin - @test secret_handshake(3) == ["wink", "double blink"] -end - -@testset "reverse two actions" begin - @test secret_handshake(19) == ["double blink", "wink"] -end - -@testset "reversing one action gives the same action" begin - @test secret_handshake(24) == ["jump"] -end - -@testset "reversing no actions still gives no actions" begin - @test secret_handshake(16) == [] -end - -@testset "all possible actions" begin - @test secret_handshake(15) == ["wink", "double blink", "close your eyes", "jump"] -end - -@testset "reverse all possible actions" begin - @test secret_handshake(31) == ["jump", "close your eyes", "double blink", "wink"] -end - -@testset "do nothing for zero" begin - @test secret_handshake(0) == [] -end - -@testset "do nothing if lower 5 bits not set" begin - @test secret_handshake(32) == [] +@testset verbose = true "Secret Handshake" begin + @testset "wink for 1" begin + @test secret_handshake(1) == ["wink"] + end + + @testset "double blink for 10" begin + @test secret_handshake(2) == ["double blink"] + end + + @testset "close your eyes for 100" begin + @test secret_handshake(4) == ["close your eyes"] + end + + @testset "jump for 1000" begin + @test secret_handshake(8) == ["jump"] + end + + @testset "combine two actions" begin + @test secret_handshake(3) == ["wink", "double blink"] + end + + @testset "reverse two actions" begin + @test secret_handshake(19) == ["double blink", "wink"] + end + + @testset "reversing one action gives the same action" begin + @test secret_handshake(24) == ["jump"] + end + + @testset "reversing no actions still gives no actions" begin + @test secret_handshake(16) == [] + end + + @testset "all possible actions" begin + @test secret_handshake(15) == ["wink", "double blink", "close your eyes", "jump"] + end + + @testset "reverse all possible actions" begin + @test secret_handshake(31) == ["jump", "close your eyes", "double blink", "wink"] + end + + @testset "do nothing for zero" begin + @test secret_handshake(0) == [] + end + + @testset "do nothing if lower 5 bits not set" begin + @test secret_handshake(32) == [] + end end From b97941417f253d3e48fccb00a1b28dc5080da1b3 Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Wed, 24 Jan 2024 16:04:48 +0100 Subject: [PATCH 07/12] leap: sync (#687) * Sync the `leap` exercise's docs with the latest data. * Sync the `leap` exercise's metadata with the latest data. --- exercises/practice/leap/.docs/instructions.md | 23 +------------------ exercises/practice/leap/.docs/introduction.md | 16 +++++++++++++ exercises/practice/leap/.meta/config.json | 6 ++--- 3 files changed, 20 insertions(+), 25 deletions(-) create mode 100644 exercises/practice/leap/.docs/introduction.md diff --git a/exercises/practice/leap/.docs/instructions.md b/exercises/practice/leap/.docs/instructions.md index dc7b4e81..b14f8565 100644 --- a/exercises/practice/leap/.docs/instructions.md +++ b/exercises/practice/leap/.docs/instructions.md @@ -1,24 +1,3 @@ # Instructions -Given a year, report if it is a leap year. - -The tricky thing here is that a leap year in the Gregorian calendar occurs: - -```text -on every year that is evenly divisible by 4 - except every year that is evenly divisible by 100 - unless the year is also evenly divisible by 400 -``` - -For example, 1997 is not a leap year, but 1996 is. 1900 is not a leap -year, but 2000 is. - -## Notes - -Though our exercise adopts some very simple rules, there is more to -learn! - -For a delightful, four minute explanation of the whole leap year -phenomenon, go watch [this youtube video][video]. - -[video]: http://www.youtube.com/watch?v=xX96xng7sAE +Your task is to determine whether a given year is a leap year. diff --git a/exercises/practice/leap/.docs/introduction.md b/exercises/practice/leap/.docs/introduction.md new file mode 100644 index 00000000..4ffd2da5 --- /dev/null +++ b/exercises/practice/leap/.docs/introduction.md @@ -0,0 +1,16 @@ +# Introduction + +A leap year (in the Gregorian calendar) occurs: + +- In every year that is evenly divisible by 4. +- Unless the year is evenly divisible by 100, in which case it's only a leap year if the year is also evenly divisible by 400. + +Some examples: + +- 1997 was not a leap year as it's not divisible by 4. +- 1900 was not a leap year as it's not divisible by 400. +- 2000 was a leap year! + +~~~~exercism/note +For a delightful, four-minute explanation of the whole phenomenon of leap years, check out [this YouTube video](https://www.youtube.com/watch?v=xX96xng7sAE). +~~~~ diff --git a/exercises/practice/leap/.meta/config.json b/exercises/practice/leap/.meta/config.json index 92668e9d..a67a1b6d 100644 --- a/exercises/practice/leap/.meta/config.json +++ b/exercises/practice/leap/.meta/config.json @@ -1,5 +1,5 @@ { - "blurb": "Given a year, report if it is a leap year.", + "blurb": "Determine whether a given year is a leap year.", "authors": [ "andrej-makarov-skrt" ], @@ -18,6 +18,6 @@ ".meta/example.jl" ] }, - "source": "JavaRanch Cattle Drive, exercise 3", - "source_url": "http://www.javaranch.com/leap.jsp" + "source": "CodeRanch Cattle Drive, Assignment 3", + "source_url": "https://coderanch.com/t/718816/Leap" } From 40171f3802b33289f91dda15236bff52d632b4cc Mon Sep 17 00:00:00 2001 From: Erik Schierboom Date: Thu, 25 Jan 2024 08:18:27 +0100 Subject: [PATCH 08/12] reverse-string: sync (#689) * Sync the `reverse-string` exercise's docs with the latest data. * Sync the `reverse-string` exercise's metadata with the latest data. --- .../practice/reverse-string/.docs/instructions.md | 10 ++++++---- .../practice/reverse-string/.docs/introduction.md | 5 +++++ exercises/practice/reverse-string/.meta/config.json | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 exercises/practice/reverse-string/.docs/introduction.md diff --git a/exercises/practice/reverse-string/.docs/instructions.md b/exercises/practice/reverse-string/.docs/instructions.md index 039ee33a..0ff4198e 100644 --- a/exercises/practice/reverse-string/.docs/instructions.md +++ b/exercises/practice/reverse-string/.docs/instructions.md @@ -1,7 +1,9 @@ # Instructions -Reverse a string +Your task is to reverse a given string. -For example: -input: "cool" -output: "looc" +Some examples: + +- Turn `"stressed"` into `"desserts"`. +- Turn `"strops"` into `"sports"`. +- Turn `"racecar"` into `"racecar"`. diff --git a/exercises/practice/reverse-string/.docs/introduction.md b/exercises/practice/reverse-string/.docs/introduction.md new file mode 100644 index 00000000..02233e07 --- /dev/null +++ b/exercises/practice/reverse-string/.docs/introduction.md @@ -0,0 +1,5 @@ +# Introduction + +Reversing strings (reading them from right to left, rather than from left to right) is a surprisingly common task in programming. + +For example, in bioinformatics, reversing the sequence of DNA or RNA strings is often important for various analyses, such as finding complementary strands or identifying palindromic sequences that have biological significance. diff --git a/exercises/practice/reverse-string/.meta/config.json b/exercises/practice/reverse-string/.meta/config.json index 171ac06a..001eaaac 100644 --- a/exercises/practice/reverse-string/.meta/config.json +++ b/exercises/practice/reverse-string/.meta/config.json @@ -1,5 +1,5 @@ { - "blurb": "Reverse a string", + "blurb": "Reverse a given string.", "authors": [ "kimttfung" ], From 8b4c7e09cad82ebe58bdf9b525760fa9a7bb0c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20B=20Nagy?= <20251272+BNAndras@users.noreply.github.com> Date: Sun, 28 Jan 2024 13:43:23 -0800 Subject: [PATCH 09/12] Add space-age exercise (#694) --- config.json | 119 +++++++++--------- .../practice/space-age/.docs/instructions.md | 25 ++++ .../practice/space-age/.meta/config.json | 19 +++ exercises/practice/space-age/.meta/example.jl | 31 +++++ exercises/practice/space-age/.meta/tests.toml | 38 ++++++ exercises/practice/space-age/runtests.jl | 53 ++++++++ exercises/practice/space-age/space-age.jl | 31 +++++ 7 files changed, 260 insertions(+), 56 deletions(-) create mode 100644 exercises/practice/space-age/.docs/instructions.md create mode 100644 exercises/practice/space-age/.meta/config.json create mode 100644 exercises/practice/space-age/.meta/example.jl create mode 100644 exercises/practice/space-age/.meta/tests.toml create mode 100644 exercises/practice/space-age/runtests.jl create mode 100644 exercises/practice/space-age/space-age.jl diff --git a/config.json b/config.json index fdf85667..c6540cc0 100644 --- a/config.json +++ b/config.json @@ -32,29 +32,12 @@ ".meta/exemplar.jl" ] }, - "concepts": [ - { - "uuid": "32384ed4-ef26-4118-8ea3-4d44c331e828", - "slug": "functions", - "name": "Functions" - }, - { - "slug": "integer-introduction", - "name": "Integers and Arithmetic Operations", - "uuid": "006ebce8-87cd-4695-87e6-8a7b8dc2f239" - }, - { - "slug": "comments", - "name": "Comments", - "uuid": "90365822-f58c-4e45-88be-430978b77e65" - } - ], "exercises": { "concept": [ { - "uuid": "39ebdd04-4f84-4817-bf9d-f1f9e066c283", - "name": "Lasagna", "slug": "lasagna", + "name": "Lasagna", + "uuid": "39ebdd04-4f84-4817-bf9d-f1f9e066c283", "concepts": [ "functions", "integer-introduction", @@ -82,12 +65,12 @@ "uuid": "e0142403-af9e-406e-827a-1fd37187d1ea", "practices": [], "prerequisites": [], + "difficulty": 5, "topics": [ "iterator-protocol", "vectors", "conditionals" - ], - "difficulty": 5 + ] }, { "slug": "leap", @@ -297,11 +280,11 @@ ] }, { + "slug": "reverse-string", + "name": "Reverse String", "uuid": "e73f19f7-17bc-4d51-a00a-c2b58c1fa8e6", "practices": [], "prerequisites": [], - "slug": "reverse-string", - "name": "Reverse String", "difficulty": 3, "topics": [ "generics", @@ -317,11 +300,11 @@ ] }, { + "slug": "allergies", + "name": "Allergies", "uuid": "4eced190-062f-4a7b-8c92-87ff02f1e343", "practices": [], "prerequisites": [], - "slug": "allergies", - "name": "Allergies", "difficulty": 1, "topics": [ "loops", @@ -554,12 +537,13 @@ ] }, { + "slug": "dnd-character", + "name": "D&D Character", "uuid": "fcb9ef0e-ed97-4420-a38f-9bf690c23a3b", "practices": [], "prerequisites": [], - "slug": "dnd-character", - "name": "D&D Character", "difficulty": 5, + "status": "deprecated", "topics": [ "variables", "integers", @@ -568,8 +552,7 @@ "randomness", "math", "test_driven_development" - ], - "status": "deprecated" + ] }, { "slug": "robot-simulator", @@ -583,11 +566,11 @@ ] }, { + "slug": "circular-buffer", + "name": "Circular Buffer", "uuid": "3dc9bbde-d344-4a36-a7e1-433637974dfc", "practices": [], "prerequisites": [], - "slug": "circular-buffer", - "name": "Circular Buffer", "difficulty": 8, "topics": [ "data_structures", @@ -617,8 +600,7 @@ "difficulty": 1, "topics": [ "math", - "integers", - "math" + "integers" ] }, { @@ -687,14 +669,14 @@ "practices": [], "prerequisites": [], "difficulty": 2, + "status": "deprecated", "topics": [ "broadcast", "conditionals", "variables", "integers", "arrays" - ], - "status": "deprecated" + ] }, { "slug": "bob", @@ -730,20 +712,20 @@ "practices": [], "prerequisites": [], "difficulty": 2, + "status": "deprecated", "topics": [ "arrays", "conditionals", "loops", "strings" - ], - "status": "deprecated" + ] }, { + "slug": "perfect-numbers", + "name": "Perfect Numbers", "uuid": "4fc89443-1c5c-492a-850f-7990869caae6", "practices": [], "prerequisites": [], - "slug": "perfect-numbers", - "name": "Perfect Numbers", "difficulty": 3, "topics": [ "loops", @@ -770,11 +752,11 @@ ] }, { + "slug": "all-your-base", + "name": "All Your Base", "uuid": "6fa91607-d772-47af-9520-de26bbb8addb", "practices": [], "prerequisites": [], - "slug": "all-your-base", - "name": "All Your Base", "difficulty": 4, "topics": [ "integers", @@ -782,11 +764,11 @@ ] }, { + "slug": "matching-brackets", + "name": "Matching Brackets", "uuid": "bf5c1f49-963a-4397-bb67-b58e1b7d45e3", "practices": [], "prerequisites": [], - "slug": "matching-brackets", - "name": "Matching Brackets", "difficulty": 5, "topics": [ "loops", @@ -801,11 +783,11 @@ ] }, { + "slug": "pythagorean-triplet", + "name": "Pythagorean Triplet", "uuid": "a534b8ed-da88-4945-bb25-f6633977740b", "practices": [], "prerequisites": [], - "slug": "pythagorean-triplet", - "name": "Pythagorean Triplet", "difficulty": 7, "topics": [ "conditionals", @@ -823,19 +805,19 @@ ] }, { + "slug": "alphametics", + "name": "Alphametics", "uuid": "32af807f-ba90-4a36-bf6b-5d71a0fae7ae", "practices": [], "prerequisites": [], - "slug": "alphametics", - "name": "Alphametics", "difficulty": 10 }, { + "slug": "largest-series-product", + "name": "Largest Series Product", "uuid": "4ce25733-55ab-48fd-84e2-c4b7f2f3f529", "practices": [], "prerequisites": [], - "slug": "largest-series-product", - "name": "Largest Series Product", "difficulty": 4, "topics": [ "conditionals", @@ -850,11 +832,11 @@ ] }, { + "slug": "saddle-points", + "name": "Saddle Points", "uuid": "f26bf680-b8fb-40dd-a82c-884ae391b8b6", "practices": [], "prerequisites": [], - "slug": "saddle-points", - "name": "Saddle Points", "difficulty": 4, "topics": [ "conditionals", @@ -869,11 +851,11 @@ ] }, { + "slug": "square-root", + "name": "Square Root", "uuid": "587ad0fa-ea7e-4962-9c71-3a50d2877e6b", "practices": [], "prerequisites": [], - "slug": "square-root", - "name": "Square Root", "difficulty": 2, "topics": [ "algorithms", @@ -883,9 +865,34 @@ "conditionals", "variables" ] + }, + { + "slug": "space-age", + "name": "Space Age", + "uuid": "f4bfe822-90cc-4183-8a50-081ff0fdb512", + "practices": [], + "prerequisites": [], + "difficulty": 2 } ] }, + "concepts": [ + { + "uuid": "32384ed4-ef26-4118-8ea3-4d44c331e828", + "slug": "functions", + "name": "Functions" + }, + { + "uuid": "006ebce8-87cd-4695-87e6-8a7b8dc2f239", + "slug": "integer-introduction", + "name": "Integers and Arithmetic Operations" + }, + { + "uuid": "90365822-f58c-4e45-88be-430978b77e65", + "slug": "comments", + "name": "Comments" + } + ], "key_features": [ { "title": "Fast", @@ -920,15 +927,15 @@ ], "tags": [ "execution_mode/compiled", - "typing/dynamic", "paradigm/declarative", "paradigm/functional", "paradigm/imperative", "paradigm/object_oriented", "paradigm/procedural", - "platform/windows", - "platform/mac", "platform/linux", + "platform/mac", + "platform/windows", + "typing/dynamic", "used_for/artificial_intelligence", "used_for/cross_platform_development", "used_for/financial_systems", diff --git a/exercises/practice/space-age/.docs/instructions.md b/exercises/practice/space-age/.docs/instructions.md new file mode 100644 index 00000000..fe938cc0 --- /dev/null +++ b/exercises/practice/space-age/.docs/instructions.md @@ -0,0 +1,25 @@ +# Instructions + +Given an age in seconds, calculate how old someone would be on: + +- Mercury: orbital period 0.2408467 Earth years +- Venus: orbital period 0.61519726 Earth years +- Earth: orbital period 1.0 Earth years, 365.25 Earth days, or 31557600 seconds +- Mars: orbital period 1.8808158 Earth years +- Jupiter: orbital period 11.862615 Earth years +- Saturn: orbital period 29.447498 Earth years +- Uranus: orbital period 84.016846 Earth years +- Neptune: orbital period 164.79132 Earth years + +So if you were told someone were 1,000,000,000 seconds old, you should +be able to say that they're 31.69 Earth-years old. + +If you're wondering why Pluto didn't make the cut, go watch [this YouTube video][pluto-video]. + +Note: The actual length of one complete orbit of the Earth around the sun is closer to 365.256 days (1 sidereal year). +The Gregorian calendar has, on average, 365.2425 days. +While not entirely accurate, 365.25 is the value used in this exercise. +See [Year on Wikipedia][year] for more ways to measure a year. + +[pluto-video]: https://www.youtube.com/watch?v=Z_2gbGXzFbs +[year]: https://en.wikipedia.org/wiki/Year#Summary diff --git a/exercises/practice/space-age/.meta/config.json b/exercises/practice/space-age/.meta/config.json new file mode 100644 index 00000000..dc1891c5 --- /dev/null +++ b/exercises/practice/space-age/.meta/config.json @@ -0,0 +1,19 @@ +{ + "authors": [ + "BNAndras" + ], + "files": { + "solution": [ + "space-age.jl" + ], + "test": [ + "runtests.jl" + ], + "example": [ + ".meta/example.jl" + ] + }, + "blurb": "Given an age in seconds, calculate how old someone is in terms of a given planet's solar years.", + "source": "Partially inspired by Chapter 1 in Chris Pine's online Learn to Program tutorial.", + "source_url": "https://pine.fm/LearnToProgram/?Chapter=01" +} diff --git a/exercises/practice/space-age/.meta/example.jl b/exercises/practice/space-age/.meta/example.jl new file mode 100644 index 00000000..fea0c474 --- /dev/null +++ b/exercises/practice/space-age/.meta/example.jl @@ -0,0 +1,31 @@ +function onEarth(seconds::Integer) + seconds / 31557600 +end + +function onMercury(seconds::Integer) + onEarth(seconds) / 0.2408467 +end + +function onVenus(seconds::Integer) + onEarth(seconds) / 0.61519726 +end + +function onMars(seconds::Integer) + onEarth(seconds) / 1.8808158 +end + +function onJupiter(seconds::Integer) + onEarth(seconds) / 11.862615 +end + +function onSaturn(seconds::Integer) + onEarth(seconds) / 29.447498 +end + +function onUranus(seconds::Integer) + onEarth(seconds) / 84.016846 +end + +function onNeptune(seconds::Integer) + onEarth(seconds) / 164.79132 +end diff --git a/exercises/practice/space-age/.meta/tests.toml b/exercises/practice/space-age/.meta/tests.toml new file mode 100644 index 00000000..07578798 --- /dev/null +++ b/exercises/practice/space-age/.meta/tests.toml @@ -0,0 +1,38 @@ +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. + +[84f609af-5a91-4d68-90a3-9e32d8a5cd34] +description = "age on Earth" + +[ca20c4e9-6054-458c-9312-79679ffab40b] +description = "age on Mercury" + +[502c6529-fd1b-41d3-8fab-65e03082b024] +description = "age on Venus" + +[9ceadf5e-a0d5-4388-9d40-2c459227ceb8] +description = "age on Mars" + +[42927dc3-fe5e-4f76-a5b5-f737fc19bcde] +description = "age on Jupiter" + +[8469b332-7837-4ada-b27c-00ee043ebcad] +description = "age on Saturn" + +[999354c1-76f8-4bb5-a672-f317b6436743] +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 \ No newline at end of file diff --git a/exercises/practice/space-age/runtests.jl b/exercises/practice/space-age/runtests.jl new file mode 100644 index 00000000..4fbdc94a --- /dev/null +++ b/exercises/practice/space-age/runtests.jl @@ -0,0 +1,53 @@ +using Test + +include("space-age.jl") + +@testset verbose = true "Space Age" begin + @testset "age on Earth" begin + result = onEarth(1000000000) + expected = 31.60 + @test isapprox(result, expected; rtol=0.01) + end + + @testset "age on Mercury" begin + result = onMercury(2134835688) + expected = 280.88 + @test isapprox(result, expected; rtol=0.01) + end + + @testset "age on Venus" begin + result = onVenus(189839836) + expected = 9.78 + @test isapprox(result, expected; rtol=0.01) + end + + @testset "age on Mars" begin + result = onMars(2129871239) + expected = 35.88 + @test isapprox(result, expected; rtol=0.01) + end + + @testset "age on Jupiter" begin + result = onJupiter(901876382) + expected = 2.41 + @test isapprox(result, expected; rtol=0.01) + end + + @testset "age on Saturn" begin + result = onSaturn(2000000000) + expected = 2.15 + @test isapprox(result, expected; rtol=0.01) + end + + @testset "age on Uranus" begin + result = onUranus(1210123456) + expected = 0.46 + @test isapprox(result, expected; rtol=0.01) + end + + @testset "age on Neptune" begin + result = onNeptune(1821023456) + expected = 0.35 + @test isapprox(result, expected; rtol=0.01) + end +end diff --git a/exercises/practice/space-age/space-age.jl b/exercises/practice/space-age/space-age.jl new file mode 100644 index 00000000..fea53d6b --- /dev/null +++ b/exercises/practice/space-age/space-age.jl @@ -0,0 +1,31 @@ +function onEarth(seconds) + +end + +function onMercury(seconds) + +end + +function onVenus(seconds) + +end + +function onMars(seconds) + +end + +function onJupiter(seconds) + +end + +function onSaturn(seconds) + +end + +function onUranus(seconds) + +end + +function onNeptune(seconds) + +end \ No newline at end of file From 87f97f83602b6e7f1859a270b279c45f2bcc51e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20B=20Nagy?= <20251272+BNAndras@users.noreply.github.com> Date: Sun, 28 Jan 2024 13:45:00 -0800 Subject: [PATCH 10/12] Add new test (#664) --- exercises/practice/isogram/.meta/tests.toml | 16 +++++++++++++--- exercises/practice/isogram/runtests.jl | 4 ++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/exercises/practice/isogram/.meta/tests.toml b/exercises/practice/isogram/.meta/tests.toml index 7187c340..ba04c664 100644 --- a/exercises/practice/isogram/.meta/tests.toml +++ b/exercises/practice/isogram/.meta/tests.toml @@ -1,6 +1,13 @@ -# This is an auto-generated file. Regular comments will be removed when this -# file is regenerated. Regenerating will not touch any manually added keys, -# so comments can be added in a "comment" key. +# This is an auto-generated file. +# +# Regenerating this file via `configlet sync` will: +# - Recreate every `description` key/value pair +# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications +# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion) +# - Preserve any other key/value pair +# +# As user-added comments (using the # character) will be removed when this file +# is regenerated, comments can be added via a `comment` key. [a0e97d2d-669e-47c7-8134-518a1e2c4555] description = "empty string" @@ -40,3 +47,6 @@ description = "duplicated character in the middle" [310ac53d-8932-47bc-bbb4-b2b94f25a83e] description = "same first and last characters" + +[0d0b8644-0a1e-4a31-a432-2b3ee270d847] +description = "word with duplicated character and with two hyphens" diff --git a/exercises/practice/isogram/runtests.jl b/exercises/practice/isogram/runtests.jl index 68949abf..d5d705d8 100644 --- a/exercises/practice/isogram/runtests.jl +++ b/exercises/practice/isogram/runtests.jl @@ -59,3 +59,7 @@ include("isogram.jl") @test !isisogram("angola") end end + +@testset "word with duplicated character and with two hyphens" begin + @test !isisogram("up-to-date") +end From 618873ac609268d75c7beb207eae0cb2335e59e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20B=20Nagy?= <20251272+BNAndras@users.noreply.github.com> Date: Sun, 28 Jan 2024 13:46:31 -0800 Subject: [PATCH 11/12] Add new tests (#663) --- .../practice/roman-numerals/.meta/tests.toml | 32 +++++++++++-------- exercises/practice/roman-numerals/runtests.jl | 2 ++ 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/exercises/practice/roman-numerals/.meta/tests.toml b/exercises/practice/roman-numerals/.meta/tests.toml index 1f669c21..57c6c4be 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,32 +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" -[6d1d82d5-bf3e-48af-9139-87d7165ed509] -description = "16 is XVI" - -[4465ffd5-34dc-44f3-ada5-56f5007b6dad] -description = "66 is LXVI" - -[902ad132-0b4d-40e3-8597-ba5ed611dd8d] -description = "166 is CLXVI" +[3bc4b41c-c2e6-49d9-9142-420691504336] +description = "3001 is MMMI" -[dacb84b9-ea1c-4a61-acbb-ce6b36674906] -description = "666 is DCLXVI" - -[efbe1d6a-9f98-4eb5-82bc-72753e3ac328] -description = "1666 is MDCLXVI" +[4e18e96b-5fbb-43df-a91b-9cb511fe0856] +description = "3999 is MMMCMXCIX" diff --git a/exercises/practice/roman-numerals/runtests.jl b/exercises/practice/roman-numerals/runtests.jl index cce2dc20..359573ed 100644 --- a/exercises/practice/roman-numerals/runtests.jl +++ b/exercises/practice/roman-numerals/runtests.jl @@ -30,6 +30,8 @@ samples = Dict( 1991 => "MCMXCI", 2017 => "MMXVII", 3000 => "MMM", + 3001 => "MMMI", + 3999 => "MMMCMXCIX", ) @testset "convert $(sample[1]) to roman numeral" for sample in samples From 87962e556e7671e9a542bf51612dc962b6734d33 Mon Sep 17 00:00:00 2001 From: Colin Caine Date: Mon, 29 Jan 2024 18:16:11 +0000 Subject: [PATCH 12/12] Add shared help.md (#655) --- exercises/shared/.docs/help.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/exercises/shared/.docs/help.md b/exercises/shared/.docs/help.md index 8b137891..12912395 100644 --- a/exercises/shared/.docs/help.md +++ b/exercises/shared/.docs/help.md @@ -1 +1,5 @@ +# Help +To get help if you're having trouble, we recommend that you submit your code and request mentoring :) + +If you don't want to do that for whatever reason, then you can find the wider Julia community channels [here](https://julialang.org/community/).