Skip to content
Open
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
32 changes: 32 additions & 0 deletions exercises/practice/pangram/.meta/template.create_test_table.j2
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
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 %}
3 changes: 3 additions & 0 deletions exercises/practice/pangram/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ [case["input"]["sentence"]] | tocsv }},""
{% endfor %}
20 changes: 10 additions & 10 deletions exercises/practice/pangram/create_test_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
3 changes: 3 additions & 0 deletions exercises/practice/pascals-triangle/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ [case["input"]["count"]] | tocsv }},""
{% endfor %}
2 changes: 1 addition & 1 deletion exercises/practice/pascals-triangle/data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
4,""
5,""
6,""
10,""
10,""
Original file line number Diff line number Diff line change
@@ -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 %}
3 changes: 3 additions & 0 deletions exercises/practice/perfect-numbers/.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 %}
28 changes: 14 additions & 14 deletions exercises/practice/perfect-numbers/create_test_table.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
);
28 changes: 14 additions & 14 deletions exercises/practice/perfect-numbers/data.csv
Original file line number Diff line number Diff line change
@@ -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,""
Original file line number Diff line number Diff line change
@@ -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 %}
3 changes: 3 additions & 0 deletions exercises/practice/phone-number/.meta/template.data.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- for case in cases -%}
{{ [case["input"]["phrase"]] | tocsv }},""
{% endfor %}
36 changes: 18 additions & 18 deletions exercises/practice/phone-number/data.csv
Original file line number Diff line number Diff line change
@@ -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",""
Loading