diff --git a/exercises/practice/pangram/.meta/template.create_test_table.j2 b/exercises/practice/pangram/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..6225ad0d --- /dev/null +++ b/exercises/practice/pangram/.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 + sentence TEXT NOT NULL, + expected BOOLEAN NOT NULL +); + +INSERT INTO + tests (uuid, description, sentence, expected) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + {{ case["description"] | quote }}, + '{{ case["input"]["sentence"] }}', + {{ case["expected"] }} +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/pangram/.meta/template.data.j2 b/exercises/practice/pangram/.meta/template.data.j2 new file mode 100644 index 00000000..ac50cd39 --- /dev/null +++ b/exercises/practice/pangram/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["sentence"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/pangram/create_test_table.sql b/exercises/practice/pangram/create_test_table.sql index f4ee586f..dbaaeea6 100644 --- a/exercises/practice/pangram/create_test_table.sql +++ b/exercises/practice/pangram/create_test_table.sql @@ -22,59 +22,59 @@ VALUES '64f61791-508e-4f5c-83ab-05de042b0149', 'empty sentence', '', - false + False ), ( '74858f80-4a4d-478b-8a5e-c6477e4e4e84', 'perfect lower case', 'abcdefghijklmnopqrstuvwxyz', - true + True ), ( '61288860-35ca-4abe-ba08-f5df76ecbdcd', 'only lower case', 'the quick brown fox jumps over the lazy dog', - true + True ), ( '6564267d-8ac5-4d29-baf2-e7d2e304a743', 'missing the letter ''x''', 'a quick movement of the enemy will jeopardize five gunboats', - false + False ), ( 'c79af1be-d715-4cdb-a5f2-b2fa3e7e0de0', 'missing the letter ''h''', 'five boxing wizards jump quickly at it', - false + False ), ( 'd835ec38-bc8f-48e4-9e36-eb232427b1df', 'with underscores', 'the_quick_brown_fox_jumps_over_the_lazy_dog', - true + True ), ( '8cc1e080-a178-4494-b4b3-06982c9be2a8', 'with numbers', 'the 1 quick brown fox jumps over the 2 lazy dogs', - true + True ), ( 'bed96b1c-ff95-45b8-9731-fdbdcb6ede9a', 'missing letters replaced by numbers', '7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog', - false + False ), ( '938bd5d8-ade5-40e2-a2d9-55a338a01030', 'mixed case and punctuation', '"Five quacking Zephyrs jolt my wax bed."', - true + True ), ( '7138e389-83e4-4c6e-8413-1e40a0076951', 'a-m and A-M are 26 different characters but not a pangram', 'abcdefghijklm ABCDEFGHIJKLM', - false + False ); diff --git a/exercises/practice/pascals-triangle/.meta/template.data.j2 b/exercises/practice/pascals-triangle/.meta/template.data.j2 new file mode 100644 index 00000000..307f1bd8 --- /dev/null +++ b/exercises/practice/pascals-triangle/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["count"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/pascals-triangle/data.csv b/exercises/practice/pascals-triangle/data.csv index be0ab697..fed934ce 100644 --- a/exercises/practice/pascals-triangle/data.csv +++ b/exercises/practice/pascals-triangle/data.csv @@ -5,4 +5,4 @@ 4,"" 5,"" 6,"" -10,"" \ No newline at end of file +10,"" diff --git a/exercises/practice/perfect-numbers/.meta/template.create_test_table.j2 b/exercises/practice/perfect-numbers/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..6f68f001 --- /dev/null +++ b/exercises/practice/perfect-numbers/.meta/template.create_test_table.j2 @@ -0,0 +1,45 @@ +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 + number INTEGER NOT NULL, + expected_result TEXT, + expected_error TEXT +); + +INSERT INTO + tests ( + uuid, + description, + number, + expected_result, + expected_error + ) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + {{ case["input"]["number"] }}, + +{%- if not case["expect_error"] %} + '{{ case["expected"] }}', +{%- else %} + NULL, +{%- endif %} + {{ case.get("expect_error_msg") | quote }} +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/perfect-numbers/.meta/template.data.j2 b/exercises/practice/perfect-numbers/.meta/template.data.j2 new file mode 100644 index 00000000..64546678 --- /dev/null +++ b/exercises/practice/perfect-numbers/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["number"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/perfect-numbers/create_test_table.sql b/exercises/practice/perfect-numbers/create_test_table.sql index 36361987..9926de82 100644 --- a/exercises/practice/perfect-numbers/create_test_table.sql +++ b/exercises/practice/perfect-numbers/create_test_table.sql @@ -28,98 +28,98 @@ VALUES ( '163e8e86-7bfd-4ee2-bd68-d083dc3381a3', 'Smallest perfect number is classified correctly', - 6, + '6', 'perfect', NULL ), ( '169a7854-0431-4ae0-9815-c3b6d967436d', 'Medium perfect number is classified correctly', - 28, + '28', 'perfect', NULL ), ( 'ee3627c4-7b36-4245-ba7c-8727d585f402', 'Large perfect number is classified correctly', - 33550336, + '33550336', 'perfect', NULL ), ( '80ef7cf8-9ea8-49b9-8b2d-d9cb3db3ed7e', 'Smallest abundant number is classified correctly', - 12, + '12', 'abundant', NULL ), ( '3e300e0d-1a12-4f11-8c48-d1027165ab60', 'Medium abundant number is classified correctly', - 30, + '30', 'abundant', NULL ), ( 'ec7792e6-8786-449c-b005-ce6dd89a772b', 'Large abundant number is classified correctly', - 33550335, + '33550335', 'abundant', NULL ), ( '05f15b93-849c-45e9-9c7d-1ea131ef7d10', 'Perfect square abundant number is classified correctly', - 196, + '196', 'abundant', NULL ), ( 'e610fdc7-2b6e-43c3-a51c-b70fb37413ba', 'Smallest prime deficient number is classified correctly', - 2, + '2', 'deficient', NULL ), ( '0beb7f66-753a-443f-8075-ad7fbd9018f3', 'Smallest non-prime deficient number is classified correctly', - 4, + '4', 'deficient', NULL ), ( '1c802e45-b4c6-4962-93d7-1cad245821ef', 'Medium deficient number is classified correctly', - 32, + '32', 'deficient', NULL ), ( '47dd569f-9e5a-4a11-9a47-a4e91c8c28aa', 'Large deficient number is classified correctly', - 33550337, + '33550337', 'deficient', NULL ), ( 'a696dec8-6147-4d68-afad-d38de5476a56', 'Edge case (no factors other than itself) is classified correctly', - 1, + '1', 'deficient', NULL ), ( '72445cee-660c-4d75-8506-6c40089dc302', 'Zero is rejected (as it is not a positive integer)', - 0, + '0', NULL, 'Classification is only possible for positive integers.' ), ( '2d72ce2c-6802-49ac-8ece-c790ba3dae13', 'Negative integer is rejected (as it is not a positive integer)', - -1, + '-1', NULL, 'Classification is only possible for positive integers.' ); diff --git a/exercises/practice/perfect-numbers/data.csv b/exercises/practice/perfect-numbers/data.csv index b176ce57..c5ae1f0b 100644 --- a/exercises/practice/perfect-numbers/data.csv +++ b/exercises/practice/perfect-numbers/data.csv @@ -1,14 +1,14 @@ -6,, -28,, -33550336,, -12,, -30,, -196,, -33550335,, -2,, -4,, -32,, -33550337,, -1,, -0,, --1,, +6,"" +28,"" +33550336,"" +12,"" +30,"" +33550335,"" +196,"" +2,"" +4,"" +32,"" +33550337,"" +1,"" +0,"" +-1,"" diff --git a/exercises/practice/phone-number/.meta/template.create_test_table.j2 b/exercises/practice/phone-number/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..52994572 --- /dev/null +++ b/exercises/practice/phone-number/.meta/template.create_test_table.j2 @@ -0,0 +1,44 @@ +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 + phrase TEXT NOT NULL, + expected_result TEXT, + expected_error TEXT +); + +INSERT INTO + tests ( + uuid, + description, + phrase, + expected_result, + expected_error + ) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '{{ case["input"]["phrase"] }}', +{%- if not case["expect_error"] %} + '{{ case["expected"] }}', +{%- else %} + NULL, +{%- endif %} + {{ case.get("expect_error_msg") | quote }} +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/phone-number/.meta/template.data.j2 b/exercises/practice/phone-number/.meta/template.data.j2 new file mode 100644 index 00000000..4abdb0cb --- /dev/null +++ b/exercises/practice/phone-number/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["phrase"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/phone-number/data.csv b/exercises/practice/phone-number/data.csv index 25a2f217..8fd3f337 100644 --- a/exercises/practice/phone-number/data.csv +++ b/exercises/practice/phone-number/data.csv @@ -1,18 +1,18 @@ -"(223) 456-7890",, -"223.456.7890",, -"223 456 7890 ",, -"123456789",, -"22234567890",, -"12234567890",, -"+1 (223) 456-7890",, -"321234567890",, -"523-abc-7890",, -"523-@:!-7890",, -"(023) 456-7890",, -"(123) 456-7890",, -"(223) 056-7890",, -"(223) 156-7890",, -"1 (023) 456-7890",, -"1 (123) 456-7890",, -"1 (223) 056-7890",, -"1 (223) 156-7890",, +"(223) 456-7890","" +"223.456.7890","" +"223 456 7890 ","" +"123456789","" +"22234567890","" +"12234567890","" +"+1 (223) 456-7890","" +"321234567890","" +"523-abc-7890","" +"523-@:!-7890","" +"(023) 456-7890","" +"(123) 456-7890","" +"(223) 056-7890","" +"(223) 156-7890","" +"1 (023) 456-7890","" +"1 (123) 456-7890","" +"1 (223) 056-7890","" +"1 (223) 156-7890","" diff --git a/exercises/practice/pig-latin/.meta/template.create_test_table.j2 b/exercises/practice/pig-latin/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..97faf6cf --- /dev/null +++ b/exercises/practice/pig-latin/.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 + phrase TEXT NOT NULL, + expected TEXT NOT NULL +); + +INSERT INTO + tests (uuid, description, phrase, expected) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '{{ case["input"]["phrase"] }}', + '{{ case["expected"] }}' +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/pig-latin/.meta/template.data.j2 b/exercises/practice/pig-latin/.meta/template.data.j2 new file mode 100644 index 00000000..4abdb0cb --- /dev/null +++ b/exercises/practice/pig-latin/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["phrase"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/pig-latin/data.csv b/exercises/practice/pig-latin/data.csv index d9841bef..7de88845 100644 --- a/exercises/practice/pig-latin/data.csv +++ b/exercises/practice/pig-latin/data.csv @@ -1,23 +1,23 @@ -"apple", -"ear", -"igloo", -"object", -"under", -"equal", -"pig", -"koala", -"xenon", -"qat", -"liquid", -"chair", -"queen", -"square", -"therapy", -"thrush", -"school", -"yttria", -"xray", -"yellow", -"rhythm", -"my", -"quick fast run", +"apple","" +"ear","" +"igloo","" +"object","" +"under","" +"equal","" +"pig","" +"koala","" +"xenon","" +"qat","" +"liquid","" +"chair","" +"queen","" +"square","" +"therapy","" +"thrush","" +"school","" +"yttria","" +"xray","" +"yellow","" +"rhythm","" +"my","" +"quick fast run","" diff --git a/exercises/practice/poker/.meta/template.create_test_table.j2 b/exercises/practice/poker/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..85979237 --- /dev/null +++ b/exercises/practice/poker/.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 + hands TEXT NOT NULL, -- json array + expected TEXT NOT NULL -- json array +); + +INSERT INTO + tests (uuid, description, hands, expected) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '[{{ case["input"]["hands"] | tocsv }}]', + '[{{ case["expected"] | tocsv }}]' +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/poker/.meta/template.data.j2 b/exercises/practice/poker/.meta/template.data.j2 new file mode 100644 index 00000000..8e32ac4b --- /dev/null +++ b/exercises/practice/poker/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["hands"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/poker/data.csv b/exercises/practice/poker/data.csv index bb7158b9..a540d991 100644 --- a/exercises/practice/poker/data.csv +++ b/exercises/practice/poker/data.csv @@ -1,37 +1,37 @@ -"[""4S 5S 7H 8D JC""]", -"[""4D 5S 6S 8D 3C"",""2S 4C 7S 9H 10H"",""3S 4S 5D 6H JH""]", -"[""4D 5S 6S 8D 3C"",""2S 4C 7S 9H 10H"",""3S 4S 5D 6H JH"",""3H 4H 5C 6C JD""]", -"[""3S 5H 6S 8D 7H"",""2S 5D 6D 8C 7S""]", -"[""2S 5H 6S 8D 7H"",""3S 4D 6D 8C 7S""]", -"[""4S 5H 6C 8D KH"",""2S 4H 6S 4D JH""]", -"[""4S 2H 6S 2D JH"",""2S 4H 6C 4D JD""]", -"[""4H 4S AH JC 3D"",""4C 4D AS 5D 6C""]", -"[""2S 8H 6S 8D JH"",""4S 5H 4C 8C 5C""]", -"[""2S 8H 2D 8D 3H"",""4S 5H 4C 8S 5D""]", -"[""2S QS 2C QD JH"",""JD QH JS 8D QC""]", -"[""JD QH JS 8D QC"",""JS QS JC 2D QD""]", -"[""6S 6H 3S 3H AS"",""7H 7S 2H 2S AC""]", -"[""5C 2S 5S 4H 4C"",""6S 2S 6H 7C 2C""]", -"[""2S 8H 2H 8D JH"",""4S 5H 4C 8S 4H""]", -"[""2S 2H 2C 8D JH"",""4S AH AS 8C AD""]", -"[""5S AH AS 7C AD"",""4S AH AS 8C AD""]", -"[""4S 5H 4C 8D 4H"",""3S 4D 2S 6D 5C""]", -"[""4S 5H 4C 8D 4H"",""10D JH QS KD AC""]", -"[""4S 5H 4C 8D 4H"",""4D AH 3S 2D 5C""]", -"[""2C 3D 7H 5H 2S"",""QS KH AC 2D 3S""]", -"[""4S 6C 7S 8D 5H"",""5S 7H 8S 9D 6H""]", -"[""2H 3C 4D 5D 6H"",""4S AH 3S 2D 5H""]", -"[""4C 6H 7D 8D 5H"",""2S 4S 5S 6S 7S""]", -"[""2H 7H 8H 9H 6H"",""3S 5S 6S 7S 8S""]", -"[""3H 6H 7H 8H 5H"",""4S 5H 4C 5D 4H""]", -"[""4H 4S 4D 9S 9D"",""5H 5S 5D 8S 8D""]", -"[""5H 5S 5D 9S 9D"",""5H 5S 5D 8S 8D""]", -"[""4S 5H 4D 5D 4H"",""3S 3H 2S 3D 3C""]", -"[""2S 2H 2C 8D 2D"",""4S 5H 5S 5D 5C""]", -"[""3S 3H 2S 3D 3C"",""3S 3H 4S 3D 3C""]", -"[""4S 5H 5S 5D 5C"",""7S 8S 9S 6S 10S""]", -"[""KC AH AS AD AC"",""10C JC QC KC AC""]", -"[""KS AH AS AD AC"",""4H AH 3H 2H 5H""]", -"[""2C AC QC 10C KC"",""QH KH AH 2H 3H""]", -"[""4H 6H 7H 8H 5H"",""5S 7S 8S 9S 6S""]", -"[""2H 3H 4H 5H 6H"",""4D AD 3D 2D 5D""]", +"[""4S 5S 7H 8D JC""]","" +"[""4D 5S 6S 8D 3C"",""2S 4C 7S 9H 10H"",""3S 4S 5D 6H JH""]","" +"[""4D 5S 6S 8D 3C"",""2S 4C 7S 9H 10H"",""3S 4S 5D 6H JH"",""3H 4H 5C 6C JD""]","" +"[""3S 5H 6S 8D 7H"",""2S 5D 6D 8C 7S""]","" +"[""2S 5H 6S 8D 7H"",""3S 4D 6D 8C 7S""]","" +"[""4S 5H 6C 8D KH"",""2S 4H 6S 4D JH""]","" +"[""4S 2H 6S 2D JH"",""2S 4H 6C 4D JD""]","" +"[""4H 4S AH JC 3D"",""4C 4D AS 5D 6C""]","" +"[""2S 8H 6S 8D JH"",""4S 5H 4C 8C 5C""]","" +"[""2S 8H 2D 8D 3H"",""4S 5H 4C 8S 5D""]","" +"[""2S QS 2C QD JH"",""JD QH JS 8D QC""]","" +"[""JD QH JS 8D QC"",""JS QS JC 2D QD""]","" +"[""6S 6H 3S 3H AS"",""7H 7S 2H 2S AC""]","" +"[""5C 2S 5S 4H 4C"",""6S 2S 6H 7C 2C""]","" +"[""2S 8H 2H 8D JH"",""4S 5H 4C 8S 4H""]","" +"[""2S 2H 2C 8D JH"",""4S AH AS 8C AD""]","" +"[""5S AH AS 7C AD"",""4S AH AS 8C AD""]","" +"[""4S 5H 4C 8D 4H"",""3S 4D 2S 6D 5C""]","" +"[""4S 5H 4C 8D 4H"",""10D JH QS KD AC""]","" +"[""4S 5H 4C 8D 4H"",""4D AH 3S 2D 5C""]","" +"[""2C 3D 7H 5H 2S"",""QS KH AC 2D 3S""]","" +"[""4S 6C 7S 8D 5H"",""5S 7H 8S 9D 6H""]","" +"[""2H 3C 4D 5D 6H"",""4S AH 3S 2D 5H""]","" +"[""4C 6H 7D 8D 5H"",""2S 4S 5S 6S 7S""]","" +"[""2H 7H 8H 9H 6H"",""3S 5S 6S 7S 8S""]","" +"[""3H 6H 7H 8H 5H"",""4S 5H 4C 5D 4H""]","" +"[""4H 4S 4D 9S 9D"",""5H 5S 5D 8S 8D""]","" +"[""5H 5S 5D 9S 9D"",""5H 5S 5D 8S 8D""]","" +"[""4S 5H 4D 5D 4H"",""3S 3H 2S 3D 3C""]","" +"[""2S 2H 2C 8D 2D"",""4S 5H 5S 5D 5C""]","" +"[""3S 3H 2S 3D 3C"",""3S 3H 4S 3D 3C""]","" +"[""4S 5H 5S 5D 5C"",""7S 8S 9S 6S 10S""]","" +"[""KC AH AS AD AC"",""10C JC QC KC AC""]","" +"[""KS AH AS AD AC"",""4H AH 3H 2H 5H""]","" +"[""2C AC QC 10C KC"",""QH KH AH 2H 3H""]","" +"[""4H 6H 7H 8H 5H"",""5S 7S 8S 9S 6S""]","" +"[""2H 3H 4H 5H 6H"",""4D AD 3D 2D 5D""]","" diff --git a/exercises/practice/protein-translation/.meta/template.create_test_table.j2 b/exercises/practice/protein-translation/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..dc812c4c --- /dev/null +++ b/exercises/practice/protein-translation/.meta/template.create_test_table.j2 @@ -0,0 +1,44 @@ +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 + strand TEXT NOT NULL, + expected_result TEXT, + expected_error TEXT +); + +INSERT INTO + tests ( + uuid, + description, + strand, + expected_result, + expected_error + ) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + {{ case["description"] | quote }}, + '{{ case["input"]["strand"] }}', +{%- if not case["expect_error"] %} + '{{ case["expected"] | join(", ") }}', +{%- else %} + NULL, +{%- endif %} + {{ case.get("expect_error_msg") | quote }} +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/protein-translation/.meta/template.data.j2 b/exercises/practice/protein-translation/.meta/template.data.j2 new file mode 100644 index 00000000..a043c9a7 --- /dev/null +++ b/exercises/practice/protein-translation/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["strand"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/protein-translation/data.csv b/exercises/practice/protein-translation/data.csv index 890d006a..b15a7cb6 100644 --- a/exercises/practice/protein-translation/data.csv +++ b/exercises/practice/protein-translation/data.csv @@ -1,30 +1,30 @@ -"",, -"AUG",, -"UUU",, -"UUC",, -"UUA",, -"UUG",, -"UCU",, -"UCC",, -"UCA",, -"UCG",, -"UAU",, -"UAC",, -"UGU",, -"UGC",, -"UGG",, -"UAA",, -"UAG",, -"UGA",, -"UUUUUU",, -"UUAUUG",, -"AUGUUUUGG",, -"UAGUGG",, -"UGGUAG",, -"AUGUUUUAA",, -"UGGUAGUGG",, -"UGGUGUUAUUAAUGGUUU",, -"AUGAUG",, -"XYZ",, -"AUGU",, -"UUCUUCUAAUGGU",, +"","" +"AUG","" +"UUU","" +"UUC","" +"UUA","" +"UUG","" +"UCU","" +"UCC","" +"UCA","" +"UCG","" +"UAU","" +"UAC","" +"UGU","" +"UGC","" +"UGG","" +"UAA","" +"UAG","" +"UGA","" +"UUUUUU","" +"UUAUUG","" +"AUGUUUUGG","" +"UAGUGG","" +"UGGUAG","" +"AUGUUUUAA","" +"UGGUAGUGG","" +"UGGUGUUAUUAAUGGUUU","" +"AUGAUG","" +"XYZ","" +"AUGU","" +"UUCUUCUAAUGGU","" diff --git a/exercises/practice/proverb/.meta/template.create_test_table.j2 b/exercises/practice/proverb/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..224c9535 --- /dev/null +++ b/exercises/practice/proverb/.meta/template.create_test_table.j2 @@ -0,0 +1,38 @@ +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 + strings TEXT NOT NULL, -- json array + expected TEXT NOT NULL +); + +INSERT INTO + tests (uuid, description, strings, expected) +VALUES + +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '[{{ case["input"]["strings"] | tocsv | replace("'", '"') }}]', + '{{ case["expected"] | join("\\n") }}' +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} + +UPDATE tests +SET + expected = REPLACE(expected, '\n', CHAR(10)); + diff --git a/exercises/practice/proverb/.meta/template.data.j2 b/exercises/practice/proverb/.meta/template.data.j2 new file mode 100644 index 00000000..818147f9 --- /dev/null +++ b/exercises/practice/proverb/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["strings"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/proverb/data.csv b/exercises/practice/proverb/data.csv index c8357e1c..9187c213 100644 --- a/exercises/practice/proverb/data.csv +++ b/exercises/practice/proverb/data.csv @@ -1,6 +1,6 @@ -"[]", -"[""nail""]", -"[""nail"",""shoe""]", -"[""nail"",""shoe"",""horse""]", -"[""nail"",""shoe"",""horse"",""rider"",""message"",""battle"",""kingdom""]", -"[""pin"",""gun"",""soldier"",""battle""]", +"[]","" +"[""nail""]","" +"[""nail"",""shoe""]","" +"[""nail"",""shoe"",""horse""]","" +"[""nail"",""shoe"",""horse"",""rider"",""message"",""battle"",""kingdom""]","" +"[""pin"",""gun"",""soldier"",""battle""]",""