Skip to content

Commit

Permalink
run map-conv.red utility
Browse files Browse the repository at this point in the history
  • Loading branch information
loziniak committed Apr 5, 2024
1 parent 82462c6 commit 20ef102
Show file tree
Hide file tree
Showing 36 changed files with 1,402 additions and 1,402 deletions.
4 changes: 2 additions & 2 deletions _tools/concepts-practice.red
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ Red [

config: load %../config.json

concepts-practice: #()
concepts-unlock: #()
concepts-practice: #[]
concepts-unlock: #[]

append-concept: function [
type [word!]
Expand Down
2 changes: 1 addition & 1 deletion _tools/generate-practice-exercise.red
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ canonical-data: either map? canonical-data: try [
] [
canonical-data
] [
#( cases: [])
#[ cases: []]
]

camel-to-kebab-case: function [
Expand Down
56 changes: 28 additions & 28 deletions exercises/practice/acronym/acronym-test.red
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
88 changes: 44 additions & 44 deletions exercises/practice/binary-search/binary-search-test.red
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
Loading

0 comments on commit 20ef102

Please sign in to comment.