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
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
DROP TABLE IF EXISTS tests;
CREATE TABLE IF NOT EXISTS tests (
-- uuid and description are taken from the test.toml file
uuid TEXT PRIMARY KEY,
description TEXT NOT NULL,
-- The following section is needed by the online test-runner
status TEXT DEFAULT 'fail',
message TEXT,
output TEXT,
test_code TEXT,
task_id INTEGER DEFAULT NULL,
-- Here are columns for the actual tests
property TEST NOT NULL,
msg TEXT NOT NULL,
rails INTEGER NOT NULL,
expected TEXT NOT NULL
);

INSERT INTO tests (uuid, description, property, msg, rails, expected)
VALUES
{%- for case in cases %}
(
'{{ case["uuid"] }}',
'{{ case["description"] }}',
'{{ case["property"] }}',
'{{ case["input"]["msg"] }}',
{{ case["input"]["rails"] }},
'{{ case["expected"] }}'
{%- if loop.last %}
);
{%- else %}
),
{%- endif %}
{%- endfor %}
3 changes: 3 additions & 0 deletions exercises/practice/rail-fence-cipher/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ [case["property"], case["input"]["msg"], case["input"]["rails"]] | tocsv }},""
{% endfor %}
54 changes: 48 additions & 6 deletions exercises/practice/rail-fence-cipher/create_test_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,51 @@ CREATE TABLE IF NOT EXISTS tests (

INSERT INTO tests (uuid, description, property, msg, rails, expected)
VALUES
('46dc5c50-5538-401d-93a5-41102680d068', 'encode with two rails', 'encode', 'XOXOXOXOXOXOXOXOXO', 2, 'XXXXXXXXXOOOOOOOOO'),
('25691697-fbd8-4278-8c38-b84068b7bc29', 'encode with three rails', 'encode', 'WEAREDISCOVEREDFLEEATONCE', 3, 'WECRLTEERDSOEEFEAOCAIVDEN'),
('384f0fea-1442-4f1a-a7c4-5cbc2044002c', 'encode with ending in the middle', 'encode', 'EXERCISES', 4, 'ESXIEECSR'),
('cd525b17-ec34-45ef-8f0e-4f27c24a7127', 'decode with three rails', 'decode', 'TEITELHDVLSNHDTISEIIEA', 3, 'THEDEVILISINTHEDETAILS'),
('dd7b4a98-1a52-4e5c-9499-cbb117833507', 'decode with five rails', 'decode', 'EIEXMSMESAORIWSCE', 5, 'EXERCISMISAWESOME'),
('93e1ecf4-fac9-45d9-9cd2-591f47d3b8d3', 'decode with six rails', 'decode', '133714114238148966225439541018335470986172518171757571896261', 6, '112358132134558914423337761098715972584418167651094617711286');
(
'46dc5c50-5538-401d-93a5-41102680d068',
'encode with two rails',
'encode',
'XOXOXOXOXOXOXOXOXO',
2,
'XXXXXXXXXOOOOOOOOO'
),
(
'25691697-fbd8-4278-8c38-b84068b7bc29',
'encode with three rails',
'encode',
'WEAREDISCOVEREDFLEEATONCE',
3,
'WECRLTEERDSOEEFEAOCAIVDEN'
),
(
'384f0fea-1442-4f1a-a7c4-5cbc2044002c',
'encode with ending in the middle',
'encode',
'EXERCISES',
4,
'ESXIEECSR'
),
(
'cd525b17-ec34-45ef-8f0e-4f27c24a7127',
'decode with three rails',
'decode',
'TEITELHDVLSNHDTISEIIEA',
3,
'THEDEVILISINTHEDETAILS'
),
(
'dd7b4a98-1a52-4e5c-9499-cbb117833507',
'decode with five rails',
'decode',
'EIEXMSMESAORIWSCE',
5,
'EXERCISMISAWESOME'
),
(
'93e1ecf4-fac9-45d9-9cd2-591f47d3b8d3',
'decode with six rails',
'decode',
'133714114238148966225439541018335470986172518171757571896261',
6,
'112358132134558914423337761098715972584418167651094617711286'
);
12 changes: 6 additions & 6 deletions exercises/practice/rail-fence-cipher/data.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
encode,XOXOXOXOXOXOXOXOXO,2,
encode,WEAREDISCOVEREDFLEEATONCE,3,
encode,EXERCISES,4,
decode,TEITELHDVLSNHDTISEIIEA,3,
decode,EIEXMSMESAORIWSCE,5,
decode,133714114238148966225439541018335470986172518171757571896261,6,
"encode","XOXOXOXOXOXOXOXOXO",2,""
"encode","WEAREDISCOVEREDFLEEATONCE",3,""
"encode","EXERCISES",4,""
"decode","TEITELHDVLSNHDTISEIIEA",3,""
"decode","EIEXMSMESAORIWSCE",5,""
"decode","133714114238148966225439541018335470986172518171757571896261",6,""
3 changes: 3 additions & 0 deletions exercises/practice/raindrops/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ [case["input"]["number"]] | tocsv }},""
{% endfor %}
3 changes: 3 additions & 0 deletions exercises/practice/resistor-color-duo/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ case["input"]["colors"][0] }},{{ case["input"]["colors"][1] }},""
{% endfor %}
12 changes: 6 additions & 6 deletions exercises/practice/resistor-color-duo/data.csv
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"brown","black",
"blue","grey",
"yellow","violet",
"white","red",
"orange","orange",
"black","brown",
brown,black,""
blue,grey,""
yellow,violet,""
white,red,""
orange,orange,""
black,brown,""
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
DROP TABLE IF EXISTS tests;

