diff --git a/exercises/practice/saddle-points/.meta/template.create_test_table.j2 b/exercises/practice/saddle-points/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..f4bd112d --- /dev/null +++ b/exercises/practice/saddle-points/.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 + matrix TEXT NOT NULL, -- json array of arrays + expected TEXT NOT NULL -- json array of objects +); + +INSERT INTO + tests (uuid, description, matrix, expected) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '{{ case["input"]["matrix"] | tojson }}', + '{{ case["expected"] | tojson }}' +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/saddle-points/.meta/template.data.j2 b/exercises/practice/saddle-points/.meta/template.data.j2 new file mode 100644 index 00000000..3542d3ea --- /dev/null +++ b/exercises/practice/saddle-points/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +"{{ case["input"]["matrix"] | tojson }}","" +{% endfor %} diff --git a/exercises/practice/saddle-points/data.csv b/exercises/practice/saddle-points/data.csv index 74d9a4c1..2bb97bb0 100644 --- a/exercises/practice/saddle-points/data.csv +++ b/exercises/practice/saddle-points/data.csv @@ -1,9 +1,9 @@ -"[[9,8,7],[5,3,2],[6,6,7]]", -"[[]]", -"[[1,2,3],[3,1,2],[2,3,1]]", -"[[4,5,4],[3,5,5],[1,5,4]]", -"[[6,7,8],[5,5,5],[7,5,6]]", -"[[8,7,9],[6,7,6],[3,2,5]]", -"[[3,1,3],[3,2,4]]", -"[[2],[1],[4],[1]]", -"[[2,5,3,5]]", +"[[9,8,7],[5,3,2],[6,6,7]]","" +"[[]]","" +"[[1,2,3],[3,1,2],[2,3,1]]","" +"[[4,5,4],[3,5,5],[1,5,4]]","" +"[[6,7,8],[5,5,5],[7,5,6]]","" +"[[8,7,9],[6,7,6],[3,2,5]]","" +"[[3,1,3],[3,2,4]]","" +"[[2],[1],[4],[1]]","" +"[[2,5,3,5]]","" diff --git a/exercises/practice/say/.meta/template.create_test_table.j2 b/exercises/practice/say/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..58a83588 --- /dev/null +++ b/exercises/practice/say/.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 + 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/say/.meta/template.data.j2 b/exercises/practice/say/.meta/template.data.j2 new file mode 100644 index 00000000..64546678 --- /dev/null +++ b/exercises/practice/say/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["number"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/say/data.csv b/exercises/practice/say/data.csv index 4f3a5707..05948d5e 100644 --- a/exercises/practice/say/data.csv +++ b/exercises/practice/say/data.csv @@ -1,19 +1,19 @@ -0,, -1,, -14,, -20,, -22,, -30,, -99,, -100,, -123,, -200,, -999,, -1000,, -1234,, -1000000,, -1002345,, -1000000000,, -987654321123,, --1,, -1000000000000,, +0,"" +1,"" +14,"" +20,"" +22,"" +30,"" +99,"" +100,"" +123,"" +200,"" +999,"" +1000,"" +1234,"" +1000000,"" +1002345,"" +1000000000,"" +987654321123,"" +-1,"" +1000000000000,"" diff --git a/exercises/practice/scrabble-score/.meta/template.create_test_table.j2 b/exercises/practice/scrabble-score/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..043dc4b0 --- /dev/null +++ b/exercises/practice/scrabble-score/.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 + word TEXT NOT NULL, + expected INTEGER NOT NULL +); + +INSERT INTO + tests (uuid, description, word, expected) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '{{ case["input"]["word"] }}', + {{ case["expected"] }} +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/scrabble-score/.meta/template.data.j2 b/exercises/practice/scrabble-score/.meta/template.data.j2 new file mode 100644 index 00000000..8628d372 --- /dev/null +++ b/exercises/practice/scrabble-score/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["word"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/secret-handshake/.meta/template.create_test_table.j2 b/exercises/practice/secret-handshake/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..7a9cb8ed --- /dev/null +++ b/exercises/practice/secret-handshake/.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 + number INTEGER NOT NULL, + expected TEXT NOT NULL +); + +INSERT INTO + tests (uuid, description, number, expected) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + {{ case["input"]["number"] }}, + '{{ case["expected"] | join(", ") }}' +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/secret-handshake/.meta/template.data.j2 b/exercises/practice/secret-handshake/.meta/template.data.j2 new file mode 100644 index 00000000..64546678 --- /dev/null +++ b/exercises/practice/secret-handshake/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["number"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/series/.meta/template.create_test_table.j2 b/exercises/practice/series/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..f48df008 --- /dev/null +++ b/exercises/practice/series/.meta/template.create_test_table.j2 @@ -0,0 +1,51 @@ +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, + slice_length INTEGER NOT NULL, + expected_result TEXT, + expected_error TEXT +); + +INSERT INTO + tests ( + uuid, + description, + input, + slice_length, + expected_result, + expected_error + ) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '{{ case["input"]["series"] }}', + {{ case["input"]["sliceLength"] }}, +{%- if not case["expect_error"] %} + '{{ case["expected"] | join("\n") }}', +{%- else %} + NULL, +{%- endif %} + {{ case.get("expect_error_msg") | quote }} +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} + +UPDATE tests +SET + expected_result = REPLACE(expected_result, '\n', CHAR(10)); diff --git a/exercises/practice/series/.meta/template.data.j2 b/exercises/practice/series/.meta/template.data.j2 new file mode 100644 index 00000000..b237d698 --- /dev/null +++ b/exercises/practice/series/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["series"], case["input"]["sliceLength"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/series/create_test_table.sql b/exercises/practice/series/create_test_table.sql index 8ca64038..a3fe032e 100644 --- a/exercises/practice/series/create_test_table.sql +++ b/exercises/practice/series/create_test_table.sql @@ -40,7 +40,8 @@ VALUES 'slices of one from two', '12', 1, - '1\n2', + '1 +2', NULL ), ( @@ -56,7 +57,9 @@ VALUES 'slices of two overlap', '9142', 2, - '91\n14\n42', + '91 +14 +42', NULL ), ( @@ -64,7 +67,10 @@ VALUES 'slices can include duplicates', '777777', 3, - '777\n777\n777\n777', + '777 +777 +777 +777', NULL ), ( @@ -72,7 +78,14 @@ VALUES 'slices of a long series', '918493904243', 5, - '91849\n18493\n84939\n49390\n93904\n39042\n90424\n04243', + '91849 +18493 +84939 +49390 +93904 +39042 +90424 +04243', NULL ), ( diff --git a/exercises/practice/series/data.csv b/exercises/practice/series/data.csv index b71660c8..26f18a49 100644 --- a/exercises/practice/series/data.csv +++ b/exercises/practice/series/data.csv @@ -1,11 +1,11 @@ -"1",1,, -"12",1,, -"35",2,, -"9142",2,, -"777777",3,, -"918493904243",5,, -"12345",6,, -"12345",42,, -"12345",0,, -"123",-1,, -"",1,, +"1",1,"" +"12",1,"" +"35",2,"" +"9142",2,"" +"777777",3,"" +"918493904243",5,"" +"12345",6,"" +"12345",42,"" +"12345",0,"" +"123",-1,"" +"",1,"" diff --git a/exercises/practice/sieve/.meta/template.create_test_table.j2 b/exercises/practice/sieve/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..89700b1b --- /dev/null +++ b/exercises/practice/sieve/.meta/template.create_test_table.j2 @@ -0,0 +1,30 @@ +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 + "limit" INTEGER NOT NULL, + expected TEXT NOT NULL +); + +INSERT INTO tests (uuid, description, "limit", expected) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + {{ case["input"]["limit"] }}, + '{{ case["expected"] | join(", ") }}' +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/sieve/.meta/template.data.j2 b/exercises/practice/sieve/.meta/template.data.j2 new file mode 100644 index 00000000..d89a57ad --- /dev/null +++ b/exercises/practice/sieve/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["limit"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/sieve/create_test_table.sql b/exercises/practice/sieve/create_test_table.sql index 79c75f3b..66d8f649 100644 --- a/exercises/practice/sieve/create_test_table.sql +++ b/exercises/practice/sieve/create_test_table.sql @@ -16,8 +16,33 @@ CREATE TABLE IF NOT EXISTS tests ( INSERT INTO tests (uuid, description, "limit", expected) VALUES -('88529125-c4ce-43cc-bb36-1eb4ddd7b44f', 'no primes under two', 1, ''), -('4afe9474-c705-4477-9923-840e1024cc2b', 'find first prime', 2, '2'), -('974945d8-8cd9-4f00-9463-7d813c7f17b7', 'find primes up to 10', 10, '2, 3, 5, 7'), -('2e2417b7-3f3a-452a-8594-b9af08af6d82', 'limit is prime', 13, '2, 3, 5, 7, 11, 13'), -('92102a05-4c7c-47de-9ed0-b7d5fcd00f21', 'find primes up to 1000', 1000, '2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997'); + ( + '88529125-c4ce-43cc-bb36-1eb4ddd7b44f', + 'no primes under two', + 1, + '' + ), + ( + '4afe9474-c705-4477-9923-840e1024cc2b', + 'find first prime', + 2, + '2' + ), + ( + '974945d8-8cd9-4f00-9463-7d813c7f17b7', + 'find primes up to 10', + 10, + '2, 3, 5, 7' + ), + ( + '2e2417b7-3f3a-452a-8594-b9af08af6d82', + 'limit is prime', + 13, + '2, 3, 5, 7, 11, 13' + ), + ( + '92102a05-4c7c-47de-9ed0-b7d5fcd00f21', + 'find primes up to 1000', + 1000, + '2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997' + ); diff --git a/exercises/practice/sieve/data.csv b/exercises/practice/sieve/data.csv index 8f21d755..7fcd23e7 100644 --- a/exercises/practice/sieve/data.csv +++ b/exercises/practice/sieve/data.csv @@ -1,5 +1,5 @@ -1, -2, -10, -13, -1000, +1,"" +2,"" +10,"" +13,"" +1000,"" diff --git a/exercises/practice/space-age/.meta/template.create_test_table.j2 b/exercises/practice/space-age/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..9a4e21dd --- /dev/null +++ b/exercises/practice/space-age/.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 + planet TEXT NOT NULL, + seconds INTEGER NOT NULL, + expected REAL +); + +INSERT INTO + tests (uuid, description, planet, seconds, expected) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '{{ case["input"]["planet"] }}', + {{ case["input"]["seconds"] }}, + {{ case["expected"] }} +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/space-age/.meta/template.data.j2 b/exercises/practice/space-age/.meta/template.data.j2 new file mode 100644 index 00000000..cf24000c --- /dev/null +++ b/exercises/practice/space-age/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["planet"], case["input"]["seconds"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/square-root/.meta/template.create_test_table.j2 b/exercises/practice/square-root/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..e239e9e7 --- /dev/null +++ b/exercises/practice/square-root/.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 + radicand INTEGER NOT NULL, + expected INTEGER NOT NULL +); + +INSERT INTO + tests (uuid, description, radicand, expected) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + {{ case["input"]["radicand"] }}, + {{ case["expected"] }} +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/square-root/.meta/template.data.j2 b/exercises/practice/square-root/.meta/template.data.j2 new file mode 100644 index 00000000..41b0ba52 --- /dev/null +++ b/exercises/practice/square-root/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["radicand"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/square-root/data.csv b/exercises/practice/square-root/data.csv index 4c2ddadd..e3cd1727 100644 --- a/exercises/practice/square-root/data.csv +++ b/exercises/practice/square-root/data.csv @@ -1,6 +1,6 @@ -1, -4, -25, -81, -196, -65025, +1,"" +4,"" +25,"" +81,"" +196,"" +65025,"" diff --git a/exercises/practice/state-of-tic-tac-toe/.meta/template.create_test_table.j2 b/exercises/practice/state-of-tic-tac-toe/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..65e98217 --- /dev/null +++ b/exercises/practice/state-of-tic-tac-toe/.meta/template.create_test_table.j2 @@ -0,0 +1,48 @@ +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 + board TEXT NOT NULL, + expected_result TEXT, + expected_error TEXT +); + +INSERT INTO + tests ( + uuid, + description, + board, + expected_result, + expected_error + ) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '{{ case["input"]["board"] | join("\\n") }}', +{%- if not case["expect_error"] %} + '{{ case["expected"] }}', +{%- else %} + NULL, +{%- endif %} + {{ case.get("expect_error_msg") | quote }} +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} + +UPDATE tests +SET + board = REPLACE(board, '\n', CHAR(10)); diff --git a/exercises/practice/state-of-tic-tac-toe/.meta/template.data.j2 b/exercises/practice/state-of-tic-tac-toe/.meta/template.data.j2 new file mode 100644 index 00000000..844540ff --- /dev/null +++ b/exercises/practice/state-of-tic-tac-toe/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ case["input"]["board"] | join("\\n") }},"" +{% endfor %} diff --git a/exercises/practice/state-of-tic-tac-toe/data.csv b/exercises/practice/state-of-tic-tac-toe/data.csv index 98fa8dfb..27bb8ed6 100644 --- a/exercises/practice/state-of-tic-tac-toe/data.csv +++ b/exercises/practice/state-of-tic-tac-toe/data.csv @@ -1,27 +1,27 @@ -"XOO\nX \nX ",, -"OXO\n X \n X ",, -"OOX\n X\n X",, -"OXX\nOX \nO ",, -"XOX\n OX\n O ",, -"XXO\n XO\n O",, -"XXX\nXOO\nO ",, -"O \nXXX\n O ",, -" OO\nO X\nXXX",, -"OOO\nXXO\nXX ",, -"XX \nOOO\nX ",, -"XOX\n XX\nOOO",, -"XOO\n X \n X",, -"O X\nOX \nX ",, -"OXX\nOOX\nX O",, -" O\n OX\nOXX",, -"XXX\nXOO\nXOO",, -"XOX\nOXO\nXOX",, -"XOX\nXXO\nOXO",, -"XXO\nOXX\nXOO",, -" \nX \n ",, -"O \n X \n ",, -"X \n XO\nOX ",, -"XX \n \n ",, -"OOX\n \n ",, -"XXX\nOOO\n ",, -"XXX\nOOO\nXOX",, +XOO\nX \nX ,"" +OXO\n X \n X ,"" +OOX\n X\n X,"" +OXX\nOX \nO ,"" +XOX\n OX\n O ,"" +XXO\n XO\n O,"" +XXX\nXOO\nO ,"" +O \nXXX\n O ,"" + OO\nO X\nXXX,"" +OOO\nXXO\nXX ,"" +XX \nOOO\nX ,"" +XOX\n XX\nOOO,"" +XOO\n X \n X,"" +O X\nOX \nX ,"" +OXX\nOOX\nX O,"" + O\n OX\nOXX,"" +XXX\nXOO\nXOO,"" +XOX\nOXO\nXOX,"" +XOX\nXXO\nOXO,"" +XXO\nOXX\nXOO,"" + \nX \n ,"" +O \n X \n ,"" +X \n XO\nOX ,"" +XX \n \n ,"" +OOX\n \n ,"" +XXX\nOOO\n ,"" +XXX\nOOO\nXOX,"" diff --git a/exercises/practice/sublist/.meta/template.create_test_table.j2 b/exercises/practice/sublist/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..8970334e --- /dev/null +++ b/exercises/practice/sublist/.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 + list_one TEXT NOT NULL, -- json array + list_two TEXT NOT NULL, -- json array + expected TEXT NOT NULL +); + +INSERT INTO + tests (uuid, description, list_one, list_two, expected) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '{{ case["input"]["listOne"] | tojson }}', + '{{ case["input"]["listTwo"] | tojson }}', + '{{ case["expected"] }}' +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/sublist/.meta/template.data.j2 b/exercises/practice/sublist/.meta/template.data.j2 new file mode 100644 index 00000000..fe524741 --- /dev/null +++ b/exercises/practice/sublist/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["listOne"], case["input"]["listTwo"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/sum-of-multiples/.meta/template.create_test_table.j2 b/exercises/practice/sum-of-multiples/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..932ea087 --- /dev/null +++ b/exercises/practice/sum-of-multiples/.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 + factors TEXT NOT NULL, -- json array of integers + "limit" INTEGER NOT NULL, + expected INTEGER NOT NULL +); + +INSERT INTO + tests (uuid, description, factors, "limit", expected) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '{{ case["input"]["factors"] | tojson }}', + {{ case["input"]["limit"] }}, + {{ case["expected"] }} +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/sum-of-multiples/.meta/template.data.j2 b/exercises/practice/sum-of-multiples/.meta/template.data.j2 new file mode 100644 index 00000000..7cef2153 --- /dev/null +++ b/exercises/practice/sum-of-multiples/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["factors"], case["input"]["limit"]] | tocsv }},"" +{% endfor %} diff --git a/exercises/practice/sum-of-multiples/data.csv b/exercises/practice/sum-of-multiples/data.csv index 8376e9ac..2637495c 100644 --- a/exercises/practice/sum-of-multiples/data.csv +++ b/exercises/practice/sum-of-multiples/data.csv @@ -1,16 +1,16 @@ -"[3,5]",1, -"[3,5]",4, -"[3]",7, -"[3,5]",10, -"[3,5]",100, -"[3,5]",1000, -"[7,13,17]",20, -"[4,6]",15, -"[5,6,8]",150, -"[5,25]",51, -"[43,47]",10000, -"[1]",100, -"[]",10000, -"[0]",1, -"[3,0]",4, -"[2,3,5,7,11]",10000, +"[3,5]",1,"" +"[3,5]",4,"" +"[3]",7,"" +"[3,5]",10,"" +"[3,5]",100,"" +"[3,5]",1000,"" +"[7,13,17]",20,"" +"[4,6]",15,"" +"[5,6,8]",150,"" +"[5,25]",51,"" +"[43,47]",10000,"" +"[1]",100,"" +"[]",10000,"" +"[0]",1,"" +"[3,0]",4,"" +"[2,3,5,7,11]",10000,"" diff --git a/exercises/practice/swift-scheduling/.meta/template.create_test_table.j2 b/exercises/practice/swift-scheduling/.meta/template.create_test_table.j2 new file mode 100644 index 00000000..300edaf4 --- /dev/null +++ b/exercises/practice/swift-scheduling/.meta/template.create_test_table.j2 @@ -0,0 +1,40 @@ +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 + meeting_start TEXT NOT NULL, -- datetime YYYY-MM-DDTHH:mm:ss + date_description TEXT NOT NULL, + expected TEXT NOT NULL +); + +INSERT INTO + tests ( + uuid, + description, + meeting_start, + date_description, + expected + ) +VALUES +{%- for case in cases %} + ( + '{{ case["uuid"] }}', + '{{ case["description"] }}', + '{{ case["input"]["meetingStart"] }}', + '{{ case["input"]["description"] }}', + '{{ case["expected"] }}' +{%- if loop.last %} + ); +{%- else %} + ), +{%- endif %} +{%- endfor %} diff --git a/exercises/practice/swift-scheduling/.meta/template.data.j2 b/exercises/practice/swift-scheduling/.meta/template.data.j2 new file mode 100644 index 00000000..018b2c24 --- /dev/null +++ b/exercises/practice/swift-scheduling/.meta/template.data.j2 @@ -0,0 +1,3 @@ +{%- for case in cases -%} +{{ [case["input"]["meetingStart"], case["input"]["description"]] | tocsv }},"" +{% endfor %}