diff --git a/_tools/concepts-practice.red b/_tools/concepts-practice.red index 6244f04..69ff564 100644 --- a/_tools/concepts-practice.red +++ b/_tools/concepts-practice.red @@ -5,8 +5,8 @@ Red [ config: load %../config.json -concepts-practice: #() -concepts-unlock: #() +concepts-practice: #[] +concepts-unlock: #[] append-concept: function [ type [word!] diff --git a/_tools/generate-practice-exercise.red b/_tools/generate-practice-exercise.red index 0d233e3..f562515 100644 --- a/_tools/generate-practice-exercise.red +++ b/_tools/generate-practice-exercise.red @@ -101,7 +101,7 @@ canonical-data: either map? canonical-data: try [ ] [ canonical-data ] [ - #( cases: []) + #[ cases: []] ] camel-to-kebab-case: function [ diff --git a/exercises/practice/acronym/acronym-test.red b/exercises/practice/acronym/acronym-test.red index 43547cc..75241cb 100644 --- a/exercises/practice/acronym/acronym-test.red +++ b/exercises/practice/acronym/acronym-test.red @@ -8,79 +8,79 @@ Red [ test-init/limit %acronym.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "basic" - input: #( + input: #[ phrase: "Portable Network Graphics" - ) + ] expected: "PNG" function: "abbreviate" uuid: "1e22cceb-c5e4-4562-9afe-aef07ad1eaf4" -) #( +] #[ description: "lowercase words" - input: #( + input: #[ phrase: "Ruby on Rails" - ) + ] expected: "ROR" function: "abbreviate" uuid: "79ae3889-a5c0-4b01-baf0-232d31180c08" -) #( +] #[ description: "punctuation" - input: #( + input: #[ phrase: "First In, First Out" - ) + ] expected: "FIFO" function: "abbreviate" uuid: "ec7000a7-3931-4a17-890e-33ca2073a548" -) #( +] #[ description: "all caps word" - input: #( + input: #[ phrase: "GNU Image Manipulation Program" - ) + ] expected: "GIMP" function: "abbreviate" uuid: "32dd261c-0c92-469a-9c5c-b192e94a63b0" -) #( +] #[ description: "punctuation without whitespace" - input: #( + input: #[ phrase: "Complementary metal-oxide semiconductor" - ) + ] expected: "CMOS" function: "abbreviate" uuid: "ae2ac9fa-a606-4d05-8244-3bcc4659c1d4" -) #( +] #[ description: "very long abbreviation" - input: #( + input: #[ phrase: {Rolling On The Floor Laughing So Hard That My Dogs Came Over And Licked Me} - ) + ] expected: "ROTFLSHTMDCOALM" function: "abbreviate" uuid: "0e4b1e7c-1a6d-48fb-81a7-bf65eb9e69f9" -) #( +] #[ description: "consecutive delimiters" - input: #( + input: #[ phrase: "Something - I made up from thin air" - ) + ] expected: "SIMUFTA" function: "abbreviate" uuid: "6a078f49-c68d-4b7b-89af-33a1a98c28cc" -) #( +] #[ description: "apostrophes" - input: #( + input: #[ phrase: "Halley's Comet" - ) + ] expected: "HC" function: "abbreviate" uuid: "5118b4b1-4572-434c-8d57-5b762e57973e" -) #( +] #[ description: "underscore emphasis" - input: #( + input: #[ phrase: "The Road _Not_ Taken" - ) + ] expected: "TRNT" function: "abbreviate" uuid: "adc12eab-ec2d-414f-b48c-66a4fc06cdef" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/binary-search/binary-search-test.red b/exercises/practice/binary-search/binary-search-test.red index f3c4934..5816cac 100644 --- a/exercises/practice/binary-search/binary-search-test.red +++ b/exercises/practice/binary-search/binary-search-test.red @@ -8,116 +8,116 @@ Red [ test-init/limit %binary-search.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "finds a value in an array with one element" - input: #( + input: #[ array: [6] value: 6 - ) + ] expected: 1 function: "find" uuid: "b55c24a9-a98d-4379-a08c-2adcf8ebeee8" -) #( +] #[ description: "finds a value in the middle of an array" - input: #( + input: #[ array: [1 3 4 6 8 9 11] value: 6 - ) + ] expected: 4 function: "find" uuid: "73469346-b0a0-4011-89bf-989e443d503d" -) #( +] #[ description: "finds a value at the beginning of an array" - input: #( + input: #[ array: [1 3 4 6 8 9 11] value: 1 - ) + ] expected: 1 function: "find" uuid: "327bc482-ab85-424e-a724-fb4658e66ddb" -) #( +] #[ description: "finds a value at the end of an array" - input: #( + input: #[ array: [1 3 4 6 8 9 11] value: 11 - ) + ] expected: 7 function: "find" uuid: "f9f94b16-fe5e-472c-85ea-c513804c7d59" -) #( +] #[ description: "finds a value in an array of odd length" - input: #( + input: #[ array: [1 3 5 8 13 21 34 55 89 144 233 377 634] value: 144 - ) + ] expected: 10 function: "find" uuid: "f0068905-26e3-4342-856d-ad153cadb338" -) #( +] #[ description: "finds a value in an array of even length" - input: #( + input: #[ array: [1 3 5 8 13 21 34 55 89 144 233 377] value: 21 - ) + ] expected: 6 function: "find" uuid: "fc316b12-c8b3-4f5e-9e89-532b3389de8c" -) #( +] #[ description: {identifies that a value is not included in the array} - input: #( + input: #[ array: [1 3 4 6 8 9 11] value: 7 - ) - expected: #( + ] + expected: #[ error: "value not in array" - ) + ] function: "find" uuid: "da7db20a-354f-49f7-a6a1-650a54998aa6" -) #( +] #[ description: {a value smaller than the array's smallest value is not found} - input: #( + input: #[ array: [1 3 4 6 8 9 11] value: 0 - ) - expected: #( + ] + expected: #[ error: "value not in array" - ) + ] function: "find" uuid: "95d869ff-3daf-4c79-b622-6e805c675f97" -) #( +] #[ description: {a value larger than the array's largest value is not found} - input: #( + input: #[ array: [1 3 4 6 8 9 11] value: 13 - ) - expected: #( + ] + expected: #[ error: "value not in array" - ) + ] function: "find" uuid: "8b24ef45-6e51-4a94-9eac-c2bf38fdb0ba" -) #( +] #[ description: "nothing is found in an empty array" - input: #( + input: #[ array: [] value: 1 - ) - expected: #( + ] + expected: #[ error: "value not in array" - ) + ] function: "find" uuid: "f439a0fa-cf42-4262-8ad1-64bf41ce566a" -) #( +] #[ description: {nothing is found when the left and right bounds cross} - input: #( + input: #[ array: [1 2] value: 0 - ) - expected: #( + ] + expected: #[ error: "value not in array" - ) + ] function: "find" uuid: "2c353967-b56d-40b8-acff-ce43115eed64" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/bowling/bowling-test.red b/exercises/practice/bowling/bowling-test.red index 71d3770..924b544 100644 --- a/exercises/practice/bowling/bowling-test.red +++ b/exercises/practice/bowling/bowling-test.red @@ -8,295 +8,295 @@ Red [ test-init/limit %bowling.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "should be able to score a game with all zeros" - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] - ) + ] expected: 0 function: "score" uuid: "656ae006-25c2-438c-a549-f338e7ec7441" -) #( +] #[ description: {should be able to score a game with no strikes or spares} - input: #( + input: #[ previousRolls: [3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6 3 6] - ) + ] expected: 90 function: "score" uuid: "f85dcc56-cd6b-4875-81b3-e50921e3597b" -) #( +] #[ description: "a spare followed by zeros is worth ten points" - input: #( + input: #[ previousRolls: [6 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] - ) + ] expected: 10 function: "score" uuid: "d1f56305-3ac2-4fe0-8645-0b37e3073e20" -) #( +] #[ description: {points scored in the roll after a spare are counted twice} - input: #( + input: #[ previousRolls: [6 4 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] - ) + ] expected: 16 function: "score" uuid: "0b8c8bb7-764a-4287-801a-f9e9012f8be4" -) #( +] #[ description: "consecutive spares each get a one roll bonus" - input: #( + input: #[ previousRolls: [5 5 3 7 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] - ) + ] expected: 31 function: "score" uuid: "4d54d502-1565-4691-84cd-f29a09c65bea" -) #( +] #[ description: {a spare in the last frame gets a one roll bonus that is counted once} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 3 7] - ) + ] expected: 17 function: "score" uuid: "e5c9cf3d-abbe-4b74-ad48-34051b2b08c0" -) #( +] #[ description: {a strike earns ten points in a frame with a single roll} - input: #( + input: #[ previousRolls: [10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] - ) + ] expected: 10 function: "score" uuid: "75269642-2b34-4b72-95a4-9be28ab16902" -) #( +] #[ description: {points scored in the two rolls after a strike are counted twice as a bonus} - input: #( + input: #[ previousRolls: [10 5 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] - ) + ] expected: 26 function: "score" uuid: "037f978c-5d01-4e49-bdeb-9e20a2e6f9a6" -) #( +] #[ description: "consecutive strikes each get the two roll bonus" - input: #( + input: #[ previousRolls: [10 10 10 5 3 0 0 0 0 0 0 0 0 0 0 0 0] - ) + ] expected: 81 function: "score" uuid: "1635e82b-14ec-4cd1-bce4-4ea14bd13a49" -) #( +] #[ description: {a strike in the last frame gets a two roll bonus that is counted once} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 7 1] - ) + ] expected: 18 function: "score" uuid: "e483e8b6-cb4b-4959-b310-e3982030d766" -) #( +] #[ description: {rolling a spare with the two roll bonus does not get a bonus roll} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 7 3] - ) + ] expected: 20 function: "score" uuid: "9d5c87db-84bc-4e01-8e95-53350c8af1f8" -) #( +] #[ description: {strikes with the two roll bonus do not get bonus rolls} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 10 10] - ) + ] expected: 30 function: "score" uuid: "576faac1-7cff-4029-ad72-c16bcada79b5" -) #( +] #[ description: {last two strikes followed by only last bonus with non strike points} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 10 0 1] - ) + ] expected: 31 function: "score" uuid: "efb426ec-7e15-42e6-9b96-b4fca3ec2359" -) #( +] #[ description: {a strike with the one roll bonus after a spare in the last frame does not get a bonus} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 3 10] - ) + ] expected: 20 function: "score" uuid: "72e24404-b6c6-46af-b188-875514c0377b" -) #( +] #[ description: "all strikes is a perfect game" - input: #( + input: #[ previousRolls: [10 10 10 10 10 10 10 10 10 10 10 10] - ) + ] expected: 300 function: "score" uuid: "62ee4c72-8ee8-4250-b794-234f1fec17b1" -) #( +] #[ description: "rolls cannot score negative points" - input: #( + input: #[ previousRolls: [] roll: -1 - ) - expected: #( + ] + expected: #[ error: "Negative roll is invalid" - ) + ] function: "roll" uuid: "1245216b-19c6-422c-b34b-6e4012d7459f" -) #( +] #[ description: "a roll cannot score more than 10 points" - input: #( + input: #[ previousRolls: [] roll: 11 - ) - expected: #( + ] + expected: #[ error: "Pin count exceeds pins on the lane" - ) + ] function: "roll" uuid: "5fcbd206-782c-4faa-8f3a-be5c538ba841" -) #( +] #[ description: {two rolls in a frame cannot score more than 10 points} - input: #( + input: #[ previousRolls: [5] roll: 6 - ) - expected: #( + ] + expected: #[ error: "Pin count exceeds pins on the lane" - ) + ] function: "roll" uuid: "fb023c31-d842-422d-ad7e-79ce1db23c21" -) #( +] #[ description: {bonus roll after a strike in the last frame cannot score more than 10 points} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10] roll: 11 - ) - expected: #( + ] + expected: #[ error: "Pin count exceeds pins on the lane" - ) + ] function: "roll" uuid: "6082d689-d677-4214-80d7-99940189381b" -) #( +] #[ description: {two bonus rolls after a strike in the last frame cannot score more than 10 points} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 5] roll: 6 - ) - expected: #( + ] + expected: #[ error: "Pin count exceeds pins on the lane" - ) + ] function: "roll" uuid: "e9565fe6-510a-4675-ba6b-733a56767a45" -) #( +] #[ description: {two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 10 6] - ) + ] expected: 26 function: "score" uuid: "2f6acf99-448e-4282-8103-0b9c7df99c3d" -) #( +] #[ description: {the second bonus rolls after a strike in the last frame cannot be a strike if the first one is not a strike} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 6] roll: 10 - ) - expected: #( + ] + expected: #[ error: "Pin count exceeds pins on the lane" - ) + ] function: "roll" uuid: "6380495a-8bc4-4cdb-a59f-5f0212dbed01" -) #( +] #[ description: {second bonus roll after a strike in the last frame cannot score more than 10 points} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 10] roll: 11 - ) - expected: #( + ] + expected: #[ error: "Pin count exceeds pins on the lane" - ) + ] function: "roll" uuid: "2b2976ea-446c-47a3-9817-42777f09fe7e" -) #( +] #[ description: "an unstarted game cannot be scored" - input: #( + input: #[ previousRolls: [] - ) - expected: #( + ] + expected: #[ error: "Score cannot be taken until the end of the game" - ) + ] function: "score" uuid: "29220245-ac8d-463d-bc19-98a94cfada8a" -) #( +] #[ description: "an incomplete game cannot be scored" - input: #( + input: #[ previousRolls: [0 0] - ) - expected: #( + ] + expected: #[ error: "Score cannot be taken until the end of the game" - ) + ] function: "score" uuid: "4473dc5d-1f86-486f-bf79-426a52ddc955" -) #( +] #[ description: "cannot roll if game already has ten frames" - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] roll: 0 - ) - expected: #( + ] + expected: #[ error: "Cannot roll after game is over" - ) + ] function: "roll" uuid: "2ccb8980-1b37-4988-b7d1-e5701c317df3" -) #( +] #[ description: {bonus rolls for a strike in the last frame must be rolled before score can be calculated} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10] - ) - expected: #( + ] + expected: #[ error: "Score cannot be taken until the end of the game" - ) + ] function: "score" uuid: "4864f09b-9df3-4b65-9924-c595ed236f1b" -) #( +] #[ description: {both bonus rolls for a strike in the last frame must be rolled before score can be calculated} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 10] - ) - expected: #( + ] + expected: #[ error: "Score cannot be taken until the end of the game" - ) + ] function: "score" uuid: "537f4e37-4b51-4d1c-97e2-986eb37b2ac1" -) #( +] #[ description: {bonus roll for a spare in the last frame must be rolled before score can be calculated} - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 3] - ) - expected: #( + ] + expected: #[ error: "Score cannot be taken until the end of the game" - ) + ] function: "score" uuid: "8134e8c1-4201-4197-bf9f-1431afcde4b9" -) #( +] #[ description: "cannot roll after bonus roll for spare" - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 3 2] roll: 2 - ) - expected: #( + ] + expected: #[ error: "Cannot roll after game is over" - ) + ] function: "roll" uuid: "9d4a9a55-134a-4bad-bae8-3babf84bd570" -) #( +] #[ description: "cannot roll after bonus rolls for strike" - input: #( + input: #[ previousRolls: [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 10 3 2] roll: 2 - ) - expected: #( + ] + expected: #[ error: "Cannot roll after game is over" - ) + ] function: "roll" uuid: "d3e02652-a799-4ae3-b53b-68582cc604be" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/circular-buffer/circular-buffer-test.red b/exercises/practice/circular-buffer/circular-buffer-test.red index 468c52b..34e7e14 100644 --- a/exercises/practice/circular-buffer/circular-buffer-test.red +++ b/exercises/practice/circular-buffer/circular-buffer-test.red @@ -8,133 +8,133 @@ Red [ test-init/limit %circular-buffer.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "reading empty buffer should fail" - input: #( + input: #[ capacity: 1 operations: [read] - ) + ] expected: [false] function: "run" uuid: "28268ed4-4ff3-45f3-820e-895b44d53dfa" -) #( +] #[ description: "can read an item just written" - input: #( + input: #[ capacity: 1 operations: [write 1 read] - ) + ] expected: [true 1] function: "run" uuid: "2e6db04a-58a1-425d-ade8-ac30b5f318f3" -) #( +] #[ description: "each item may only be read once" - input: #( + input: #[ capacity: 1 operations: [write 1 read read] - ) + ] expected: [true 1 false] function: "run" uuid: "90741fe8-a448-45ce-be2b-de009a24c144" -) #( +] #[ description: "items are read in the order they are written" - input: #( + input: #[ capacity: 2 operations: [write 1 write 2 read read] - ) + ] expected: [true true 1 2] function: "run" uuid: "be0e62d5-da9c-47a8-b037-5db21827baa7" -) #( +] #[ description: "full buffer can't be written to" - input: #( + input: #[ capacity: 1 operations: [write 1 write 2] - ) + ] expected: [true false] function: "run" uuid: "2af22046-3e44-4235-bfe6-05ba60439d38" -) #( +] #[ description: "a read frees up capacity for another write" - input: #( + input: #[ capacity: 1 operations: [write 1 read write 2 read] - ) + ] expected: [true 1 true 2] function: "run" uuid: "547d192c-bbf0-4369-b8fa-fc37e71f2393" -) #( +] #[ description: {read position is maintained even across multiple writes} - input: #( + input: #[ capacity: 3 operations: [write 1 write 2 read write 3 read read] - ) + ] expected: [true true 1 true 2 3] function: "run" uuid: "04a56659-3a81-4113-816b-6ecb659b4471" -) #( +] #[ description: "items cleared out of buffer can't be read" - input: #( + input: #[ capacity: 1 operations: [write 1 clear read] - ) + ] expected: [true false] function: "run" uuid: "60c3a19a-81a7-43d7-bb0a-f07242b1111f" -) #( +] #[ description: "clear frees up capacity for another write" - input: #( + input: #[ capacity: 1 operations: [write 1 clear write 2 read] - ) + ] expected: [true true 2] function: "run" uuid: "45f3ae89-3470-49f3-b50e-362e4b330a59" -) #( +] #[ description: "clear does nothing on empty buffer" - input: #( + input: #[ capacity: 1 operations: [clear write 1 read] - ) + ] expected: [true 1] function: "run" uuid: "e1ac5170-a026-4725-bfbe-0cf332eddecd" -) #( +] #[ description: "overwrite acts like write on non-full buffer" - input: #( + input: #[ capacity: 2 operations: [write 1 overwrite 2 read read] - ) + ] expected: [true 1 2] function: "run" uuid: "9c2d4f26-3ec7-453f-a895-7e7ff8ae7b5b" -) #( +] #[ description: "overwrite replaces the oldest item on full buffer" - input: #( + input: #[ capacity: 2 operations: [write 1 write 2 overwrite 3 read read] - ) + ] expected: [true true 2 3] function: "run" uuid: "880f916b-5039-475c-bd5c-83463c36a147" -) #( +] #[ description: {overwrite replaces the oldest item remaining in buffer following a read} - input: #( + input: #[ capacity: 3 operations: [write 1 write 2 write 3 read write 4 overwrite 5 read read read] - ) + ] expected: [true true true 1 true 3 4 5] function: "run" uuid: "bfecab5b-aca1-4fab-a2b0-cd4af2b053c3" -) #( +] #[ description: "initial clear does not affect wrapping around" - input: #( + input: #[ capacity: 2 operations: [clear write 1 write 2 overwrite 3 overwrite 4 read read read] - ) + ] expected: [true true 3 4 false] function: "run" uuid: "9cebe63a-c405-437b-8b62-e3fdc1ecec5a" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/collatz-conjecture/collatz-conjecture-test.red b/exercises/practice/collatz-conjecture/collatz-conjecture-test.red index 2a12f48..d0c4093 100644 --- a/exercises/practice/collatz-conjecture/collatz-conjecture-test.red +++ b/exercises/practice/collatz-conjecture/collatz-conjecture-test.red @@ -8,59 +8,59 @@ Red [ test-init/limit %collatz-conjecture.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "zero steps for one" - input: #( + input: #[ number: 1 - ) + ] expected: 0 function: "steps" uuid: "540a3d51-e7a6-47a5-92a3-4ad1838f0bfd" -) #( +] #[ description: "divide if even" - input: #( + input: #[ number: 16 - ) + ] expected: 4 function: "steps" uuid: "3d76a0a6-ea84-444a-821a-f7857c2c1859" -) #( +] #[ description: "even and odd steps" - input: #( + input: #[ number: 12 - ) + ] expected: 9 function: "steps" uuid: "754dea81-123c-429e-b8bc-db20b05a87b9" -) #( +] #[ description: "large number of even and odd steps" - input: #( + input: #[ number: 1000000 - ) + ] expected: 152 function: "steps" uuid: "ecfd0210-6f85-44f6-8280-f65534892ff6" -) #( +] #[ description: "zero is an error" - input: #( + input: #[ number: 0 - ) - expected: #( + ] + expected: #[ error: "Only positive integers are allowed" - ) + ] function: "steps" uuid: "2187673d-77d6-4543-975e-66df6c50e2da" -) #( +] #[ description: "negative value is an error" - input: #( + input: #[ number: -15 - ) - expected: #( + ] + expected: #[ error: "Only positive integers are allowed" - ) + ] function: "steps" uuid: "ec11f479-56bc-47fd-a434-bcd7a31a7a2e" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/darts/darts-test.red b/exercises/practice/darts/darts-test.red index 104dc64..141cea7 100644 --- a/exercises/practice/darts/darts-test.red +++ b/exercises/practice/darts/darts-test.red @@ -8,124 +8,124 @@ Red [ test-init/limit %darts.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "Missed target" - input: #( + input: #[ x: -9 y: 9 - ) + ] expected: 0 function: "score" uuid: "9033f731-0a3a-4d9c-b1c0-34a1c8362afb" -) #( +] #[ description: "On the outer circle" - input: #( + input: #[ x: 0 y: 10 - ) + ] expected: 1 function: "score" uuid: "4c9f6ff4-c489-45fd-be8a-1fcb08b4d0ba" -) #( +] #[ description: "On the middle circle" - input: #( + input: #[ x: -5 y: 0 - ) + ] expected: 5 function: "score" uuid: "14378687-ee58-4c9b-a323-b089d5274be8" -) #( +] #[ description: "On the inner circle" - input: #( + input: #[ x: 0 y: -1 - ) + ] expected: 10 function: "score" uuid: "849e2e63-85bd-4fed-bc3b-781ae962e2c9" -) #( +] #[ description: "Exactly on centre" - input: #( + input: #[ x: 0 y: 0 - ) + ] expected: 10 function: "score" uuid: "1c5ffd9f-ea66-462f-9f06-a1303de5a226" -) #( +] #[ description: "Near the centre" - input: #( + input: #[ x: -0.1 y: -0.1 - ) + ] expected: 10 function: "score" uuid: "b65abce3-a679-4550-8115-4b74bda06088" -) #( +] #[ description: "Just within the inner circle" - input: #( + input: #[ x: 0.7 y: 0.7 - ) + ] expected: 10 function: "score" uuid: "66c29c1d-44f5-40cf-9927-e09a1305b399" -) #( +] #[ description: "Just outside the inner circle" - input: #( + input: #[ x: 0.8 y: -0.8 - ) + ] expected: 5 function: "score" uuid: "d1012f63-c97c-4394-b944-7beb3d0b141a" -) #( +] #[ description: "Just within the middle circle" - input: #( + input: #[ x: -3.5 y: 3.5 - ) + ] expected: 5 function: "score" uuid: "ab2b5666-b0b4-49c3-9b27-205e790ed945" -) #( +] #[ description: "Just outside the middle circle" - input: #( + input: #[ x: -3.6 y: -3.6 - ) + ] expected: 1 function: "score" uuid: "70f1424e-d690-4860-8caf-9740a52c0161" -) #( +] #[ description: "Just within the outer circle" - input: #( + input: #[ x: -7.0 y: 7.0 - ) + ] expected: 1 function: "score" uuid: "a7dbf8db-419c-4712-8a7f-67602b69b293" -) #( +] #[ description: "Just outside the outer circle" - input: #( + input: #[ x: 7.1 y: -7.1 - ) + ] expected: 0 function: "score" uuid: "e0f39315-9f9a-4546-96e4-a9475b885aa7" -) #( +] #[ description: {Asymmetric position between the inner and middle circles} - input: #( + input: #[ x: 0.5 y: -4 - ) + ] expected: 5 function: "score" uuid: "045d7d18-d863-4229-818e-b50828c75d19" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/difference-of-squares/difference-of-squares-test.red b/exercises/practice/difference-of-squares/difference-of-squares-test.red index 4126026..3f09591 100644 --- a/exercises/practice/difference-of-squares/difference-of-squares-test.red +++ b/exercises/practice/difference-of-squares/difference-of-squares-test.red @@ -8,79 +8,79 @@ Red [ test-init/limit %difference-of-squares.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "square of sum 1" - input: #( + input: #[ number: 1 - ) + ] expected: 1 function: "square-of-sum" uuid: "e46c542b-31fc-4506-bcae-6b62b3268537" -) #( +] #[ description: "square of sum 5" - input: #( + input: #[ number: 5 - ) + ] expected: 225 function: "square-of-sum" uuid: "9b3f96cb-638d-41ee-99b7-b4f9c0622948" -) #( +] #[ description: "square of sum 100" - input: #( + input: #[ number: 100 - ) + ] expected: 25502500 function: "square-of-sum" uuid: "54ba043f-3c35-4d43-86ff-3a41625d5e86" -) #( +] #[ description: "sum of squares 1" - input: #( + input: #[ number: 1 - ) + ] expected: 1 function: "sum-of-squares" uuid: "01d84507-b03e-4238-9395-dd61d03074b5" -) #( +] #[ description: "sum of squares 5" - input: #( + input: #[ number: 5 - ) + ] expected: 55 function: "sum-of-squares" uuid: "c93900cd-8cc2-4ca4-917b-dd3027023499" -) #( +] #[ description: "sum of squares 100" - input: #( + input: #[ number: 100 - ) + ] expected: 338350 function: "sum-of-squares" uuid: "94807386-73e4-4d9e-8dec-69eb135b19e4" -) #( +] #[ description: "difference of squares 1" - input: #( + input: #[ number: 1 - ) + ] expected: 0 function: "difference-of-squares" uuid: "44f72ae6-31a7-437f-858d-2c0837adabb6" -) #( +] #[ description: "difference of squares 5" - input: #( + input: #[ number: 5 - ) + ] expected: 170 function: "difference-of-squares" uuid: "005cb2bf-a0c8-46f3-ae25-924029f8b00b" -) #( +] #[ description: "difference of squares 100" - input: #( + input: #[ number: 100 - ) + ] expected: 25164150 function: "difference-of-squares" uuid: "b1bf19de-9a16-41c0-a62b-1f02ecc0b036" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/eliuds-eggs/eliuds-eggs-test.red b/exercises/practice/eliuds-eggs/eliuds-eggs-test.red index 4ce30c5..ac3b917 100644 --- a/exercises/practice/eliuds-eggs/eliuds-eggs-test.red +++ b/exercises/practice/eliuds-eggs/eliuds-eggs-test.red @@ -8,39 +8,39 @@ Red [ test-init/limit %eliuds-eggs.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "0 eggs" - input: #( + input: #[ number: 0 - ) + ] expected: 0 function: "egg-count" uuid: "559e789d-07d1-4422-9004-3b699f83bca3" -) #( +] #[ description: "1 egg" - input: #( + input: #[ number: 16 - ) + ] expected: 1 function: "egg-count" uuid: "97223282-f71e-490c-92f0-b3ec9e275aba" -) #( +] #[ description: "4 eggs" - input: #( + input: #[ number: 89 - ) + ] expected: 4 function: "egg-count" uuid: "1f8fd18f-26e9-4144-9a0e-57cdfc4f4ff5" -) #( +] #[ description: "13 eggs" - input: #( + input: #[ number: 2000000000 - ) + ] expected: 13 function: "egg-count" uuid: "0c18be92-a498-4ef2-bcbb-28ac4b06cb81" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/grains/grains-test.red b/exercises/practice/grains/grains-test.red index 445a2ef..755db20 100644 --- a/exercises/practice/grains/grains-test.red +++ b/exercises/practice/grains/grains-test.red @@ -8,99 +8,99 @@ Red [ test-init/limit %grains.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "grains on square 1" - input: #( + input: #[ square: 1 - ) + ] expected: 1 function: "square" uuid: "9fbde8de-36b2-49de-baf2-cd42d6f28405" -) #( +] #[ description: "grains on square 2" - input: #( + input: #[ square: 2 - ) + ] expected: 2 function: "square" uuid: "ee1f30c2-01d8-4298-b25d-c677331b5e6d" -) #( +] #[ description: "grains on square 3" - input: #( + input: #[ square: 3 - ) + ] expected: 4 function: "square" uuid: "10f45584-2fc3-4875-8ec6-666065d1163b" -) #( +] #[ description: "grains on square 4" - input: #( + input: #[ square: 4 - ) + ] expected: 8 function: "square" uuid: "a7cbe01b-36f4-4601-b053-c5f6ae055170" -) #( +] #[ description: "grains on square 16" - input: #( + input: #[ square: 16 - ) + ] expected: 32768 function: "square" uuid: "c50acc89-8535-44e4-918f-b848ad2817d4" -) #( +] #[ description: "grains on square 32" - input: #( + input: #[ square: 32 - ) + ] expected: 2147483648.0 function: "square" uuid: "acd81b46-c2ad-4951-b848-80d15ed5a04f" -) #( +] #[ description: "grains on square 64" - input: #( + input: #[ square: 64 - ) + ] expected: 9.223372036854776e18 function: "square" uuid: "c73b470a-5efb-4d53-9ac6-c5f6487f227b" -) #( +] #[ description: "square 0 is invalid" - input: #( + input: #[ square: 0 - ) - expected: #( + ] + expected: #[ error: "square must be between 1 and 64" - ) + ] function: "square" uuid: "1d47d832-3e85-4974-9466-5bd35af484e3" -) #( +] #[ description: "negative square is invalid" - input: #( + input: #[ square: -1 - ) - expected: #( + ] + expected: #[ error: "square must be between 1 and 64" - ) + ] function: "square" uuid: "61974483-eeb2-465e-be54-ca5dde366453" -) #( +] #[ description: "square greater than 64 is invalid" - input: #( + input: #[ square: 65 - ) - expected: #( + ] + expected: #[ error: "square must be between 1 and 64" - ) + ] function: "square" uuid: "a95e4374-f32c-45a7-a10d-ffec475c012f" -) #( +] #[ description: "returns the total number of grains on the board" - input: #() + input: #[] expected: 18446744073709551615 function: "total" uuid: "6eb07385-3659-4b45-a6be-9dc474222750" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/hamming/hamming-test.red b/exercises/practice/hamming/hamming-test.red index 4bd0e57..918f062 100644 --- a/exercises/practice/hamming/hamming-test.red +++ b/exercises/practice/hamming/hamming-test.red @@ -8,96 +8,96 @@ Red [ test-init/limit %hamming.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "empty strands" - input: #( + input: #[ strand1: "" strand2: "" - ) + ] expected: 0 function: "distance" uuid: "f6dcb64f-03b0-4b60-81b1-3c9dbf47e887" -) #( +] #[ description: "single letter identical strands" - input: #( + input: #[ strand1: "A" strand2: "A" - ) + ] expected: 0 function: "distance" uuid: "54681314-eee2-439a-9db0-b0636c656156" -) #( +] #[ description: "single letter different strands" - input: #( + input: #[ strand1: "G" strand2: "T" - ) + ] expected: 1 function: "distance" uuid: "294479a3-a4c8-478f-8d63-6209815a827b" -) #( +] #[ description: "long identical strands" - input: #( + input: #[ strand1: "GGACTGAAATCTG" strand2: "GGACTGAAATCTG" - ) + ] expected: 0 function: "distance" uuid: "9aed5f34-5693-4344-9b31-40c692fb5592" -) #( +] #[ description: "long different strands" - input: #( + input: #[ strand1: "GGACGGATTCTG" strand2: "AGGACGGATTCT" - ) + ] expected: 9 function: "distance" uuid: "cd2273a5-c576-46c8-a52b-dee251c3e6e5" -) #( +] #[ description: "disallow first strand longer" - input: #( + input: #[ strand1: "AATG" strand2: "AAA" - ) - expected: #( + ] + expected: #[ error: "strands must be of equal length" - ) + ] function: "distance" uuid: "b9228bb1-465f-4141-b40f-1f99812de5a8" -) #( +] #[ description: "disallow second strand longer" - input: #( + input: #[ strand1: "ATA" strand2: "AGTG" - ) - expected: #( + ] + expected: #[ error: "strands must be of equal length" - ) + ] function: "distance" uuid: "dab38838-26bb-4fff-acbe-3b0a9bfeba2d" -) #( +] #[ description: "disallow empty first strand" - input: #( + input: #[ strand1: "" strand2: "G" - ) - expected: #( + ] + expected: #[ error: "strands must be of equal length" - ) + ] function: "distance" uuid: "b764d47c-83ff-4de2-ab10-6cfe4b15c0f3" -) #( +] #[ description: "disallow empty second strand" - input: #( + input: #[ strand1: "G" strand2: "" - ) - expected: #( + ] + expected: #[ error: "strands must be of equal length" - ) + ] function: "distance" uuid: "9ab9262f-3521-4191-81f5-0ed184a5aa89" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/hello-world/hello-world-test.red b/exercises/practice/hello-world/hello-world-test.red index 5264aa6..c4e7d73 100644 --- a/exercises/practice/hello-world/hello-world-test.red +++ b/exercises/practice/hello-world/hello-world-test.red @@ -8,13 +8,13 @@ Red [ test-init/limit %hello-world.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "Say Hi!" - input: #() + input: #[] expected: "Hello, World!" function: "hello" uuid: "af9ffe10-dc13-42d8-a742-e7bdafac449d" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/high-scores/high-scores-test.red b/exercises/practice/high-scores/high-scores-test.red index c09b97e..9dc6c8f 100644 --- a/exercises/practice/high-scores/high-scores-test.red +++ b/exercises/practice/high-scores/high-scores-test.red @@ -8,71 +8,71 @@ Red [ test-init/limit %high-scores.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "List of scores" - input: #( + input: #[ scores: [30 50 20 70] - ) + ] expected: [30 50 20 70] function: "scores" uuid: "1035eb93-2208-4c22-bab8-fef06769a73c" -) #( +] #[ description: "Latest score" - input: #( + input: #[ scores: [100 0 90 30] - ) + ] expected: 30 function: "latest" uuid: "6aa5dbf5-78fa-4375-b22c-ffaa989732d2" -) #( +] #[ description: "Personal best" - input: #( + input: #[ scores: [40 100 70] - ) + ] expected: 100 function: "personal-best" uuid: "b661a2e1-aebf-4f50-9139-0fb817dd12c6" -) #( +] #[ description: "Personal top three from a list of scores" - input: #( + input: #[ scores: [10 30 90 30 100 20 10 0 30 40 40 70 70] - ) + ] expected: [100 90 70] function: "personal-top-three" uuid: "3d996a97-c81c-4642-9afc-80b80dc14015" -) #( +] #[ description: "Personal top highest to lowest" - input: #( + input: #[ scores: [20 10 30] - ) + ] expected: [30 20 10] function: "personal-top-three" uuid: "1084ecb5-3eb4-46fe-a816-e40331a4e83a" -) #( +] #[ description: "Personal top when there is a tie" - input: #( + input: #[ scores: [40 20 40 30] - ) + ] expected: [40 40 30] function: "personal-top-three" uuid: "e6465b6b-5a11-4936-bfe3-35241c4f4f16" -) #( +] #[ description: "Personal top when there are less than 3" - input: #( + input: #[ scores: [30 70] - ) + ] expected: [70 30] function: "personal-top-three" uuid: "f73b02af-c8fd-41c9-91b9-c86eaa86bce2" -) #( +] #[ description: "Personal top when there is only one" - input: #( + input: #[ scores: [40] - ) + ] expected: [40] function: "personal-top-three" uuid: "16608eae-f60f-4a88-800e-aabce5df2865" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/largest-series-product/largest-series-product-test.red b/exercises/practice/largest-series-product/largest-series-product-test.red index c24eca4..a59ac04 100644 --- a/exercises/practice/largest-series-product/largest-series-product-test.red +++ b/exercises/practice/largest-series-product/largest-series-product-test.red @@ -8,132 +8,132 @@ Red [ test-init/limit %largest-series-product.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "finds the largest product if span equals length" - input: #( + input: #[ digits: "29" span: 2 - ) + ] expected: 18 function: "largest-product" uuid: "7c82f8b7-e347-48ee-8a22-f672323324d4" -) #( +] #[ description: {can find the largest product of 2 with numbers in order} - input: #( + input: #[ digits: "0123456789" span: 2 - ) + ] expected: 72 function: "largest-product" uuid: "88523f65-21ba-4458-a76a-b4aaf6e4cb5e" -) #( +] #[ description: "can find the largest product of 2" - input: #( + input: #[ digits: "576802143" span: 2 - ) + ] expected: 48 function: "largest-product" uuid: "f1376b48-1157-419d-92c2-1d7e36a70b8a" -) #( +] #[ description: {can find the largest product of 3 with numbers in order} - input: #( + input: #[ digits: "0123456789" span: 3 - ) + ] expected: 504 function: "largest-product" uuid: "46356a67-7e02-489e-8fea-321c2fa7b4a4" -) #( +] #[ description: "can find the largest product of 3" - input: #( + input: #[ digits: "1027839564" span: 3 - ) + ] expected: 270 function: "largest-product" uuid: "a2dcb54b-2b8f-4993-92dd-5ce56dece64a" -) #( +] #[ description: {can find the largest product of 5 with numbers in order} - input: #( + input: #[ digits: "0123456789" span: 5 - ) + ] expected: 15120 function: "largest-product" uuid: "673210a3-33cd-4708-940b-c482d7a88f9d" -) #( +] #[ description: "can get the largest product of a big number" - input: #( + input: #[ digits: {73167176531330624919225119674426574742355349194934} span: 6 - ) + ] expected: 23520 function: "largest-product" uuid: "02acd5a6-3bbf-46df-8282-8b313a80a7c9" -) #( +] #[ description: "reports zero if the only digits are zero" - input: #( + input: #[ digits: "0000" span: 2 - ) + ] expected: 0 function: "largest-product" uuid: "76dcc407-21e9-424c-a98e-609f269622b5" -) #( +] #[ description: "reports zero if all spans include zero" - input: #( + input: #[ digits: "99099" span: 3 - ) + ] expected: 0 function: "largest-product" uuid: "6ef0df9f-52d4-4a5d-b210-f6fae5f20e19" -) #( +] #[ description: "rejects span longer than string length" - input: #( + input: #[ digits: "123" span: 4 - ) - expected: #( + ] + expected: #[ error: "span must be smaller than string length" - ) + ] function: "largest-product" uuid: "5d81aaf7-4f67-4125-bf33-11493cc7eab7" -) #( +] #[ description: "rejects empty string and nonzero span" - input: #( + input: #[ digits: "" span: 1 - ) - expected: #( + ] + expected: #[ error: "span must be smaller than string length" - ) + ] function: "largest-product" uuid: "6d96c691-4374-4404-80ee-2ea8f3613dd4" -) #( +] #[ description: "rejects invalid character in digits" - input: #( + input: #[ digits: "1234a5" span: 2 - ) - expected: #( + ] + expected: #[ error: "digits input must only contain digits" - ) + ] function: "largest-product" uuid: "7a38f2d6-3c35-45f6-8d6f-12e6e32d4d74" -) #( +] #[ description: "rejects negative span" - input: #( + input: #[ digits: "12345" span: -1 - ) - expected: #( + ] + expected: #[ error: "span must be greater than zero" - ) + ] function: "largest-product" uuid: "5fe3c0e5-a945-49f2-b584-f0814b4dd1ef" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/leap/leap-test.red b/exercises/practice/leap/leap-test.red index bd116e6..5c0b07b 100644 --- a/exercises/practice/leap/leap-test.red +++ b/exercises/practice/leap/leap-test.red @@ -8,79 +8,79 @@ Red [ test-init/limit %leap.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "year not divisible by 4 in common year" - input: #( + input: #[ year: 2015 - ) + ] expected: false function: "leap" uuid: "6466b30d-519c-438e-935d-388224ab5223" -) #( +] #[ description: "year divisible by 2, not divisible by 4 in common year" - input: #( + input: #[ year: 1970 - ) + ] expected: false function: "leap" uuid: "ac227e82-ee82-4a09-9eb6-4f84331ffdb0" -) #( +] #[ description: "year divisible by 4, not divisible by 100 in leap year" - input: #( + input: #[ year: 1996 - ) + ] expected: true function: "leap" uuid: "4fe9b84c-8e65-489e-970b-856d60b8b78e" -) #( +] #[ description: "year divisible by 4 and 5 is still a leap year" - input: #( + input: #[ year: 1960 - ) + ] expected: true function: "leap" uuid: "7fc6aed7-e63c-48f5-ae05-5fe182f60a5d" -) #( +] #[ description: "year divisible by 100, not divisible by 400 in common year" - input: #( + input: #[ year: 2100 - ) + ] expected: false function: "leap" uuid: "78a7848f-9667-4192-ae53-87b30c9a02dd" -) #( +] #[ description: "year divisible by 100 but not by 3 is still not a leap year" - input: #( + input: #[ year: 1900 - ) + ] expected: false function: "leap" uuid: "9d70f938-537c-40a6-ba19-f50739ce8bac" -) #( +] #[ description: "year divisible by 400 is leap year" - input: #( + input: #[ year: 2000 - ) + ] expected: true function: "leap" uuid: "42ee56ad-d3e6-48f1-8e3f-c84078d916fc" -) #( +] #[ description: "year divisible by 400 but not by 125 is still a leap year" - input: #( + input: #[ year: 2400 - ) + ] expected: true function: "leap" uuid: "57902c77-6fe9-40de-8302-587b5c27121e" -) #( +] #[ description: "year divisible by 400 but not by 125 is still a leap year" - input: #( + input: #[ year: 1800 - ) + ] expected: false function: "leap" uuid: "c30331f6-f9f6-4881-ad38-8ca8c12520c1" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/nucleotide-count/nucleotide-count-test.red b/exercises/practice/nucleotide-count/nucleotide-count-test.red index d5d36a3..1dc1a37 100644 --- a/exercises/practice/nucleotide-count/nucleotide-count-test.red +++ b/exercises/practice/nucleotide-count/nucleotide-count-test.red @@ -8,69 +8,69 @@ Red [ test-init/limit %nucleotide-count.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "empty strand" - input: #( + input: #[ strand: "" - ) - expected: #( + ] + expected: #[ A: 0 C: 0 G: 0 T: 0 - ) + ] function: "nucleotide-counts" uuid: "3e5c30a8-87e2-4845-a815-a49671ade970" -) #( +] #[ description: {can count one nucleotide in single-character input} - input: #( + input: #[ strand: "G" - ) - expected: #( + ] + expected: #[ A: 0 C: 0 G: 1 T: 0 - ) + ] function: "nucleotide-counts" uuid: "a0ea42a6-06d9-4ac6-828c-7ccaccf98fec" -) #( +] #[ description: "strand with repeated nucleotide" - input: #( + input: #[ strand: "GGGGGGG" - ) - expected: #( + ] + expected: #[ A: 0 C: 0 G: 7 T: 0 - ) + ] function: "nucleotide-counts" uuid: "eca0d565-ed8c-43e7-9033-6cefbf5115b5" -) #( +] #[ description: "strand with multiple nucleotides" - input: #( + input: #[ strand: {AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC} - ) - expected: #( + ] + expected: #[ A: 20 C: 12 G: 17 T: 21 - ) + ] function: "nucleotide-counts" uuid: "40a45eac-c83f-4740-901a-20b22d15a39f" -) #( +] #[ description: "strand with invalid nucleotides" - input: #( + input: #[ strand: "AGXXACT" - ) - expected: #( + ] + expected: #[ error: "Invalid nucleotide in strand" - ) + ] function: "nucleotide-counts" uuid: "b4c47851-ee9e-4b0a-be70-a86e343bd851" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/pov/pov-test.red b/exercises/practice/pov/pov-test.red index e1447b3..e8baf95 100644 --- a/exercises/practice/pov/pov-test.red +++ b/exercises/practice/pov/pov-test.red @@ -8,395 +8,395 @@ Red [ test-init/limit %pov.red 1 ; test-init/limit %.meta/example.red 15 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: {Results in the same tree if the input tree is a singleton} - input: #( - tree: #( + input: #[ + tree: #[ label: "x" - ) + ] from: "x" - ) - expected: #( + ] + expected: #[ label: "x" - ) + ] function: "from-pov" uuid: "1b3cd134-49ad-4a7d-8376-7087b7e70792" -) #( +] #[ description: "Can reroot a tree with a parent and one sibling" - input: #( - tree: #( + input: #[ + tree: #[ label: "parent" - children: [#( + children: [#[ label: "x" - ) #( + ] #[ label: "sibling" - )] - ) + ]] + ] from: "x" - ) - expected: #( + ] + expected: #[ label: "x" - children: [#( + children: [#[ label: "parent" - children: [#( + children: [#[ label: "sibling" - )] - )] - ) + ]] + ]] + ] function: "from-pov" uuid: "0778c745-0636-40de-9edd-25a8f40426f6" -) #( +] #[ description: "Can reroot a tree with a parent and many siblings" - input: #( - tree: #( + input: #[ + tree: #[ label: "parent" - children: [#( + children: [#[ label: "a" - ) #( + ] #[ label: "x" - ) #( + ] #[ label: "b" - ) #( + ] #[ label: "c" - )] - ) + ]] + ] from: "x" - ) - expected: #( + ] + expected: #[ label: "x" - children: [#( + children: [#[ label: "parent" - children: [#( + children: [#[ label: "a" - ) #( + ] #[ label: "b" - ) #( + ] #[ label: "c" - )] - )] - ) + ]] + ]] + ] function: "from-pov" uuid: "fdfdef0a-4472-4248-8bcf-19cf33f9c06e" -) #( +] #[ description: {Can reroot a tree with new root deeply nested in tree} - input: #( - tree: #( + input: #[ + tree: #[ label: "level-0" - children: [#( + children: [#[ label: "level-1" - children: [#( + children: [#[ label: "level-2" - children: [#( + children: [#[ label: "level-3" - children: [#( + children: [#[ label: "x" - )] - )] - )] - )] - ) + ]] + ]] + ]] + ]] + ] from: "x" - ) - expected: #( + ] + expected: #[ label: "x" - children: [#( + children: [#[ label: "level-3" - children: [#( + children: [#[ label: "level-2" - children: [#( + children: [#[ label: "level-1" - children: [#( + children: [#[ label: "level-0" - )] - )] - )] - )] - ) + ]] + ]] + ]] + ]] + ] function: "from-pov" uuid: "cbcf52db-8667-43d8-a766-5d80cb41b4bb" -) #( +] #[ description: {Moves children of the new root to same level as former parent} - input: #( - tree: #( + input: #[ + tree: #[ label: "parent" - children: [#( + children: [#[ label: "x" - children: [#( + children: [#[ label: "kid-0" - ) #( + ] #[ label: "kid-1" - )] - )] - ) + ]] + ]] + ] from: "x" - ) - expected: #( + ] + expected: #[ label: "x" - children: [#( + children: [#[ label: "kid-0" - ) #( + ] #[ label: "kid-1" - ) #( + ] #[ label: "parent" - )] - ) + ]] + ] function: "from-pov" uuid: "e27fa4fa-648d-44cd-90af-d64a13d95e06" -) #( +] #[ description: "Can reroot a complex tree with cousins" - input: #( - tree: #( + input: #[ + tree: #[ label: "grandparent" - children: [#( + children: [#[ label: "parent" - children: [#( + children: [#[ label: "x" - children: [#( + children: [#[ label: "kid-0" - ) #( + ] #[ label: "kid-1" - )] - ) #( + ]] + ] #[ label: "sibling-0" - ) #( + ] #[ label: "sibling-1" - )] - ) #( + ]] + ] #[ label: "uncle" - children: [#( + children: [#[ label: "cousin-0" - ) #( + ] #[ label: "cousin-1" - )] - )] - ) + ]] + ]] + ] from: "x" - ) - expected: #( + ] + expected: #[ label: "x" - children: [#( + children: [#[ label: "kid-0" - ) #( + ] #[ label: "kid-1" - ) #( + ] #[ label: "parent" - children: [#( + children: [#[ label: "sibling-0" - ) #( + ] #[ label: "sibling-1" - ) #( + ] #[ label: "grandparent" - children: [#( + children: [#[ label: "uncle" - children: [#( + children: [#[ label: "cousin-0" - ) #( + ] #[ label: "cousin-1" - )] - )] - )] - )] - ) + ]] + ]] + ]] + ]] + ] function: "from-pov" uuid: "09236c7f-7c83-42cc-87a1-25afa60454a3" -) #( +] #[ description: {Errors if target does not exist in a singleton tree} - input: #( - tree: #( + input: #[ + tree: #[ label: "x" - ) + ] from: "nonexistent" - ) + ] expected: none function: "from-pov" uuid: "f41d5eeb-8973-448f-a3b0-cc1e019a4193" -) #( +] #[ description: "Errors if target does not exist in a large tree" - input: #( - tree: #( + input: #[ + tree: #[ label: "parent" - children: [#( + children: [#[ label: "x" - children: [#( + children: [#[ label: "kid-0" - ) #( + ] #[ label: "kid-1" - )] - ) #( + ]] + ] #[ label: "sibling-0" - ) #( + ] #[ label: "sibling-1" - )] - ) + ]] + ] from: "nonexistent" - ) + ] expected: none function: "from-pov" uuid: "9dc0a8b3-df02-4267-9a41-693b6aff75e7" -) #( +] #[ description: "Can find path to parent" - input: #( + input: #[ from: "x" to: "parent" - tree: #( + tree: #[ label: "parent" - children: [#( + children: [#[ label: "x" - ) #( + ] #[ label: "sibling" - )] - ) - ) + ]] + ] + ] expected: ["x" "parent"] function: "path-to" uuid: "02d1f1d9-428d-4395-b026-2db35ffa8f0a" -) #( +] #[ description: "Can find path to sibling" - input: #( + input: #[ from: "x" to: "b" - tree: #( + tree: #[ label: "parent" - children: [#( + children: [#[ label: "a" - ) #( + ] #[ label: "x" - ) #( + ] #[ label: "b" - ) #( + ] #[ label: "c" - )] - ) - ) + ]] + ] + ] expected: ["x" "parent" "b"] function: "path-to" uuid: "d0002674-fcfb-4cdc-9efa-bfc54e3c31b5" -) #( +] #[ description: "Can find path to cousin" - input: #( + input: #[ from: "x" to: "cousin-1" - tree: #( + tree: #[ label: "grandparent" - children: [#( + children: [#[ label: "parent" - children: [#( + children: [#[ label: "x" - children: [#( + children: [#[ label: "kid-0" - ) #( + ] #[ label: "kid-1" - )] - ) #( + ]] + ] #[ label: "sibling-0" - ) #( + ] #[ label: "sibling-1" - )] - ) #( + ]] + ] #[ label: "uncle" - children: [#( + children: [#[ label: "cousin-0" - ) #( + ] #[ label: "cousin-1" - )] - )] - ) - ) + ]] + ]] + ] + ] expected: ["x" "parent" "grandparent" "uncle" "cousin-1"] function: "path-to" uuid: "c9877cd1-0a69-40d4-b362-725763a5c38f" -) #( +] #[ description: "Can find path not involving root" - input: #( + input: #[ from: "x" to: "sibling-1" - tree: #( + tree: #[ label: "grandparent" - children: [#( + children: [#[ label: "parent" - children: [#( + children: [#[ label: "x" - ) #( + ] #[ label: "sibling-0" - ) #( + ] #[ label: "sibling-1" - )] - )] - ) - ) + ]] + ]] + ] + ] expected: ["x" "parent" "sibling-1"] function: "path-to" uuid: "9fb17a82-2c14-4261-baa3-2f3f234ffa03" -) #( +] #[ description: "Can find path from nodes other than x" - input: #( + input: #[ from: "a" to: "c" - tree: #( + tree: #[ label: "parent" - children: [#( + children: [#[ label: "a" - ) #( + ] #[ label: "x" - ) #( + ] #[ label: "b" - ) #( + ] #[ label: "c" - )] - ) - ) + ]] + ] + ] expected: ["a" "parent" "c"] function: "path-to" uuid: "5124ed49-7845-46ad-bc32-97d5ac7451b2" -) #( +] #[ description: "Errors if destination does not exist" - input: #( + input: #[ from: "x" to: "nonexistent" - tree: #( + tree: #[ label: "parent" - children: [#( + children: [#[ label: "x" - children: [#( + children: [#[ label: "kid-0" - ) #( + ] #[ label: "kid-1" - )] - ) #( + ]] + ] #[ label: "sibling-0" - ) #( + ] #[ label: "sibling-1" - )] - ) - ) + ]] + ] + ] expected: none function: "path-to" uuid: "f52a183c-25cc-4c87-9fc9-0e7f81a5725c" -) #( +] #[ description: "Errors if source does not exist" - input: #( + input: #[ from: "nonexistent" to: "x" - tree: #( + tree: #[ label: "parent" - children: [#( + children: [#[ label: "x" - children: [#( + children: [#[ label: "kid-0" - ) #( + ] #[ label: "kid-1" - )] - ) #( + ]] + ] #[ label: "sibling-0" - ) #( + ] #[ label: "sibling-1" - )] - ) - ) + ]] + ] + ] expected: none function: "path-to" uuid: "f4fe18b9-b4a2-4bd5-a694-e179155c2149" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/protein-translation/protein-translation-test.red b/exercises/practice/protein-translation/protein-translation-test.red index 19b3656..b5c663d 100644 --- a/exercises/practice/protein-translation/protein-translation-test.red +++ b/exercises/practice/protein-translation/protein-translation-test.red @@ -8,207 +8,207 @@ Red [ test-init/limit %protein-translation.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "Methionine RNA sequence" - input: #( + input: #[ strand: "AUG" - ) + ] expected: ["Methionine"] function: "proteins" uuid: "96d3d44f-34a2-4db4-84cd-fff523e069be" -) #( +] #[ description: "Phenylalanine RNA sequence 1" - input: #( + input: #[ strand: "UUU" - ) + ] expected: ["Phenylalanine"] function: "proteins" uuid: "1b4c56d8-d69f-44eb-be0e-7b17546143d9" -) #( +] #[ description: "Phenylalanine RNA sequence 2" - input: #( + input: #[ strand: "UUC" - ) + ] expected: ["Phenylalanine"] function: "proteins" uuid: "81b53646-bd57-4732-b2cb-6b1880e36d11" -) #( +] #[ description: "Leucine RNA sequence 1" - input: #( + input: #[ strand: "UUA" - ) + ] expected: ["Leucine"] function: "proteins" uuid: "42f69d4f-19d2-4d2c-a8b0-f0ae9ee1b6b4" -) #( +] #[ description: "Leucine RNA sequence 2" - input: #( + input: #[ strand: "UUG" - ) + ] expected: ["Leucine"] function: "proteins" uuid: "ac5edadd-08ed-40a3-b2b9-d82bb50424c4" -) #( +] #[ description: "Serine RNA sequence 1" - input: #( + input: #[ strand: "UCU" - ) + ] expected: ["Serine"] function: "proteins" uuid: "8bc36e22-f984-44c3-9f6b-ee5d4e73f120" -) #( +] #[ description: "Serine RNA sequence 2" - input: #( + input: #[ strand: "UCC" - ) + ] expected: ["Serine"] function: "proteins" uuid: "5c3fa5da-4268-44e5-9f4b-f016ccf90131" -) #( +] #[ description: "Serine RNA sequence 3" - input: #( + input: #[ strand: "UCA" - ) + ] expected: ["Serine"] function: "proteins" uuid: "00579891-b594-42b4-96dc-7ff8bf519606" -) #( +] #[ description: "Serine RNA sequence 4" - input: #( + input: #[ strand: "UCG" - ) + ] expected: ["Serine"] function: "proteins" uuid: "08c61c3b-fa34-4950-8c4a-133945570ef6" -) #( +] #[ description: "Tyrosine RNA sequence 1" - input: #( + input: #[ strand: "UAU" - ) + ] expected: ["Tyrosine"] function: "proteins" uuid: "54e1e7d8-63c0-456d-91d2-062c72f8eef5" -) #( +] #[ description: "Tyrosine RNA sequence 2" - input: #( + input: #[ strand: "UAC" - ) + ] expected: ["Tyrosine"] function: "proteins" uuid: "47bcfba2-9d72-46ad-bbce-22f7666b7eb1" -) #( +] #[ description: "Cysteine RNA sequence 1" - input: #( + input: #[ strand: "UGU" - ) + ] expected: ["Cysteine"] function: "proteins" uuid: "3a691829-fe72-43a7-8c8e-1bd083163f72" -) #( +] #[ description: "Cysteine RNA sequence 2" - input: #( + input: #[ strand: "UGC" - ) + ] expected: ["Cysteine"] function: "proteins" uuid: "1b6f8a26-ca2f-43b8-8262-3ee446021767" -) #( +] #[ description: "Tryptophan RNA sequence" - input: #( + input: #[ strand: "UGG" - ) + ] expected: ["Tryptophan"] function: "proteins" uuid: "1e91c1eb-02c0-48a0-9e35-168ad0cb5f39" -) #( +] #[ description: "STOP codon RNA sequence 1" - input: #( + input: #[ strand: "UAA" - ) + ] expected: [] function: "proteins" uuid: "e547af0b-aeab-49c7-9f13-801773a73557" -) #( +] #[ description: "STOP codon RNA sequence 2" - input: #( + input: #[ strand: "UAG" - ) + ] expected: [] function: "proteins" uuid: "67640947-ff02-4f23-a2ef-816f8a2ba72e" -) #( +] #[ description: "STOP codon RNA sequence 3" - input: #( + input: #[ strand: "UGA" - ) + ] expected: [] function: "proteins" uuid: "9c2ad527-ebc9-4ace-808b-2b6447cb54cb" -) #( +] #[ description: "Sequence of two protein codons translate in proteins" - input: #( + input: #[ strand: "UUUUUU" - ) + ] expected: ["Phenylalanine" "Phenylalanine"] function: "proteins" uuid: "f4d9d8ee-00a8-47bf-a1e3-1641d4428e54" -) #( +] #[ description: "Sequence of two different protein codons translates into proteins" - input: #( + input: #[ strand: "UUAUUG" - ) + ] expected: ["Leucine" "Leucine"] function: "proteins" uuid: "dd22eef3-b4f1-4ad6-bb0b-27093c090a9d" -) #( +] #[ description: "Translate RNA strand into correct protein list" - input: #( + input: #[ strand: "AUGUUUUGG" - ) + ] expected: ["Methionine" "Phenylalanine" "Tryptophan"] function: "proteins" uuid: "d0f295df-fb70-425c-946c-ec2ec185388e" -) #( +] #[ description: {Translation stops if STOP codon at beginning of sequence} - input: #( + input: #[ strand: "UAGUGG" - ) + ] expected: [] function: "proteins" uuid: "e30e8505-97ec-4e5f-a73e-5726a1faa1f4" -) #( +] #[ description: {Translation stops if STOP codon at end of two-codon sequence} - input: #( + input: #[ strand: "UGGUAG" - ) + ] expected: ["Tryptophan"] function: "proteins" uuid: "5358a20b-6f4c-4893-bce4-f929001710f3" -) #( +] #[ description: {Translation stops if STOP codon at end of three-codon sequence} - input: #( + input: #[ strand: "AUGUUUUAA" - ) + ] expected: ["Methionine" "Phenylalanine"] function: "proteins" uuid: "ba16703a-1a55-482f-bb07-b21eef5093a3" -) #( +] #[ description: {Translation stops if STOP codon in middle of three-codon sequence} - input: #( + input: #[ strand: "UGGUAGUGG" - ) + ] expected: ["Tryptophan"] function: "proteins" uuid: "4089bb5a-d5b4-4e71-b79e-b8d1f14a2911" -) #( +] #[ description: {Translation stops if STOP codon in middle of six-codon sequence} - input: #( + input: #[ strand: "UGGUGUUAUUAAUGGUUU" - ) + ] expected: ["Tryptophan" "Cysteine" "Tyrosine"] function: "proteins" uuid: "2c2a2a60-401f-4a80-b977-e0715b23b93d" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/raindrops/raindrops-test.red b/exercises/practice/raindrops/raindrops-test.red index 3df0fc6..680c7cb 100644 --- a/exercises/practice/raindrops/raindrops-test.red +++ b/exercises/practice/raindrops/raindrops-test.red @@ -8,151 +8,151 @@ Red [ test-init/limit %raindrops.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "the sound for 1 is 1" - input: #( + input: #[ number: 1 - ) + ] expected: "1" function: "convert" uuid: "1575d549-e502-46d4-a8e1-6b7bec6123d8" -) #( +] #[ description: "the sound for 3 is Pling" - input: #( + input: #[ number: 3 - ) + ] expected: "Pling" function: "convert" uuid: "1f51a9f9-4895-4539-b182-d7b0a5ab2913" -) #( +] #[ description: "the sound for 5 is Plang" - input: #( + input: #[ number: 5 - ) + ] expected: "Plang" function: "convert" uuid: "2d9bfae5-2b21-4bcd-9629-c8c0e388f3e0" -) #( +] #[ description: "the sound for 7 is Plong" - input: #( + input: #[ number: 7 - ) + ] expected: "Plong" function: "convert" uuid: "d7e60daa-32ef-4c23-b688-2abff46c4806" -) #( +] #[ description: "the sound for 6 is Pling as it has a factor 3" - input: #( + input: #[ number: 6 - ) + ] expected: "Pling" function: "convert" uuid: "6bb4947b-a724-430c-923f-f0dc3d62e56a" -) #( +] #[ description: {2 to the power 3 does not make a raindrop sound as 3 is the exponent not the base} - input: #( + input: #[ number: 8 - ) + ] expected: "8" function: "convert" uuid: "ce51e0e8-d9d4-446d-9949-96eac4458c2d" -) #( +] #[ description: "the sound for 9 is Pling as it has a factor 3" - input: #( + input: #[ number: 9 - ) + ] expected: "Pling" function: "convert" uuid: "0dd66175-e3e2-47fc-8750-d01739856671" -) #( +] #[ description: "the sound for 10 is Plang as it has a factor 5" - input: #( + input: #[ number: 10 - ) + ] expected: "Plang" function: "convert" uuid: "022c44d3-2182-4471-95d7-c575af225c96" -) #( +] #[ description: "the sound for 14 is Plong as it has a factor of 7" - input: #( + input: #[ number: 14 - ) + ] expected: "Plong" function: "convert" uuid: "37ab74db-fed3-40ff-b7b9-04acdfea8edf" -) #( +] #[ description: {the sound for 15 is PlingPlang as it has factors 3 and 5} - input: #( + input: #[ number: 15 - ) + ] expected: "PlingPlang" function: "convert" uuid: "31f92999-6afb-40ee-9aa4-6d15e3334d0f" -) #( +] #[ description: {the sound for 21 is PlingPlong as it has factors 3 and 7} - input: #( + input: #[ number: 21 - ) + ] expected: "PlingPlong" function: "convert" uuid: "ff9bb95d-6361-4602-be2c-653fe5239b54" -) #( +] #[ description: "the sound for 25 is Plang as it has a factor 5" - input: #( + input: #[ number: 25 - ) + ] expected: "Plang" function: "convert" uuid: "d2e75317-b72e-40ab-8a64-6734a21dece1" -) #( +] #[ description: "the sound for 27 is Pling as it has a factor 3" - input: #( + input: #[ number: 27 - ) + ] expected: "Pling" function: "convert" uuid: "a09c4c58-c662-4e32-97fe-f1501ef7125c" -) #( +] #[ description: {the sound for 35 is PlangPlong as it has factors 5 and 7} - input: #( + input: #[ number: 35 - ) + ] expected: "PlangPlong" function: "convert" uuid: "bdf061de-8564-4899-a843-14b48b722789" -) #( +] #[ description: "the sound for 49 is Plong as it has a factor 7" - input: #( + input: #[ number: 49 - ) + ] expected: "Plong" function: "convert" uuid: "c4680bee-69ba-439d-99b5-70c5fd1a7a83" -) #( +] #[ description: "the sound for 52 is 52" - input: #( + input: #[ number: 52 - ) + ] expected: "52" function: "convert" uuid: "17f2bc9a-b65a-4d23-8ccd-266e8c271444" -) #( +] #[ description: {the sound for 105 is PlingPlangPlong as it has factors 3, 5 and 7} - input: #( + input: #[ number: 105 - ) + ] expected: "PlingPlangPlong" function: "convert" uuid: "e46677ed-ff1a-419f-a740-5c713d2830e4" -) #( +] #[ description: "the sound for 3125 is Plang as it has a factor 5" - input: #( + input: #[ number: 3125 - ) + ] expected: "Plang" function: "convert" uuid: "13c6837a-0fcd-4b86-a0eb-20572f7deb0b" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/resistor-color-duo/resistor-color-duo-test.red b/exercises/practice/resistor-color-duo/resistor-color-duo-test.red index 0762ed2..adc4f50 100644 --- a/exercises/practice/resistor-color-duo/resistor-color-duo-test.red +++ b/exercises/practice/resistor-color-duo/resistor-color-duo-test.red @@ -8,63 +8,63 @@ Red [ test-init/limit %resistor-color-duo.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "Brown and black" - input: #( + input: #[ colors: ["brown" "black"] - ) + ] expected: 10 function: "value" uuid: "ce11995a-5b93-4950-a5e9-93423693b2fc" -) #( +] #[ description: "Blue and grey" - input: #( + input: #[ colors: ["blue" "grey"] - ) + ] expected: 68 function: "value" uuid: "7bf82f7a-af23-48ba-a97d-38d59406a920" -) #( +] #[ description: "Yellow and violet" - input: #( + input: #[ colors: ["yellow" "violet"] - ) + ] expected: 47 function: "value" uuid: "f1886361-fdfd-4693-acf8-46726fe24e0c" -) #( +] #[ description: "White and red" - input: #( + input: #[ colors: ["white" "red"] - ) + ] expected: 92 function: "value" uuid: "b7a6cbd2-ae3c-470a-93eb-56670b305640" -) #( +] #[ description: "Orange and orange" - input: #( + input: #[ colors: ["orange" "orange"] - ) + ] expected: 33 function: "value" uuid: "77a8293d-2a83-4016-b1af-991acc12b9fe" -) #( +] #[ description: "Ignore additional colors" - input: #( + input: #[ colors: ["green" "brown" "orange"] - ) + ] expected: 51 function: "value" uuid: "0c4fb44f-db7c-4d03-afa8-054350f156a8" -) #( +] #[ description: "Black and brown, one-digit" - input: #( + input: #[ colors: ["black" "brown"] - ) + ] expected: 1 function: "value" uuid: "4a8ceec5-0ab4-4904-88a4-daf953a5e818" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/resistor-color-trio/resistor-color-trio-test.red b/exercises/practice/resistor-color-trio/resistor-color-trio-test.red index c8b0f2d..dfa76e0 100644 --- a/exercises/practice/resistor-color-trio/resistor-color-trio-test.red +++ b/exercises/practice/resistor-color-trio/resistor-color-trio-test.red @@ -8,117 +8,117 @@ Red [ test-init/limit %resistor-color-trio.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "Orange and orange and black" - input: #( + input: #[ colors: ["orange" "orange" "black"] - ) - expected: #( + ] + expected: #[ value: 33 unit: "ohms" - ) + ] function: "label" uuid: "d6863355-15b7-40bb-abe0-bfb1a25512ed" -) #( +] #[ description: "Blue and grey and brown" - input: #( + input: #[ colors: ["blue" "grey" "brown"] - ) - expected: #( + ] + expected: #[ value: 680 unit: "ohms" - ) + ] function: "label" uuid: "1224a3a9-8c8e-4032-843a-5224e04647d6" -) #( +] #[ description: "Red and black and red" - input: #( + input: #[ colors: ["red" "black" "red"] - ) - expected: #( + ] + expected: #[ value: 2 unit: "kiloohms" - ) + ] function: "label" uuid: "b8bda7dc-6b95-4539-abb2-2ad51d66a207" -) #( +] #[ description: "Green and brown and orange" - input: #( + input: #[ colors: ["green" "brown" "orange"] - ) - expected: #( + ] + expected: #[ value: 51 unit: "kiloohms" - ) + ] function: "label" uuid: "5b1e74bc-d838-4eda-bbb3-eaba988e733b" -) #( +] #[ description: "Yellow and violet and yellow" - input: #( + input: #[ colors: ["yellow" "violet" "yellow"] - ) - expected: #( + ] + expected: #[ value: 470 unit: "kiloohms" - ) + ] function: "label" uuid: "f5d37ef9-1919-4719-a90d-a33c5a6934c9" -) #( +] #[ description: "Blue and violet and blue" - input: #( + input: #[ colors: ["blue" "violet" "blue"] - ) - expected: #( + ] + expected: #[ value: 67 unit: "megaohms" - ) + ] function: "label" uuid: "5f6404a7-5bb3-4283-877d-3d39bcc33854" -) #( +] #[ description: "Minimum possible value" - input: #( + input: #[ colors: ["black" "black" "black"] - ) - expected: #( + ] + expected: #[ value: 0 unit: "ohms" - ) + ] function: "label" uuid: "7d3a6ab8-e40e-46c3-98b1-91639fff2344" -) #( +] #[ description: "Maximum possible value" - input: #( + input: #[ colors: ["white" "white" "white"] - ) - expected: #( + ] + expected: #[ value: 99 unit: "gigaohms" - ) + ] function: "label" uuid: "ca0aa0ac-3825-42de-9f07-dac68cc580fd" -) #( +] #[ description: "First two colors make an invalid octal number" - input: #( + input: #[ colors: ["black" "grey" "black"] - ) - expected: #( + ] + expected: #[ value: 8 unit: "ohms" - ) + ] function: "label" uuid: "0061a76c-903a-4714-8ce2-f26ce23b0e09" -) #( +] #[ description: "Ignore extra colors" - input: #( + input: #[ colors: ["blue" "green" "yellow" "orange"] - ) - expected: #( + ] + expected: #[ value: 650 unit: "kiloohms" - ) + ] function: "label" uuid: "872c92-f567-4b69-a105-8455611c10c4" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/resistor-color/resistor-color-test.red b/exercises/practice/resistor-color/resistor-color-test.red index 8031544..c3881cd 100644 --- a/exercises/practice/resistor-color/resistor-color-test.red +++ b/exercises/practice/resistor-color/resistor-color-test.red @@ -8,37 +8,37 @@ Red [ test-init/limit %resistor-color.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "Black" - input: #( + input: #[ color: "black" - ) + ] expected: 0 function: "color-code" uuid: "49eb31c5-10a8-4180-9f7f-fea632ab87ef" -) #( +] #[ description: "White" - input: #( + input: #[ color: "white" - ) + ] expected: 9 function: "color-code" uuid: "0a4df94b-92da-4579-a907-65040ce0b3fc" -) #( +] #[ description: "Orange" - input: #( + input: #[ color: "orange" - ) + ] expected: 3 function: "color-code" uuid: "5f81608d-f36f-4190-8084-f45116b6f380" -) #( +] #[ description: "Colors" - input: #() + input: #[] expected: ["black" "brown" "red" "orange" "yellow" "green" "blue" "violet" "grey" "white"] function: "colors" uuid: "581d68fa-f968-4be2-9f9d-880f2fb73cf7" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/reverse-string/reverse-string-test.red b/exercises/practice/reverse-string/reverse-string-test.red index feb9874..51bddc0 100644 --- a/exercises/practice/reverse-string/reverse-string-test.red +++ b/exercises/practice/reverse-string/reverse-string-test.red @@ -9,55 +9,55 @@ Red [ test-init/limit %.meta/example.red 20 ; test example solution canonical-cases: [ - #( + #[ description: "an empty string" - input: #(value: "") + input: #[value: ""] expected: "" function: "reverse" uuid: "c3b7d806-dced-49ee-8543-933fd1719b1c" - ) - #( + ] + #[ description: "a word" - input: #(value: "robot") + input: #[value: "robot"] expected: "tobor" function: "reverse" uuid: "01ebf55b-bebb-414e-9dec-06f7bb0bee3c" - ) - #( + ] + #[ description: "a capitalized word" - input: #(value: "Ramen") + input: #[value: "Ramen"] expected: "nemaR" function: "reverse" uuid: "0f7c07e4-efd1-4aaa-a07a-90b49ce0b746" - ) - #( + ] + #[ description: "a sentence with punctuation" - input: #(value: "I'm hungry!") + input: #[value: "I'm hungry!"] expected: "!yrgnuh m'I" function: "reverse" uuid: "71854b9c-f200-4469-9f5c-1e8e5eff5614" - ) - #( + ] + #[ description: "a palindrome" - input: #(value: "racecar") + input: #[value: "racecar"] expected: "racecar" function: "reverse" uuid: "1f8ed2f3-56f3-459b-8f3e-6d8d654a1f6c" - ) - #( + ] + #[ description: "an even-sized word" - input: #(value: "drawer") + input: #[value: "drawer"] expected: "reward" function: "reverse" uuid: "b9e7dec1-c6df-40bd-9fa3-cd7ded010c4c" - ) - #( + ] + #[ description: "wide characters" - input: #(value: "子猫") + input: #[value: "子猫"] expected: "猫子" function: "reverse" uuid: "1bed0f8a-13b0-4bd3-9d59-3d0593326fa2" - ) + ] ] diff --git a/exercises/practice/roman-numerals/roman-numerals-test.red b/exercises/practice/roman-numerals/roman-numerals-test.red index 4427675..d4c4649 100644 --- a/exercises/practice/roman-numerals/roman-numerals-test.red +++ b/exercises/practice/roman-numerals/roman-numerals-test.red @@ -8,215 +8,215 @@ Red [ test-init/limit %roman-numerals.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "1 is I" - input: #( + input: #[ number: 1 - ) + ] expected: "I" function: "roman" uuid: "19828a3a-fbf7-4661-8ddd-cbaeee0e2178" -) #( +] #[ description: "2 is II" - input: #( + input: #[ number: 2 - ) + ] expected: "II" function: "roman" uuid: "f088f064-2d35-4476-9a41-f576da3f7b03" -) #( +] #[ description: "3 is III" - input: #( + input: #[ number: 3 - ) + ] expected: "III" function: "roman" uuid: "b374a79c-3bea-43e6-8db8-1286f79c7106" -) #( +] #[ description: "4 is IV" - input: #( + input: #[ number: 4 - ) + ] expected: "IV" function: "roman" uuid: "05a0a1d4-a140-4db1-82e8-fcc21fdb49bb" -) #( +] #[ description: "5 is V" - input: #( + input: #[ number: 5 - ) + ] expected: "V" function: "roman" uuid: "57c0f9ad-5024-46ab-975d-de18c430b290" -) #( +] #[ description: "6 is VI" - input: #( + input: #[ number: 6 - ) + ] expected: "VI" function: "roman" uuid: "20a2b47f-e57f-4797-a541-0b3825d7f249" -) #( +] #[ description: "9 is IX" - input: #( + input: #[ number: 9 - ) + ] expected: "IX" function: "roman" uuid: "ff3fb08c-4917-4aab-9f4e-d663491d083d" -) #( +] #[ description: "16 is XVI" - input: #( + input: #[ number: 16 - ) + ] expected: "XVI" function: "roman" uuid: "6d1d82d5-bf3e-48af-9139-87d7165ed509" -) #( +] #[ description: "27 is XXVII" - input: #( + input: #[ number: 27 - ) + ] expected: "XXVII" function: "roman" uuid: "2bda64ca-7d28-4c56-b08d-16ce65716cf6" -) #( +] #[ description: "48 is XLVIII" - input: #( + input: #[ number: 48 - ) + ] expected: "XLVIII" function: "roman" uuid: "a1f812ef-84da-4e02-b4f0-89c907d0962c" -) #( +] #[ description: "49 is XLIX" - input: #( + input: #[ number: 49 - ) + ] expected: "XLIX" function: "roman" uuid: "607ead62-23d6-4c11-a396-ef821e2e5f75" -) #( +] #[ description: "59 is LIX" - input: #( + input: #[ number: 59 - ) + ] expected: "LIX" function: "roman" uuid: "d5b283d4-455d-4e68-aacf-add6c4b51915" -) #( +] #[ description: "66 is LXVI" - input: #( + input: #[ number: 66 - ) + ] expected: "LXVI" function: "roman" uuid: "4465ffd5-34dc-44f3-ada5-56f5007b6dad" -) #( +] #[ description: "93 is XCIII" - input: #( + input: #[ number: 93 - ) + ] expected: "XCIII" function: "roman" uuid: "46b46e5b-24da-4180-bfe2-2ef30b39d0d0" -) #( +] #[ description: "141 is CXLI" - input: #( + input: #[ number: 141 - ) + ] expected: "CXLI" function: "roman" uuid: "30494be1-9afb-4f84-9d71-db9df18b55e3" -) #( +] #[ description: "163 is CLXIII" - input: #( + input: #[ number: 163 - ) + ] expected: "CLXIII" function: "roman" uuid: "267f0207-3c55-459a-b81d-67cec7a46ed9" -) #( +] #[ description: "166 is CLXVI" - input: #( + input: #[ number: 166 - ) + ] expected: "CLXVI" function: "roman" uuid: "902ad132-0b4d-40e3-8597-ba5ed611dd8d" -) #( +] #[ description: "402 is CDII" - input: #( + input: #[ number: 402 - ) + ] expected: "CDII" function: "roman" uuid: "cdb06885-4485-4d71-8bfb-c9d0f496b404" -) #( +] #[ description: "575 is DLXXV" - input: #( + input: #[ number: 575 - ) + ] expected: "DLXXV" function: "roman" uuid: "6b71841d-13b2-46b4-ba97-dec28133ea80" -) #( +] #[ description: "666 is DCLXVI" - input: #( + input: #[ number: 666 - ) + ] expected: "DCLXVI" function: "roman" uuid: "dacb84b9-ea1c-4a61-acbb-ce6b36674906" -) #( +] #[ description: "911 is CMXI" - input: #( + input: #[ number: 911 - ) + ] expected: "CMXI" function: "roman" uuid: "432de891-7fd6-4748-a7f6-156082eeca2f" -) #( +] #[ description: "1024 is MXXIV" - input: #( + input: #[ number: 1024 - ) + ] expected: "MXXIV" function: "roman" uuid: "e6de6d24-f668-41c0-88d7-889c0254d173" -) #( +] #[ description: "1666 is MDCLXVI" - input: #( + input: #[ number: 1666 - ) + ] expected: "MDCLXVI" function: "roman" uuid: "efbe1d6a-9f98-4eb5-82bc-72753e3ac328" -) #( +] #[ description: "3000 is MMM" - input: #( + input: #[ number: 3000 - ) + ] expected: "MMM" function: "roman" uuid: "bb550038-d4eb-4be2-a9ce-f21961ac3bc6" -) #( +] #[ description: "3001 is MMMI" - input: #( + input: #[ number: 3001 - ) + ] expected: "MMMI" function: "roman" uuid: "3bc4b41c-c2e6-49d9-9142-420691504336" -) #( +] #[ description: "3999 is MMMCMXCIX" - input: #( + input: #[ number: 3999 - ) + ] expected: "MMMCMXCIX" function: "roman" uuid: "4e18e96b-5fbb-43df-a91b-9cb511fe0856" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/rotational-cipher/rotational-cipher-test.red b/exercises/practice/rotational-cipher/rotational-cipher-test.red index 6f92194..8ba9524 100644 --- a/exercises/practice/rotational-cipher/rotational-cipher-test.red +++ b/exercises/practice/rotational-cipher/rotational-cipher-test.red @@ -8,97 +8,97 @@ Red [ test-init/limit %rotational-cipher.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "rotate a by 0, same output as input" - input: #( + input: #[ text: "a" shiftKey: 0 - ) + ] expected: "a" function: "rotate" uuid: "74e58a38-e484-43f1-9466-877a7515e10f" -) #( +] #[ description: "rotate a by 1" - input: #( + input: #[ text: "a" shiftKey: 1 - ) + ] expected: "b" function: "rotate" uuid: "7ee352c6-e6b0-4930-b903-d09943ecb8f5" -) #( +] #[ description: "rotate a by 26, same output as input" - input: #( + input: #[ text: "a" shiftKey: 26 - ) + ] expected: "a" function: "rotate" uuid: "edf0a733-4231-4594-a5ee-46a4009ad764" -) #( +] #[ description: "rotate m by 13" - input: #( + input: #[ text: "m" shiftKey: 13 - ) + ] expected: "z" function: "rotate" uuid: "e3e82cb9-2a5b-403f-9931-e43213879300" -) #( +] #[ description: "rotate n by 13 with wrap around alphabet" - input: #( + input: #[ text: "n" shiftKey: 13 - ) + ] expected: "a" function: "rotate" uuid: "19f9eb78-e2ad-4da4-8fe3-9291d47c1709" -) #( +] #[ description: "rotate capital letters" - input: #( + input: #[ text: "OMG" shiftKey: 5 - ) + ] expected: "TRL" function: "rotate" uuid: "a116aef4-225b-4da9-884f-e8023ca6408a" -) #( +] #[ description: "rotate spaces" - input: #( + input: #[ text: "O M G" shiftKey: 5 - ) + ] expected: "T R L" function: "rotate" uuid: "71b541bb-819c-4dc6-a9c3-132ef9bb737b" -) #( +] #[ description: "rotate numbers" - input: #( + input: #[ text: "Testing 1 2 3 testing" shiftKey: 4 - ) + ] expected: "Xiwxmrk 1 2 3 xiwxmrk" function: "rotate" uuid: "ef32601d-e9ef-4b29-b2b5-8971392282e6" -) #( +] #[ description: "rotate punctuation" - input: #( + input: #[ text: "Let's eat, Grandma!" shiftKey: 21 - ) + ] expected: "Gzo'n zvo, Bmviyhv!" function: "rotate" uuid: "32dd74f6-db2b-41a6-b02c-82eb4f93e549" -) #( +] #[ description: "rotate all letters" - input: #( + input: #[ text: "The quick brown fox jumps over the lazy dog." shiftKey: 13 - ) + ] expected: "Gur dhvpx oebja sbk whzcf bire gur ynml qbt." function: "rotate" uuid: "9fb93fe6-42b0-46e6-9ec1-0bf0a062d8c9" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/run-length-encoding/run-length-encoding-test.red b/exercises/practice/run-length-encoding/run-length-encoding-test.red index 749ff8e..48a9228 100644 --- a/exercises/practice/run-length-encoding/run-length-encoding-test.red +++ b/exercises/practice/run-length-encoding/run-length-encoding-test.red @@ -8,103 +8,103 @@ Red [ test-init/limit %run-length-encoding.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "run-length encode a string -> empty string" - input: #( + input: #[ string: "" - ) + ] expected: "" function: "encode" uuid: "ad53b61b-6ffc-422f-81a6-61f7df92a231" -) #( +] #[ description: "run-length encode a string -> single characters only are encoded without count" - input: #( + input: #[ string: "XYZ" - ) + ] expected: "XYZ" function: "encode" uuid: "52012823-b7e6-4277-893c-5b96d42f82de" -) #( +] #[ description: "run-length encode a string -> string with no single characters" - input: #( + input: #[ string: "AABBBCCCC" - ) + ] expected: "2A3B4C" function: "encode" uuid: "b7868492-7e3a-415f-8da3-d88f51f80409" -) #( +] #[ description: "run-length encode a string -> single characters mixed with repeated characters" - input: #( + input: #[ string: {WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB} - ) + ] expected: "12WB12W3B24WB" function: "encode" uuid: "859b822b-6e9f-44d6-9c46-6091ee6ae358" -) #( +] #[ description: "run-length encode a string -> multiple whitespace mixed in string" - input: #( + input: #[ string: " hsqq qww " - ) + ] expected: "2 hs2q q2w2 " function: "encode" uuid: "1b34de62-e152-47be-bc88-469746df63b3" -) #( +] #[ description: "run-length encode a string -> lowercase characters" - input: #( + input: #[ string: "aabbbcccc" - ) + ] expected: "2a3b4c" function: "encode" uuid: "abf176e2-3fbd-40ad-bb2f-2dd6d4df721a" -) #( +] #[ description: "run-length decode a string -> empty string" - input: #( + input: #[ string: "" - ) + ] expected: "" function: "decode" uuid: "7ec5c390-f03c-4acf-ac29-5f65861cdeb5" -) #( +] #[ description: "run-length decode a string -> single characters only" - input: #( + input: #[ string: "XYZ" - ) + ] expected: "XYZ" function: "decode" uuid: "ad23f455-1ac2-4b0e-87d0-b85b10696098" -) #( +] #[ description: "run-length decode a string -> string with no single characters" - input: #( + input: #[ string: "2A3B4C" - ) + ] expected: "AABBBCCCC" function: "decode" uuid: "21e37583-5a20-4a0e-826c-3dee2c375f54" -) #( +] #[ description: "run-length decode a string -> single characters with repeated characters" - input: #( + input: #[ string: "12WB12W3B24WB" - ) + ] expected: {WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB} function: "decode" uuid: "1389ad09-c3a8-4813-9324-99363fba429c" -) #( +] #[ description: "run-length decode a string -> multiple whitespace mixed in string" - input: #( + input: #[ string: "2 hs2q q2w2 " - ) + ] expected: " hsqq qww " function: "decode" uuid: "3f8e3c51-6aca-4670-b86c-a213bf4706b0" -) #( +] #[ description: "run-length decode a string -> lowercase string" - input: #( + input: #[ string: "2a3b4c" - ) + ] expected: "aabbbcccc" function: "decode" uuid: "29f721de-9aad-435f-ba37-7662df4fb551" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/scrabble-score/.meta/example.red b/exercises/practice/scrabble-score/.meta/example.red index 3722da9..4e58681 100644 --- a/exercises/practice/scrabble-score/.meta/example.red +++ b/exercises/practice/scrabble-score/.meta/example.red @@ -18,7 +18,7 @@ score: function [ value ] -scores: #( +scores: #[ A: 1 E: 1 I: 1 @@ -44,4 +44,4 @@ scores: #( J: 8 X: 8 Q: 10 - Z: 10) + Z: 10] diff --git a/exercises/practice/scrabble-score/scrabble-score-test.red b/exercises/practice/scrabble-score/scrabble-score-test.red index dbfacc0..a9a42a1 100644 --- a/exercises/practice/scrabble-score/scrabble-score-test.red +++ b/exercises/practice/scrabble-score/scrabble-score-test.red @@ -8,95 +8,95 @@ Red [ test-init/limit %scrabble-score.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "lowercase letter" - input: #( + input: #[ word: "a" - ) + ] expected: 1 function: "score" uuid: "f46cda29-1ca5-4ef2-bd45-388a767e3db2" -) #( +] #[ description: "uppercase letter" - input: #( + input: #[ word: "A" - ) + ] expected: 1 function: "score" uuid: "f7794b49-f13e-45d1-a933-4e48459b2201" -) #( +] #[ description: "valuable letter" - input: #( + input: #[ word: "f" - ) + ] expected: 4 function: "score" uuid: "eaba9c76-f9fa-49c9-a1b0-d1ba3a5b31fa" -) #( +] #[ description: "short word" - input: #( + input: #[ word: "at" - ) + ] expected: 2 function: "score" uuid: "f3c8c94e-bb48-4da2-b09f-e832e103151e" -) #( +] #[ description: "short, valuable word" - input: #( + input: #[ word: "zoo" - ) + ] expected: 12 function: "score" uuid: "71e3d8fa-900d-4548-930e-68e7067c4615" -) #( +] #[ description: "medium word" - input: #( + input: #[ word: "street" - ) + ] expected: 6 function: "score" uuid: "d3088ad9-570c-4b51-8764-c75d5a430e99" -) #( +] #[ description: "medium, valuable word" - input: #( + input: #[ word: "quirky" - ) + ] expected: 22 function: "score" uuid: "fa20c572-ad86-400a-8511-64512daac352" -) #( +] #[ description: "long, mixed-case word" - input: #( + input: #[ word: "OxyphenButazone" - ) + ] expected: 41 function: "score" uuid: "9336f0ba-9c2b-4fa0-bd1c-2e2d328cf967" -) #( +] #[ description: "english-like word" - input: #( + input: #[ word: "pinata" - ) + ] expected: 8 function: "score" uuid: "1e34e2c3-e444-4ea7-b598-3c2b46fd2c10" -) #( +] #[ description: "empty input" - input: #( + input: #[ word: "" - ) + ] expected: 0 function: "score" uuid: "4efe3169-b3b6-4334-8bae-ff4ef24a7e4f" -) #( +] #[ description: "entire alphabet available" - input: #( + input: #[ word: "abcdefghijklmnopqrstuvwxyz" - ) + ] expected: 87 function: "score" uuid: "3b305c1c-f260-4e15-a5b5-cb7d3ea7c3d7" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/sgf-parsing/.meta/example.red b/exercises/practice/sgf-parsing/.meta/example.red index a03c8c7..fa0afd2 100644 --- a/exercises/practice/sgf-parsing/.meta/example.red +++ b/exercises/practice/sgf-parsing/.meta/example.red @@ -15,7 +15,7 @@ Red [ ] make-node: func [][ - make map! compose/only [properties: (copy #()) children: (copy [])] + make map! compose/only [properties: (copy #[]) children: (copy [])] ] unescape: func [value][ diff --git a/exercises/practice/sgf-parsing/sgf-parsing-test.red b/exercises/practice/sgf-parsing/sgf-parsing-test.red index 4b03389..f01127d 100644 --- a/exercises/practice/sgf-parsing/sgf-parsing-test.red +++ b/exercises/practice/sgf-parsing/sgf-parsing-test.red @@ -9,172 +9,172 @@ test-init/limit %sgf-parsing.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "empty input" - input: #( + input: #[ encoded: "" - ) - expected: #( + ] + expected: #[ error: "tree missing" - ) + ] function: "parse-sgf" uuid: "2668d5dc-109f-4f71-b9d5-8d06b1d6f1cd" -) #( +] #[ description: "tree with no nodes" - input: #( + input: #[ encoded: "()" - ) - expected: #( + ] + expected: #[ error: "tree with no nodes" - ) + ] function: "parse-sgf" uuid: "84ded10a-94df-4a30-9457-b50ccbdca813" -) #( +] #[ description: "node without tree" - input: #( + input: #[ encoded: ";" - ) - expected: #( + ] + expected: #[ error: "tree missing" - ) + ] function: "parse-sgf" uuid: "0a6311b2-c615-4fa7-800e-1b1cbb68833d" -) #( +] #[ description: "node without properties" - input: #( + input: #[ encoded: "(;)" - ) - expected: #( - properties: #() + ] + expected: #[ + properties: #[] children: [] - ) + ] function: "parse-sgf" uuid: "8c419ed8-28c4-49f6-8f2d-433e706110ef" -) #( +] #[ description: "single node tree" - input: #( + input: #[ encoded: "(;A[B])" - ) - expected: #( - properties: #( + ] + expected: #[ + properties: #[ A: ["B"] - ) + ] children: [] - ) + ] function: "parse-sgf" uuid: "8209645f-32da-48fe-8e8f-b9b562c26b49" -) #( +] #[ description: "multiple properties" - input: #( + input: #[ encoded: "(;A[b]C[d])" - ) - expected: #( - properties: #( + ] + expected: #[ + properties: #[ A: ["b"] C: ["d"] - ) + ] children: [] - ) + ] function: "parse-sgf" uuid: "6c995856-b919-4c75-8fd6-c2c3c31b37dc" -) #( +] #[ description: "properties without delimiter" - input: #( + input: #[ encoded: "(;A)" - ) - expected: #( + ] + expected: #[ error: "properties without delimiter" - ) + ] function: "parse-sgf" uuid: "a771f518-ec96-48ca-83c7-f8d39975645f" -) #( +] #[ description: "all lowercase property" - input: #( + input: #[ encoded: "(;a[b])" - ) - expected: #( + ] + expected: #[ error: "property must be in uppercase" - ) + ] function: "parse-sgf" uuid: "6c02a24e-6323-4ed5-9962-187d19e36bc8" -) #( +] #[ description: "upper and lowercase property" - input: #( + input: #[ encoded: "(;Aa[b])" - ) - expected: #( + ] + expected: #[ error: "property must be in uppercase" - ) + ] function: "parse-sgf" uuid: "8772d2b1-3c57-405a-93ac-0703b671adc1" -) #( +] #[ description: "two nodes" - input: #( + input: #[ encoded: "(;A[B];B[C])" - ) - expected: #( - properties: #( + ] + expected: #[ + properties: #[ A: ["B"] - ) - children: [#( - properties: #( + ] + children: [#[ + properties: #[ B: ["C"] - ) + ] children: [] - )] - ) + ]] + ] function: "parse-sgf" uuid: "a759b652-240e-42ec-a6d2-3a08d834b9e2" -) #( +] #[ description: "two child trees" - input: #( + input: #[ encoded: "(;A[B](;B[C])(;C[D]))" - ) - expected: #( - properties: #( + ] + expected: #[ + properties: #[ A: ["B"] - ) - children: [#( - properties: #( + ] + children: [#[ + properties: #[ B: ["C"] - ) + ] children: [] - ) #( - properties: #( + ] #[ + properties: #[ C: ["D"] - ) + ] children: [] - )] - ) + ]] + ] function: "parse-sgf" uuid: "cc7c02bc-6097-42c4-ab88-a07cb1533d00" -) #( +] #[ description: "multiple property values" - input: #( + input: #[ encoded: "(;A[b][c][d])" - ) - expected: #( - properties: #( + ] + expected: #[ + properties: #[ A: ["b" "c" "d"] - ) + ] children: [] - ) + ] function: "parse-sgf" uuid: "724eeda6-00db-41b1-8aa9-4d5238ca0130" -) #( +] #[ description: "escaped property" - input: #( + input: #[ encoded: "(;A[\]b\nc\nd\t\te \n\]])" - ) - expected: #( - properties: #( + ] + expected: #[ + properties: #[ A: ["]b\nc\nd e \n]"] - ) + ] children: [] - ) + ] function: "parse-sgf" uuid: "11c36323-93fc-495d-bb23-c88ee5844b8c" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/simple-linked-list/simple-linked-list-test.red b/exercises/practice/simple-linked-list/simple-linked-list-test.red index 0c41531..fac412c 100644 --- a/exercises/practice/simple-linked-list/simple-linked-list-test.red +++ b/exercises/practice/simple-linked-list/simple-linked-list-test.red @@ -8,39 +8,39 @@ Red [ test-init/limit %simple-linked-list.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: {Convert an array to linked list, and then from linked list back to array} - input: #( + input: #[ array: [3 6 1] - ) + ] expected: [3 6 1] function: "from-array-and-back" uuid: "3b72d23a-4487-4632-8682-59684c875dd9" -) #( +] #[ description: {Convert from array, reverse the list, and covert to array} - input: #( + input: #[ array: [3 6 1] - ) + ] expected: [1 6 3] function: "convert-reverse-convert-back" uuid: "70484949-cf28-4446-af05-e24f5ae8a265" -) #( +] #[ description: {Convert empty array} - input: #( + input: #[ array: [] - ) + ] expected: [] function: "from-array-and-back" uuid: "02fb7cdd-ad7f-4d0b-88b7-a3e0ccfcb584" -) #( +] #[ description: {Convert and reverse empty array} - input: #( + input: #[ array: [] - ) + ] expected: [] function: "convert-reverse-convert-back" uuid: "410ed9b3-d4cd-4969-bc5e-3909efed65d8" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/space-age/space-age-test.red b/exercises/practice/space-age/space-age-test.red index 9961c14..28a7180 100644 --- a/exercises/practice/space-age/space-age-test.red +++ b/exercises/practice/space-age/space-age-test.red @@ -8,79 +8,79 @@ Red [ test-init/limit %space-age.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "age on Earth" - input: #( + input: #[ planet: "Earth" seconds: 1000000000 - ) + ] expected: 31.69 function: "age" uuid: "84f609af-5a91-4d68-90a3-9e32d8a5cd34" -) #( +] #[ description: "age on Mercury" - input: #( + input: #[ planet: "Mercury" seconds: 2134835688 - ) + ] expected: 280.88 function: "age" uuid: "ca20c4e9-6054-458c-9312-79679ffab40b" -) #( +] #[ description: "age on Venus" - input: #( + input: #[ planet: "Venus" seconds: 189839836 - ) + ] expected: 9.78 function: "age" uuid: "502c6529-fd1b-41d3-8fab-65e03082b024" -) #( +] #[ description: "age on Mars" - input: #( + input: #[ planet: "Mars" seconds: 2129871239 - ) + ] expected: 35.88 function: "age" uuid: "9ceadf5e-a0d5-4388-9d40-2c459227ceb8" -) #( +] #[ description: "age on Jupiter" - input: #( + input: #[ planet: "Jupiter" seconds: 901876382 - ) + ] expected: 2.41 function: "age" uuid: "42927dc3-fe5e-4f76-a5b5-f737fc19bcde" -) #( +] #[ description: "age on Saturn" - input: #( + input: #[ planet: "Saturn" seconds: 2000000000 - ) + ] expected: 2.15 function: "age" uuid: "8469b332-7837-4ada-b27c-00ee043ebcad" -) #( +] #[ description: "age on Uranus" - input: #( + input: #[ planet: "Uranus" seconds: 1210123456 - ) + ] expected: 0.46 function: "age" uuid: "999354c1-76f8-4bb5-a672-f317b6436743" -) #( +] #[ description: "age on Neptune" - input: #( + input: #[ planet: "Neptune" seconds: 1821023456 - ) + ] expected: 0.35 function: "age" uuid: "80096d30-a0d4-4449-903e-a381178355d8" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/square-root/square-root-test.red b/exercises/practice/square-root/square-root-test.red index 1d473ae..901aa4f 100644 --- a/exercises/practice/square-root/square-root-test.red +++ b/exercises/practice/square-root/square-root-test.red @@ -8,55 +8,55 @@ Red [ test-init/limit %square-root.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "root of 1" - input: #( + input: #[ radicand: 1 - ) + ] expected: 1 function: "square-root" uuid: "9b748478-7b0a-490c-b87a-609dacf631fd" -) #( +] #[ description: "root of 4" - input: #( + input: #[ radicand: 4 - ) + ] expected: 2 function: "square-root" uuid: "7d3aa9ba-9ac6-4e93-a18b-2e8b477139bb" -) #( +] #[ description: "root of 25" - input: #( + input: #[ radicand: 25 - ) + ] expected: 5 function: "square-root" uuid: "6624aabf-3659-4ae0-a1c8-25ae7f33c6ef" -) #( +] #[ description: "root of 81" - input: #( + input: #[ radicand: 81 - ) + ] expected: 9 function: "square-root" uuid: "93beac69-265e-4429-abb1-94506b431f81" -) #( +] #[ description: "root of 196" - input: #( + input: #[ radicand: 196 - ) + ] expected: 14 function: "square-root" uuid: "fbddfeda-8c4f-4bc4-87ca-6991af35360e" -) #( +] #[ description: "root of 65025" - input: #( + input: #[ radicand: 65025 - ) + ] expected: 255 function: "square-root" uuid: "c03d0532-8368-4734-a8e0-f96a9eb7fc1d" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/triangle/triangle-test.red b/exercises/practice/triangle/triangle-test.red index 8c63499..67d7673 100644 --- a/exercises/practice/triangle/triangle-test.red +++ b/exercises/practice/triangle/triangle-test.red @@ -8,175 +8,175 @@ Red [ test-init/limit %triangle.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution -canonical-cases: [#( +canonical-cases: [#[ description: "all sides are equal" - input: #( + input: #[ sides: [2 2 2] - ) + ] expected: true function: "equilateral" uuid: "8b2c43ac-7257-43f9-b552-7631a91988af" -) #( +] #[ description: "any side is unequal" - input: #( + input: #[ sides: [2 3 2] - ) + ] expected: false function: "equilateral" uuid: "33eb6f87-0498-4ccf-9573-7f8c3ce92b7b" -) #( +] #[ description: "no sides are equal" - input: #( + input: #[ sides: [5 4 6] - ) + ] expected: false function: "equilateral" uuid: "c6585b7d-a8c0-4ad8-8a34-e21d36f7ad87" -) #( +] #[ description: "all zero sides is not a triangle" - input: #( + input: #[ sides: [0 0 0] - ) + ] expected: false function: "equilateral" uuid: "16e8ceb0-eadb-46d1-b892-c50327479251" -) #( +] #[ description: "sides may be floats" - input: #( + input: #[ sides: [0.5 0.5 0.5] - ) + ] expected: true function: "equilateral" uuid: "3022f537-b8e5-4cc1-8f12-fd775827a00c" -) #( +] #[ description: "last two sides are equal" - input: #( + input: #[ sides: [3 4 4] - ) + ] expected: true function: "isosceles" uuid: "cbc612dc-d75a-4c1c-87fc-e2d5edd70b71" -) #( +] #[ description: "first two sides are equal" - input: #( + input: #[ sides: [4 4 3] - ) + ] expected: true function: "isosceles" uuid: "e388ce93-f25e-4daf-b977-4b7ede992217" -) #( +] #[ description: "first and last sides are equal" - input: #( + input: #[ sides: [4 3 4] - ) + ] expected: true function: "isosceles" uuid: "d2080b79-4523-4c3f-9d42-2da6e81ab30f" -) #( +] #[ description: "equilateral triangles are also isosceles" - input: #( + input: #[ sides: [4 4 4] - ) + ] expected: true function: "isosceles" uuid: "8d71e185-2bd7-4841-b7e1-71689a5491d8" -) #( +] #[ description: "no sides are equal" - input: #( + input: #[ sides: [2 3 4] - ) + ] expected: false function: "isosceles" uuid: "840ed5f8-366f-43c5-ac69-8f05e6f10bbb" -) #( +] #[ description: "first triangle inequality violation" - input: #( + input: #[ sides: [1 1 3] - ) + ] expected: false function: "isosceles" uuid: "2eba0cfb-6c65-4c40-8146-30b608905eae" -) #( +] #[ description: "second triangle inequality violation" - input: #( + input: #[ sides: [1 3 1] - ) + ] expected: false function: "isosceles" uuid: "278469cb-ac6b-41f0-81d4-66d9b828f8ac" -) #( +] #[ description: "third triangle inequality violation" - input: #( + input: #[ sides: [3 1 1] - ) + ] expected: false function: "isosceles" uuid: "90efb0c7-72bb-4514-b320-3a3892e278ff" -) #( +] #[ description: "sides may be floats" - input: #( + input: #[ sides: [0.5 0.4 0.5] - ) + ] expected: true function: "isosceles" uuid: "adb4ee20-532f-43dc-8d31-e9271b7ef2bc" -) #( +] #[ description: "no sides are equal" - input: #( + input: #[ sides: [5 4 6] - ) + ] expected: true function: "scalene" uuid: "e8b5f09c-ec2e-47c1-abec-f35095733afb" -) #( +] #[ description: "all sides are equal" - input: #( + input: #[ sides: [4 4 4] - ) + ] expected: false function: "scalene" uuid: "2510001f-b44d-4d18-9872-2303e7977dc1" -) #( +] #[ description: "first and second sides are equal" - input: #( + input: #[ sides: [4 4 3] - ) + ] expected: false function: "scalene" uuid: "c6e15a92-90d9-4fb3-90a2-eef64f8d3e1e" -) #( +] #[ description: "first and third sides are equal" - input: #( + input: #[ sides: [3 4 3] - ) + ] expected: false function: "scalene" uuid: "3da23a91-a166-419a-9abf-baf4868fd985" -) #( +] #[ description: "second and third sides are equal" - input: #( + input: #[ sides: [4 3 3] - ) + ] expected: false function: "scalene" uuid: "b6a75d98-1fef-4c42-8e9a-9db854ba0a4d" -) #( +] #[ description: "may not violate triangle inequality" - input: #( + input: #[ sides: [7 3 2] - ) + ] expected: false function: "scalene" uuid: "70ad5154-0033-48b7-af2c-b8d739cd9fdc" -) #( +] #[ description: "sides may be floats" - input: #( + input: #[ sides: [0.5 0.4 0.6] - ) + ] expected: true function: "scalene" uuid: "26d9d59d-f8f1-40d3-ad58-ae4d54123d7d" -)] +]] foreach c-case canonical-cases [ diff --git a/exercises/practice/two-fer/two-fer-test.red b/exercises/practice/two-fer/two-fer-test.red index b29aec7..ddf8816 100644 --- a/exercises/practice/two-fer/two-fer-test.red +++ b/exercises/practice/two-fer/two-fer-test.red @@ -9,27 +9,27 @@ test-init/limit %two-fer.red 1 ; test-init/limit %.meta/example.red 1 ; test example solution canonical-cases: [ - #( + #[ description: "no name given" - input: #(name: none) + input: #[name: none] expected: "One for you, one for me." function: "two-fer" uuid: "1cf3e15a-a3d7-4a87-aeb3-ba1b43bc8dce" - ) - #( + ] + #[ description: "a name given" - input: #(name: "Alice") + input: #[name: "Alice"] expected: "One for Alice, one for me." function: "two-fer" uuid: "b4c6dbb8-b4fb-42c2-bafd-10785abe7709" - ) - #( + ] + #[ description: "another name given" - input: #(name: "Bob") + input: #[name: "Bob"] expected: "One for Bob, one for me." function: "two-fer" uuid: "3549048d-1a6e-4653-9a79-b0bda163e8d5" - ) + ] ]