CREATE TABLE IF NOT EXISTS tests (
-- uuid and description are taken from the test.toml file
uuid TEXT PRIMARY KEY,
description TEXT NOT NULL,
-- The following section is needed by the online test-runner
status TEXT DEFAULT 'fail',
message TEXT,
output TEXT,
test_code TEXT,
task_id INTEGER DEFAULT NULL,
-- Here are columns for the actual tests
color1 TEXT NOT NULL,
color2 TEXT NOT NULL,
color3 TEXT NOT NULL,
expected TEXT NOT NULL
);

INSERT INTO
tests (
uuid,
description,
color1,
color2,
color3,
expected
)
VALUES
{%- for case in cases %}
(
'{{ case["uuid"] }}',
'{{ case["description"] }}',
{%- for color in case["input"]["colors"] %}
'{{ color }}',
{%- endfor %}
'{{ case["expected"]["value"] }} {{ case["expected"]["unit"] }}'
{%- if loop.last %}
);
{%- else %}
),
{%- endif %}
{%- endfor %}
3 changes: 3 additions & 0 deletions exercises/practice/resistor-color-trio/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ case["input"]["colors"] | join(",") }},""
{% endfor %}
18 changes: 9 additions & 9 deletions exercises/practice/resistor-color-trio/data.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"orange","orange","black",""
"blue","grey","brown",""
"red","black","red",""
"green","brown","orange",""
"yellow","violet","yellow",""
"blue","violet","blue",""
"black","black","black",""
"white","white","white",""
"black","grey","black",""
orange,orange,black,""
blue,grey,brown,""
red,black,red,""
green,brown,orange,""
yellow,violet,yellow,""
blue,violet,blue,""
black,black,black,""
white,white,white,""
black,grey,black,""
3 changes: 3 additions & 0 deletions exercises/practice/resistor-color/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ [case["input"]["color"]] | tocsv }},""
{% endfor %}
6 changes: 3 additions & 3 deletions exercises/practice/resistor-color/data.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"black",
"white",
"orange",
"black",""
"white",""
"orange",""
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
DROP TABLE IF EXISTS tests;

CREATE TABLE IF NOT EXISTS tests (
-- uuid and description are taken from the test.toml file
uuid TEXT PRIMARY KEY,
description TEXT NOT NULL,
-- The following section is needed by the online test-runner
status TEXT DEFAULT 'fail',
message TEXT,
output TEXT,
test_code TEXT,
task_id INTEGER DEFAULT NULL,
-- Here are columns for the actual tests
input TEXT NOT NULL,
expected TEXT NOT NULL
);

