Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions exercises/practice/atbash-cipher/test.fut
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ import "atbash_cipher"
-- input { "zmlyhgzxovrhlugvmzhgvkkrmthglmv" }
-- output { "anobstacleisoftenasteppingstone" }

-- encode boundary characters
-- ==
-- entry: test_encode
-- input { "/09:@AMNZ[`amnz{" }
-- output { "09znm aznma" }

entry test_encode (phrase: []u8): []u8 =
encode phrase

Expand Down
7 changes: 7 additions & 0 deletions exercises/practice/proverb/.docs/instructions.append.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Instructions append

## Input format

Each list of inputs is represented as a null-terminated string, with a newline character at the end of each input.

An example would be `"nail\nshoe\nhorse\nrider\nmessage\nbattle\nkingdom\n"`
7 changes: 3 additions & 4 deletions generators/exercises/atbash_cipher.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
def extra_cases_disabled():
def extra_cases():
return [
{
"description": "encode boundary characters",
Expand All @@ -14,9 +14,8 @@ def gen_test_case(prop, description, inp, expected, f):
f.write(f"-- {description}\n")
f.write("-- ==\n")
f.write(f"-- entry: test_{prop}\n")
f.write("-- input {" + f' "{phrase}" ' + "}\n")
f.write("-- output {" + f' "{expected}" ' + "}\n\n")
# f.write(f'-- output: { "{expected}" }\n\n')
f.write(f'-- input {{ "{phrase}" }}\n')
f.write(f'-- output {{ "{expected}" }}\n\n')


def gen_main(f):
Expand Down
12 changes: 2 additions & 10 deletions generators/exercises/pig_latin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@ def gen_test_case(prop, description, inp, expected, f):

f.write(f"-- {description}\n")
f.write("-- ==\n")
f.write("-- input {" + f' "{phrase}" ' + "}\n")
f.write("-- output {" + f' "{expected}" ' + "}\n\n")


def gen_true_test_case(prop, description, inp, expected, f):
phrase = inp["phrase"]
f.write(f"-- {description}\n")
f.write("-- ==\n")
f.write("-- input {" + f' "{phrase}" ' + "}\n")
f.write("-- output {" + f' "{expected}" ' + "}\n\n")
f.write(f'-- input {{ "{phrase}" }}\n')
f.write(f'-- output {{ "{expected}" }}\n\n')


def gen_main(f):
Expand Down
4 changes: 2 additions & 2 deletions generators/exercises/transpose.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def rectangular(lines):

f.write(f"-- {description}\n")
f.write("-- ==\n")
f.write("-- input { " + lines + " }\n")
f.write("-- output { " + expected + " }\n\n")
f.write(f"-- input {{ {lines} }}\n")
f.write(f"-- output {{ {expected} }}\n\n")


def gen_main(f):
Expand Down
4 changes: 2 additions & 2 deletions generators/exercises/twelve_days.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ def gen_test_case(prop, description, inp, expected, f):

f.write(f"-- {description}\n")
f.write("-- ==\n")
f.write("-- input {" + f" {start_verse} {end_verse} " + "}\n")
f.write("-- output {" + f' "{expected}" ' + "}\n\n")
f.write(f"-- input {{ {start_verse} {end_verse} }}\n")
f.write(f'-- output {{ "{expected}" }}\n\n')


def gen_main(f):
Expand Down
4 changes: 2 additions & 2 deletions generators/exercises/variable_length_quantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def serialize(message):
f.write(f"-- {description}\n")
f.write("-- ==\n")
f.write(f"-- entry: test_{prop}\n")
f.write("-- input {" + f" {integers} " + "}\n")
f.write(f"-- input {{ {integers} }}\n")
if isinstance(expected, dict):
f.write("-- error: Error*\n\n")
else:
expected = serialize(expected)
f.write("-- output {" + f" {expected} " + "}\n\n")
f.write(f"-- output {{ {expected} }}\n\n")


def gen_main(f):
Expand Down
4 changes: 2 additions & 2 deletions generators/exercises/wordy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ def gen_test_case(prop, description, inp, expected, f):

f.write(f"-- {description}\n")
f.write("-- ==\n")
f.write("-- input {" + f' "{question}" ' + "}\n")
f.write(f'-- input {{ "{question}" }}\n')

if isinstance(expected, dict):
f.write("-- error: Error*\n\n")
else:
f.write("-- output {" + f" {expected} " + "}\n\n")
f.write(f"-- output {{ {expected} }}\n\n")


def gen_main(f):
Expand Down
4 changes: 2 additions & 2 deletions generators/exercises/yacht.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ def gen_test_case(prop, description, inp, expected, f):

f.write(f"-- {description}\n")
f.write("-- ==\n")
f.write("-- input {" + f' {dice} "{category}" ' + "}\n")
f.write("-- output {" + f" {expected} " + "}\n\n")
f.write(f'-- input {{ {dice} "{category}" }}\n')
f.write(f"-- output {{ {expected} }}\n\n")


def gen_main(f):
Expand Down
2 changes: 1 addition & 1 deletion generators/exercises/zebra_puzzle.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def gen_test_case(prop, description, inp, expected, f):
f.write("-- ==\n")
f.write(f"-- entry: test_{prop}\n")
f.write("-- input {}\n")
f.write("-- output {" + f' "{expected}" ' + "}\n\n")
f.write(f'-- output {{ "{expected}" }}\n\n')


def gen_main(f):
Expand Down