Skip to content

Commit 7239a41

Browse files
authored
Sync tests, get the verify-exercises to pass (#95)
1 parent aa93e88 commit 7239a41

File tree

12 files changed

+142
-136
lines changed

12 files changed

+142
-136
lines changed

exercises/practice/bob/.meta/example.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
WITH trimmed AS (
22
SELECT input
3-
, RTRIM(input, CHAR(32, 9, 10, 13)) AS trimmed
3+
, TRIM(input, CHAR(32, 9, 10, 13)) AS trimmed
44
FROM bob
55
)
66
, bools AS (

exercises/practice/bob/.meta/tests.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ description = "alternate silence"
7171

7272
[66953780-165b-4e7e-8ce3-4bcb80b6385a]
7373
description = "multiple line question"
74+
include = false
7475

7576
[5371ef75-d9ea-4103-bcfa-2da973ddec1b]
7677
description = "starting with whitespace"
@@ -83,3 +84,7 @@ description = "other whitespace"
8384

8485
[12983553-8601-46a8-92fa-fcaa3bc4a2a0]
8586
description = "non-question ending with whitespace"
87+
88+
[2c7278ac-f955-4eb4-bf8f-e33eb4116a15]
89+
description = "multiple line question"
90+
reimplements = "66953780-165b-4e7e-8ce3-4bcb80b6385a"

exercises/practice/bob/bob_test.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ INSERT INTO tests (uuid, name, input, expected)
2525
('bc39f7c6-f543-41be-9a43-fd1c2f753fc0','silence','','Fine. Be that way!'),
2626
('d6c47565-372b-4b09-b1dd-c40552b8378b','prolonged silence',' ','Fine. Be that way!'),
2727
('4428f28d-4100-4d85-a902-e5a78cb0ecd3','alternate silence',' ','Fine. Be that way!'),
28-
('66953780-165b-4e7e-8ce3-4bcb80b6385a','multiple line question','
29-
Does this cryogenic chamber make me look fat?
30-
No.','Whatever.'),
28+
('2c7278ac-f955-4eb4-bf8f-e33eb4116a15','multiple line question','
29+
Does this cryogenic chamber make
30+
me look fat?','Sure.'),
3131
('5371ef75-d9ea-4103-bcfa-2da973ddec1b','starting with whitespace',' hmmmmmmm...','Whatever.'),
3232
('05b304d6-f83b-46e7-81e0-4cd3ca647900','ending with whitespace','Okay if like my spacebar quite a bit? ','Sure.'),
3333
('72bd5ad3-9b2f-4931-a988-dce1f5771de2','other whitespace','

exercises/practice/bob/data.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
" ",""
2020
" ",""
2121
"
22-
Does this cryogenic chamber make me look fat?
23-
No.",""
22+
Does this cryogenic chamber make
23+
me look fat?",""
2424
" hmmmmmmm...",""
2525
"Okay if like my spacebar quite a bit? ",""
2626
"
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
UPDATE "difference-of-squares"
1+
UPDATE 'difference-of-squares'
22
SET result = number * number * (number + 1) * (number + 1) / 4
3-
WHERE property = "squareOfSum";
3+
WHERE property = 'squareOfSum';
44

5-
UPDATE "difference-of-squares"
5+
UPDATE 'difference-of-squares'
66
SET result = number * (number + 1) * (2 * number + 1) / 6
7-
WHERE property = "sumOfSquares";
7+
WHERE property = 'sumOfSquares';
88

9-
UPDATE "difference-of-squares"
9+
UPDATE 'difference-of-squares'
1010
SET result = number * (number + 1) * (3 * number + 2) * (number - 1) / 12
11-
WHERE property = "differenceOfSquares";
11+
WHERE property = 'differenceOfSquares';

exercises/practice/difference-of-squares/difference-of-squares_test.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ INSERT INTO tests (name, uuid,
2929
-- Comparison of user input and the tests updates the status for each test:
3030
UPDATE tests
3131
SET status = 'pass'
32-
FROM (SELECT number, property, result FROM "difference-of-squares") AS actual
32+
FROM (SELECT number, property, result FROM 'difference-of-squares') AS actual
3333
WHERE (actual.number, actual.property, actual.result) = (tests.number, tests.property, tests.expected);
3434

3535
-- Write results and debug info:

exercises/practice/difference-of-squares/test_reporter.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ SET message = (
55
|| ' is <' || COALESCE(actual.result, 'NULL')
66
|| '> but should be <' || tests.expected || '>'
77
)
8-
FROM (SELECT number, property, result FROM "difference-of-squares") AS actual
8+
FROM (SELECT number, property, result FROM 'difference-of-squares') AS actual
99
WHERE (actual.number, actual.property) = (tests.number, tests.property) AND tests.status = 'fail';
1010

1111
-- Save results to ./output.json (needed by the online test-runner)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
UPDATE grains
22
SET result = POWER(2, square - 1)
3-
WHERE task = "single-square";
3+
WHERE task = 'single-square';
44

55
UPDATE grains
66
SET result = POWER(2, 64) - 1
7-
WHERE task = "total";
7+
WHERE task = 'total';

exercises/practice/grains/grains_test.sql

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@
77
INSERT INTO tests (name, uuid,
88
task, square, expected)
99
VALUES
10-
("grains on square 1", "9fbde8de-36b2-49de-baf2-cd42d6f28405",
11-
"single-square", 1, 1),
12-
("grains on square 2", "ee1f30c2-01d8-4298-b25d-c677331b5e6d",
13-
"single-square", 2, 2),
14-
("grains on square 3", "10f45584-2fc3-4875-8ec6-666065d1163b",
15-
"single-square", 3, 4),
16-
("grains on square 4", "a7cbe01b-36f4-4601-b053-c5f6ae055170",
17-
"single-square", 4, 8),
18-
("grains on square 16", "c50acc89-8535-44e4-918f-b848ad2817d4",
19-
"single-square", 16, 32768),
20-
("grains on square 32", "acd81b46-c2ad-4951-b848-80d15ed5a04f",
21-
"single-square", 32, 2147483648),
22-
("grains on square 64", "c73b470a-5efb-4d53-9ac6-c5f6487f227b",
23-
"single-square", 64, 9223372036854775808),
24-
("returns the total number of grains on the board", "6eb07385-3659-4b45-a6be-9dc474222750",
25-
"total", 0, 18446744073709551615);
10+
('grains on square 1', '9fbde8de-36b2-49de-baf2-cd42d6f28405',
11+
'single-square', 1, 1),
12+
('grains on square 2', 'ee1f30c2-01d8-4298-b25d-c677331b5e6d',
13+
'single-square', 2, 2),
14+
('grains on square 3', '10f45584-2fc3-4875-8ec6-666065d1163b',
15+
'single-square', 3, 4),
16+
('grains on square 4', 'a7cbe01b-36f4-4601-b053-c5f6ae055170',
17+
'single-square', 4, 8),
18+
('grains on square 16', 'c50acc89-8535-44e4-918f-b848ad2817d4',
19+
'single-square', 16, 32768),
20+
('grains on square 32', 'acd81b46-c2ad-4951-b848-80d15ed5a04f',
21+
'single-square', 32, 2147483648),
22+
('grains on square 64', 'c73b470a-5efb-4d53-9ac6-c5f6487f227b',
23+
'single-square', 64, 9223372036854775808),
24+
('returns the total number of grains on the board', '6eb07385-3659-4b45-a6be-9dc474222750',
25+
'total', 0, 18446744073709551615);
2626

2727

2828
-- Comparison of user input and the tests updates the status for each test:

exercises/practice/luhn/luhn_test.sql

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,71 +6,71 @@
66
INSERT INTO tests (name, uuid,
77
value, expected)
88
VALUES
9-
("single digit strings can not be valid", "792a7082-feb7-48c7-b88b-bbfec160865e",
10-
"1", false),
9+
('single digit strings can not be valid', '792a7082-feb7-48c7-b88b-bbfec160865e',
10+
'1', false),
1111

12-
("a single zero is invalid", "698a7924-64d4-4d89-8daa-32e1aadc271e",
13-
"0", false),
12+
('a single zero is invalid', '698a7924-64d4-4d89-8daa-32e1aadc271e',
13+
'0', false),
1414

15-
("a simple valid SIN that remains valid if reversed", "73c2f62b-9b10-4c9f-9a04-83cee7367965",
16-
"059", true),
15+
('a simple valid SIN that remains valid if reversed', '73c2f62b-9b10-4c9f-9a04-83cee7367965',
16+
'059', true),
1717

18-
("a simple valid SIN that becomes invalid if reversed", "9369092e-b095-439f-948d-498bd076be11",
19-
"59", true),
18+
('a simple valid SIN that becomes invalid if reversed', '9369092e-b095-439f-948d-498bd076be11',
19+
'59', true),
2020

21-
("a valid Canadian SIN", "8f9f2350-1faf-4008-ba84-85cbb93ffeca",
22-
"055 444 285", true),
21+
('a valid Canadian SIN', '8f9f2350-1faf-4008-ba84-85cbb93ffeca',
22+
'055 444 285', true),
2323

24-
("invalid Canadian SIN", "1cdcf269-6560-44fc-91f6-5819a7548737",
25-
"055 444 286", false),
24+
('invalid Canadian SIN', '1cdcf269-6560-44fc-91f6-5819a7548737',
25+
'055 444 286', false),
2626

27-
("invalid credit card", "656c48c1-34e8-4e60-9a5a-aad8a367810a",
28-
"8273 1232 7352 0569", false),
27+
('invalid credit card', '656c48c1-34e8-4e60-9a5a-aad8a367810a',
28+
'8273 1232 7352 0569', false),
2929

30-
("invalid long number with an even remainder", "20e67fad-2121-43ed-99a8-14b5b856adb9",
31-
"1 2345 6789 1234 5678 9012", false),
30+
('invalid long number with an even remainder', '20e67fad-2121-43ed-99a8-14b5b856adb9',
31+
'1 2345 6789 1234 5678 9012', false),
3232

33-
("invalid long number with a remainder divisible by 5", "7e7c9fc1-d994-457c-811e-d390d52fba5e",
34-
"1 2345 6789 1234 5678 9013", false),
33+
('invalid long number with a remainder divisible by 5', '7e7c9fc1-d994-457c-811e-d390d52fba5e',
34+
'1 2345 6789 1234 5678 9013', false),
3535

36-
("valid number with an even number of digits", "ad2a0c5f-84ed-4e5b-95da-6011d6f4f0aa",
37-
"095 245 88", true),
36+
('valid number with an even number of digits', 'ad2a0c5f-84ed-4e5b-95da-6011d6f4f0aa',
37+
'095 245 88', true),
3838

39-
("valid number with an odd number of spaces", "ef081c06-a41f-4761-8492-385e13c8202d",
40-
"234 567 891 234", true),
39+
('valid number with an odd number of spaces', 'ef081c06-a41f-4761-8492-385e13c8202d',
40+
'234 567 891 234', true),
4141

42-
("valid strings with a non-digit added at the end become invalid", "bef66f64-6100-4cbb-8f94-4c9713c5e5b2",
43-
"059a", false),
42+
('valid strings with a non-digit added at the end become invalid', 'bef66f64-6100-4cbb-8f94-4c9713c5e5b2',
43+
'059a', false),
4444

45-
("valid strings with punctuation included become invalid", "2177e225-9ce7-40f6-b55d-fa420e62938e",
46-
"055-444-285", false),
45+
('valid strings with punctuation included become invalid', '2177e225-9ce7-40f6-b55d-fa420e62938e',
46+
'055-444-285', false),
4747

48-
("valid strings with symbols included become invalid", "ebf04f27-9698-45e1-9afe-7e0851d0fe8d",
49-
"055# 444$ 285", false),
48+
('valid strings with symbols included become invalid', 'ebf04f27-9698-45e1-9afe-7e0851d0fe8d',
49+
'055# 444$ 285', false),
5050

51-
("single zero with space is invalid", "08195c5e-ce7f-422c-a5eb-3e45fece68ba",
52-
" 0", false),
51+
('single zero with space is invalid', '08195c5e-ce7f-422c-a5eb-3e45fece68ba',
52+
' 0', false),
5353

54-
("more than a single zero is valid", "12e63a3c-f866-4a79-8c14-b359fc386091",
55-
"0000 0", true),
54+
('more than a single zero is valid', '12e63a3c-f866-4a79-8c14-b359fc386091',
55+
'0000 0', true),
5656

57-
("input digit 9 is correctly converted to output digit 9", "ab56fa80-5de8-4735-8a4a-14dae588663e",
58-
"091", true),
57+
('input digit 9 is correctly converted to output digit 9', 'ab56fa80-5de8-4735-8a4a-14dae588663e',
58+
'091', true),
5959

60-
("very long input is valid", "b9887ee8-8337-46c5-bc45-3bcab51bc36f",
61-
"9999999999 9999999999 9999999999 9999999999", true),
60+
('very long input is valid', 'b9887ee8-8337-46c5-bc45-3bcab51bc36f',
61+
'9999999999 9999999999 9999999999 9999999999', true),
6262

63-
("valid luhn with an odd number of digits and non zero first digit", "8a7c0e24-85ea-4154-9cf1-c2db90eabc08",
64-
"109", true),
63+
('valid luhn with an odd number of digits and non zero first digit', '8a7c0e24-85ea-4154-9cf1-c2db90eabc08',
64+
'109', true),
6565

66-
("using ascii value for non-doubled non-digit isn't allowed", "39a06a5a-5bad-4e0f-b215-b042d46209b1",
67-
"055b 444 285", false),
66+
('using ascii value for non-doubled non-digit isn''t allowed', '39a06a5a-5bad-4e0f-b215-b042d46209b1',
67+
'055b 444 285', false),
6868

69-
("using ascii value for doubled non-digit isn't allowed", "f94cf191-a62f-4868-bc72-7253114aa157",
70-
":9", false),
69+
('using ascii value for doubled non-digit isn''t allowed', 'f94cf191-a62f-4868-bc72-7253114aa157',
70+
':9', false),
7171

72-
("non-numeric, non-space char in the middle with a sum that's divisible by 10 isn't allowed", "8b72ad26-c8be-49a2-b99c-bcc3bf631b33",
73-
"59%59", false);
72+
('non-numeric, non-space char in the middle with a sum that''s divisible by 10 isn''t allowed', '8b72ad26-c8be-49a2-b99c-bcc3bf631b33',
73+
'59%59', false);
7474

7575
-- Comparison of user input and the tests updates the status for each test:
7676
UPDATE tests

0 commit comments

Comments
 (0)