INSERT INTO
tests (uuid, description, input, expected)
VALUES
{%- for case in cases %}
(
'{{ case["uuid"] }}',
'{{ case["description"] }}',
{{ case["input"]["value"] | quote }},
{{ case["expected"] | quote }}
{%- if loop.last %}
);
{%- else %}
),
{%- endif %}
{%- endfor %}
3 changes: 3 additions & 0 deletions exercises/practice/reverse-string/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ [case["input"]["value"]] | tocsv }},""
{% endfor %}
3 changes: 3 additions & 0 deletions exercises/practice/rna-transcription/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ [case["input"]["dna"]] | tocsv }},""
{% endfor %}
3 changes: 3 additions & 0 deletions exercises/practice/roman-numerals/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ [case["input"]["number"]] | tocsv }},""
{% endfor %}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
DROP TABLE IF EXISTS tests;

CREATE TABLE IF NOT EXISTS tests (
-- uuid and description are taken from the test.toml file
uuid TEXT PRIMARY KEY,
description TEXT NOT NULL,
-- The following section is needed by the online test-runner
status TEXT DEFAULT 'fail',
message TEXT,
output TEXT,
test_code TEXT,
task_id INTEGER DEFAULT NULL,
-- Here are columns for the actual tests
text TEXT NOT NULL,
shift_key INTEGER NOT NULL,
expected TEXT NOT NULL
);

INSERT INTO
tests (uuid, description, text, shift_key, expected)
VALUES
{%- for case in cases %}
(
'{{ case["uuid"] }}',
'{{ case["description"] }}',
{{ case["input"]["text"] | quote }},
{{ case["input"]["shiftKey"] }},
{{ case["expected"] | quote }}
{%- if loop.last %}
);
{%- else %}
),
{%- endif %}
{%- endfor %}
3 changes: 3 additions & 0 deletions exercises/practice/rotational-cipher/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ [case["input"]["text"], case["input"]["shiftKey"]] | tocsv }},""
{% endfor %}
20 changes: 10 additions & 10 deletions exercises/practice/rotational-cipher/data.csv
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"a",0,
"a",1,
"a",26,
"m",13,
"n",13,
"OMG",5,
"O M G",5,
"Testing 1 2 3 testing",4,
"Let's eat, Grandma!",21,
"The quick brown fox jumps over the lazy dog.",13,
"a",0,""
"a",1,""
"a",26,""
"m",13,""
"n",13,""
"OMG",5,""
"O M G",5,""
"Testing 1 2 3 testing",4,""
"Let's eat, Grandma!",21,""
"The quick brown fox jumps over the lazy dog.",13,""
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
DROP TABLE IF EXISTS tests;

CREATE TABLE IF NOT EXISTS tests (
-- uuid and description are taken from the test.toml file
uuid TEXT PRIMARY KEY,
description TEXT NOT NULL,
-- The following section is needed by the online test-runner
status TEXT DEFAULT 'fail',
message TEXT,
output TEXT,
test_code TEXT,
task_id INTEGER DEFAULT NULL,
-- Here are columns for the actual tests
property TEXT NOT NULL,
string TEXT NOT NULL,
expected TEXT NOT NULL
);

INSERT INTO
tests (uuid, description, property, string, expected)
VALUES
{%- for case in cases %}
(
'{{ case["uuid"] }}',
'{{ case["description"] }}',
'{{ case["property"] }}',
{{ case["input"]["string"] | quote }},
{{ case["expected"] | quote }}
{%- if loop.last %}
);
{%- else %}
),
{%- endif %}
{%- endfor %}
3 changes: 3 additions & 0 deletions exercises/practice/run-length-encoding/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ [case["property"], case["input"]["string"]] | tocsv }},""
{% endfor %}
26 changes: 13 additions & 13 deletions exercises/practice/run-length-encoding/data.csv
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"encode","",
"encode","XYZ",
"encode","AABBBCCCC",
"encode","WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB",
"encode"," hsqq qww ",
"encode","aabbbcccc",
"decode","",
"decode","XYZ",
"decode","2A3B4C",
"decode","12WB12W3B24WB",
"decode","2 hs2q q2w2 ",
"decode","2a3b4c",
"consistency","zzz ZZ zZ",
"encode","",""
"encode","XYZ",""
"encode","AABBBCCCC",""
"encode","WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWB",""
"encode"," hsqq qww ",""
"encode","aabbbcccc",""
"decode","",""
"decode","XYZ",""
"decode","2A3B4C",""
"decode","12WB12W3B24WB",""
"decode","2 hs2q q2w2 ",""
"decode","2a3b4c",""
"consistency","zzz ZZ zZ",""