Skip to content

Commit

Permalink
Merge branch 'exercism:main' into queen-attack
Browse files Browse the repository at this point in the history
  • Loading branch information
habere-et-dispertire authored Aug 9, 2023
2 parents fd7cabc + a8d3df1 commit bbf2c46
Show file tree
Hide file tree
Showing 8 changed files with 267 additions and 10 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,26 @@ jobs:
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- uses: DavidAnson/markdownlint-cli2-action@bb4bb94c73936643d73d345b48fead3e96f90a5e # v10.0.1
- name: Lint markdown
uses: DavidAnson/markdownlint-cli2-action@bb4bb94c73936643d73d345b48fead3e96f90a5e # v10.0.1
with:
globs: |
**/*.md
check-links:
name: Check links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Check links
uses: lycheeverse/lychee-action@ec3ed119d4f44ad2673a7232460dc7dff59d2421 # 1.8.0
with:
args: --require-https --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36" --no-progress **/*.md **/*.html
fail: true
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

json-lint:
name: Lint json files
runs-on: ubuntu-22.04
Expand Down
2 changes: 2 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
collinsdictionary\.com
papyr\.com
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Test data can be incorporated into a track's test suites manually or extracted b
- Exercises _must_ contain tests that cover the public interface of the exercise (also thought of as "application tests").
- Exercises _may_ contain tests that cover the private or lower-level interface of the exercise (sometimes referred to as "library tests").

- Test cases are immutable, which means that once a test case has been added, it never changes. There are two exceptions:
- Test cases are immutable, which means that once a test case has been added, it never changes. There are some exceptions:
- The `comments` field _can_ be mutated and thus does not require adding a new test case when changing its value.
- The `description` field _can_ be mutated and thus does not require adding a new test case when changing its value.
- The `scenarios` field _can_ be mutated additively, by adding new scenarios. Existing scenarios must not be changed or removed. Adding new scenarios thus does not require adding a new test case.
Expand Down
3 changes: 0 additions & 3 deletions exercises/high-scores/canonical-data.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
{
"exercise": "high-scores",
"comments": [
"This is meant to be an easy exercise to practise: ",
"* arrays as simple lists",
"* instantiating a class",
"Consider adding a track specific recommendation in the track's hint.md.",
"Consider linking to a explanatory blogpost or beginner level tutorials for both topics.",
"See Ruby Track hint.md for an example."
Expand Down
240 changes: 240 additions & 0 deletions exercises/ledger/canonical-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
{
"exercise": "ledger",
"cases": [
{
"uuid": "d131ecae-a30e-436c-b8f3-858039a27234",
"description": "empty ledger",
"property": "formatEntries",
"input": {
"currency": "USD",
"locale": "en_US",
"entries": []
},
"expected": ["Date | Description | Change "]
},
{
"uuid": "ce4618d2-9379-4eca-b207-9df1c4ec8aaa",
"description": "one entry",
"property": "formatEntries",
"input": {
"currency": "USD",
"locale": "en_US",
"entries": [
{
"date": "2015-01-01",
"description": "Buy present",
"amountInCents": -1000
}
]
},
"expected": [
"Date | Description | Change ",
"01/01/2015 | Buy present | ($10.00)"
]
},
{
"uuid": "8d02e9cb-e6ee-4b77-9ce4-e5aec8eb5ccb",
"description": "credit and debit",
"property": "formatEntries",
"input": {
"currency": "USD",
"locale": "en_US",
"entries": [
{
"date": "2015-01-02",
"description": "Get present",
"amountInCents": 1000
},
{
"date": "2015-01-01",
"description": "Buy present",
"amountInCents": -1000
}
]
},
"expected": [
"Date | Description | Change ",
"01/01/2015 | Buy present | ($10.00)",
"01/02/2015 | Get present | $10.00 "
]
},
{
"uuid": "502c4106-0371-4e7c-a7d8-9ce33f16ccb1",
"description": "multiple entries on same date ordered by description",
"property": "formatEntries",
"input": {
"currency": "USD",
"locale": "en_US",
"entries": [
{
"date": "2015-01-02",
"description": "Get present",
"amountInCents": 1000
},
{
"date": "2015-01-01",
"description": "Buy present",
"amountInCents": -1000
}
]
},
"expected": [
"Date | Description | Change ",
"01/01/2015 | Buy present | ($10.00)",
"01/02/2015 | Get present | $10.00 "
]
},
{
"uuid": "29dd3659-6c2d-4380-94a8-6d96086e28e1",
"description": "final order tie breaker is change",
"property": "formatEntries",
"input": {
"currency": "USD",
"locale": "en_US",
"entries": [
{
"date": "2015-01-01",
"description": "Something",
"amountInCents": 0
},
{
"date": "2015-01-01",
"description": "Something",
"amountInCents": -1
},
{
"date": "2015-01-01",
"description": "Something",
"amountInCents": 1
}
]
},
"expected": [
"Date | Description | Change ",
"01/01/2015 | Something | ($0.01)",
"01/01/2015 | Something | $0.00 ",
"01/01/2015 | Something | $0.01 "
]
},
{
"uuid": "9b9712a6-f779-4f5c-a759-af65615fcbb9",
"description": "overlong description is truncated",
"property": "formatEntries",
"input": {
"currency": "USD",
"locale": "en_US",
"entries": [
{
"date": "2015-01-01",
"description": "Freude schoner Gotterfunken",
"amountInCents": -123456
}
]
},
"expected": [
"Date | Description | Change ",
"01/01/2015 | Freude schoner Gotterf... | ($1,234.56)"
]
},
{
"uuid": "67318aad-af53-4f3d-aa19-1293b4d4c924",
"description": "euros",
"property": "formatEntries",
"input": {
"currency": "EUR",
"locale": "en_US",
"entries": [
{
"date": "2015-01-01",
"description": "Buy present",
"amountInCents": -1000
}
]
},
"expected": [
"Date | Description | Change ",
"01/01/2015 | Buy present | (€10.00)"
]
},
{
"uuid": "bdc499b6-51f5-4117-95f2-43cb6737208e",
"description": "Dutch locale",
"property": "formatEntries",
"input": {
"currency": "USD",
"locale": "nl_NL",
"entries": [
{
"date": "2015-03-12",
"description": "Buy present",
"amountInCents": 123456
}
]
},
"expected": [
"Datum | Omschrijving | Verandering ",
"12-03-2015 | Buy present | $ 1.234,56 "
]
},
{
"uuid": "86591cd4-1379-4208-ae54-0ee2652b4670",
"description": "Dutch locale and euros",
"property": "formatEntries",
"input": {
"currency": "EUR",
"locale": "nl_NL",
"entries": [
{
"date": "2015-03-12",
"description": "Buy present",
"amountInCents": 123456
}
]
},
"expected": [
"Datum | Omschrijving | Verandering ",
"12-03-2015 | Buy present | € 1.234,56 "
]
},
{
"uuid": "876bcec8-d7d7-4ba4-82bd-b836ac87c5d2",
"description": "Dutch negative number with 3 digits before decimal point",
"property": "formatEntries",
"input": {
"currency": "USD",
"locale": "nl_NL",
"entries": [
{
"date": "2015-03-12",
"description": "Buy present",
"amountInCents": -12345
}
]
},
"expected": [
"Datum | Omschrijving | Verandering ",
"12-03-2015 | Buy present | $ -123,45 "
]
},
{
"uuid": "29670d1c-56be-492a-9c5e-427e4b766309",
"description": "American negative number with 3 digits before decimal point",
"property": "formatEntries",
"input": {
"currency": "USD",
"locale": "en_US",
"entries": [
{
"date": "2015-03-12",
"description": "Buy present",
"amountInCents": -12345
}
]
},
"expected": [
"Date | Description | Change ",
"03/12/2015 | Buy present | ($123.45)"
]
}
]
}
8 changes: 5 additions & 3 deletions exercises/list-ops/description.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ The precise number and names of the operations to be implemented will be track d
- `filter` (*given a predicate and a list, return the list of all items for which `predicate(item)` is True*);
- `length` (*given a list, return the total number of items within it*);
- `map` (*given a function and a list, return the list of the results of applying `function(item)` on all items*);
- `foldl` (*given a function, a list, and initial accumulator, fold (reduce) each item into the accumulator from the left using `function(accumulator, item)`*);
- `foldr` (*given a function, a list, and an initial accumulator, fold (reduce) each item into the accumulator from the right using `function(item, accumulator)`*);
- `reverse` (*given a list, return a list with all the original items, but in reversed order*);
- `foldl` (*given a function, a list, and initial accumulator, fold (reduce) each item into the accumulator from the left*);
- `foldr` (*given a function, a list, and an initial accumulator, fold (reduce) each item into the accumulator from the right*);
- `reverse` (*given a list, return a list with all the original items, but in reversed order*).

Note, the ordering in which arguments are passed to the fold functions (`foldl`, `foldr`) is significant.
3 changes: 2 additions & 1 deletion exercises/pig-latin/description.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ It obeys a few simple rules (below), but when it's spoken quickly it's really di
- **Rule 1**: If a word begins with a vowel sound, add an "ay" sound to the end of the word.
Please note that "xr" and "yt" at the beginning of a word make vowel sounds (e.g. "xray" -> "xrayay", "yttria" -> "yttriaay").
- **Rule 2**: If a word begins with a consonant sound, move it to the end of the word and then add an "ay" sound to the end of the word.
Consonant sounds can be made up of multiple consonants, a.k.a. a consonant cluster (e.g. "chair" -> "airchay").
Consonant sounds can be made up of multiple consonants, such as the "ch" in "chair" or "st" in "stand" (e.g. "chair" -> "airchay").
- **Rule 3**: If a word starts with a consonant sound followed by "qu", move it to the end of the word, and then add an "ay" sound to the end of the word (e.g. "square" -> "aresquay").
- **Rule 4**: If a word contains a "y" after a consonant cluster or as the second letter in a two letter word it makes a vowel sound (e.g. "rhythm" -> "ythmrhay", "my" -> "ymay").

There are a few more rules for edge cases, and there are regional variants too.
Check the tests for all the details.

Read more about [Pig Latin on Wikipedia][pig-latin].

Expand Down
2 changes: 1 addition & 1 deletion exercises/secret-handshake/metadata.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
title = "Secret Handshake"
blurb = "Given a decimal number, convert it to the appropriate sequence of events for a secret handshake."
source = "Bert, in Mary Poppins"
source_url = "https://www.imdb.com/title/tt0058331/quotes/qt0437047"
source_url = "https://www.imdb.com/title/tt0058331/quotes/?item=qt0437047"

0 comments on commit bbf2c46

Please sign in to comment.