diff --git a/exercises/practice/rail-fence-cipher/.meta/template.create_test_table.j2 b/exercises/practice/rail-fence-cipher/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..5193f9b7 --- /dev/null +++ b/exercises/practice/rail-fence-cipher/.meta/template.create_test_table.j2 @@ -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 %} diff --git a/exercises/practice/rail-fence-cipher/.meta/template.data.j2 b/exercises/practice/rail-fence-cipher/.meta/template.data.j2 new file mode 100644 index 00000000..02ff01d5 --- /dev/null +++ b/exercises/practice/rail-fence-cipher/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["property"], case["input"]["msg"], case["input"]["rails"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/rail-fence-cipher/create_test_table.sql b/exercises/practice/rail-fence-cipher/create_test_table.sql index 4af95588..035b977a 100644 --- a/exercises/practice/rail-fence-cipher/create_test_table.sql +++ b/exercises/practice/rail-fence-cipher/create_test_table.sql @@ -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' + ); diff --git a/exercises/practice/rail-fence-cipher/data.csv b/exercises/practice/rail-fence-cipher/data.csv index 154f0392..eb895dc8 100644 --- a/exercises/practice/rail-fence-cipher/data.csv +++ b/exercises/practice/rail-fence-cipher/data.csv @@ -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,"" diff --git a/exercises/practice/raindrops/.meta/template.data.j2 b/exercises/practice/raindrops/.meta/template.data.j2 new file mode 100644 index 00000000..64546678 --- /dev/null +++ b/exercises/practice/raindrops/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["number"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/resistor-color-duo/.meta/template.data.j2 b/exercises/practice/resistor-color-duo/.meta/template.data.j2 new file mode 100644 index 00000000..62ce750b --- /dev/null +++ b/exercises/practice/resistor-color-duo/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ case["input"]["colors"][0] }},{{ case["input"]["colors"][1] }},"" +{% endfor %} diff --git a/exercises/practice/resistor-color-duo/data.csv b/exercises/practice/resistor-color-duo/data.csv index 5c3a0af5..7fb630a0 100644 --- a/exercises/practice/resistor-color-duo/data.csv +++ b/exercises/practice/resistor-color-duo/data.csv @@ -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,"" diff --git a/exercises/practice/resistor-color-trio/.meta/template.create_test_table.j2 b/exercises/practice/resistor-color-trio/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..238ef178 --- /dev/null +++ b/exercises/practice/resistor-color-trio/.meta/template.create_test_table.j2 @@ -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 %} diff --git a/exercises/practice/resistor-color-trio/.meta/template.data.j2 b/exercises/practice/resistor-color-trio/.meta/template.data.j2 new file mode 100644 index 00000000..8ef8b26a --- /dev/null +++ b/exercises/practice/resistor-color-trio/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ case["input"]["colors"] | join(",") }},"" +{% endfor %} diff --git a/exercises/practice/resistor-color-trio/data.csv b/exercises/practice/resistor-color-trio/data.csv index d866d59c..000f763e 100644 --- a/exercises/practice/resistor-color-trio/data.csv +++ b/exercises/practice/resistor-color-trio/data.csv @@ -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,"" diff --git a/exercises/practice/resistor-color/.meta/template.data.j2 b/exercises/practice/resistor-color/.meta/template.data.j2 new file mode 100644 index 00000000..2623e2ee --- /dev/null +++ b/exercises/practice/resistor-color/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["color"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/resistor-color/data.csv b/exercises/practice/resistor-color/data.csv index c0137dab..fcd457d9 100644 --- a/exercises/practice/resistor-color/data.csv +++ b/exercises/practice/resistor-color/data.csv @@ -1,3 +1,3 @@ -"black", -"white", -"orange", +"black","" +"white","" +"orange","" diff --git a/exercises/practice/reverse-string/.meta/template.create_test_table.j2 b/exercises/practice/reverse-string/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..560578f4 --- /dev/null +++ b/exercises/practice/reverse-string/.meta/template.create_test_table.j2 @@ -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 %} diff --git a/exercises/practice/reverse-string/.meta/template.data.j2 b/exercises/practice/reverse-string/.meta/template.data.j2 new file mode 100644 index 00000000..272f6744 --- /dev/null +++ b/exercises/practice/reverse-string/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["value"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/rna-transcription/.meta/template.data.j2 b/exercises/practice/rna-transcription/.meta/template.data.j2 new file mode 100644 index 00000000..0fa027df --- /dev/null +++ b/exercises/practice/rna-transcription/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["dna"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/roman-numerals/.meta/template.data.j2 b/exercises/practice/roman-numerals/.meta/template.data.j2 new file mode 100644 index 00000000..64546678 --- /dev/null +++ b/exercises/practice/roman-numerals/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["number"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/rotational-cipher/.meta/template.create_test_table.j2 b/exercises/practice/rotational-cipher/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..7e64183b --- /dev/null +++ b/exercises/practice/rotational-cipher/.meta/template.create_test_table.j2 @@ -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 %} diff --git a/exercises/practice/rotational-cipher/.meta/template.data.j2 b/exercises/practice/rotational-cipher/.meta/template.data.j2 new file mode 100644 index 00000000..e8924693 --- /dev/null +++ b/exercises/practice/rotational-cipher/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["text"], case["input"]["shiftKey"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/rotational-cipher/data.csv b/exercises/practice/rotational-cipher/data.csv index 88058c9f..16b043e6 100644 --- a/exercises/practice/rotational-cipher/data.csv +++ b/exercises/practice/rotational-cipher/data.csv @@ -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,"" diff --git a/exercises/practice/run-length-encoding/.meta/template.create_test_table.j2 b/exercises/practice/run-length-encoding/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..68ea6505 --- /dev/null +++ b/exercises/practice/run-length-encoding/.meta/template.create_test_table.j2 @@ -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 %} diff --git a/exercises/practice/run-length-encoding/.meta/template.data.j2 b/exercises/practice/run-length-encoding/.meta/template.data.j2 new file mode 100644 index 00000000..5745b8da --- /dev/null +++ b/exercises/practice/run-length-encoding/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["property"], case["input"]["string"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/run-length-encoding/data.csv b/exercises/practice/run-length-encoding/data.csv index eb64a4d2..96f7be27 100644 --- a/exercises/practice/run-length-encoding/data.csv +++ b/exercises/practice/run-length-encoding/data.csv @@ -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",""