|
1 | 1 | DROP TABLE IF EXISTS tests;
|
| 2 | + |
2 | 3 | CREATE TABLE IF NOT EXISTS tests (
|
3 |
| - -- uuid and description are taken from the test.toml file |
4 |
| - uuid TEXT PRIMARY KEY, |
5 |
| - description TEXT NOT NULL, |
6 |
| - -- The following section is needed by the online test-runner |
7 |
| - status TEXT DEFAULT 'fail', |
8 |
| - message TEXT, |
9 |
| - output TEXT, |
10 |
| - test_code TEXT, |
11 |
| - task_id INTEGER DEFAULT NULL, |
12 |
| - -- Here are columns for the actual tests |
13 |
| - isbn TEXT NOT NULL, |
14 |
| - expected BOOL NOT NULL |
| 4 | + -- uuid and description are taken from the test.toml file |
| 5 | + uuid TEXT PRIMARY KEY, |
| 6 | + description TEXT NOT NULL, |
| 7 | + -- The following section is needed by the online test-runner |
| 8 | + status TEXT DEFAULT 'fail', |
| 9 | + message TEXT, |
| 10 | + output TEXT, |
| 11 | + test_code TEXT, |
| 12 | + task_id INTEGER DEFAULT NULL, |
| 13 | + -- Here are columns for the actual tests |
| 14 | + isbn TEXT NOT NULL, |
| 15 | + expected BOOL NOT NULL |
15 | 16 | );
|
16 | 17 |
|
17 |
| -INSERT INTO tests (uuid, description, isbn, expected) |
18 |
| - VALUES |
19 |
| - ('0caa3eac-d2e3-4c29-8df8-b188bc8c9292','valid isbn','3-598-21508-8',TRUE), |
20 |
| - ('19f76b53-7c24-45f8-87b8-4604d0ccd248','invalid isbn check digit','3-598-21508-9',FALSE), |
21 |
| - ('4164bfee-fb0a-4a1c-9f70-64c6a1903dcd','valid isbn with a check digit of 10','3-598-21507-X',TRUE), |
22 |
| - ('3ed50db1-8982-4423-a993-93174a20825c','check digit is a character other than X','3-598-21507-A',FALSE), |
23 |
| - ('9416f4a5-fe01-4b61-a07b-eb75892ef562','invalid check digit in isbn is not treated as zero','4-598-21507-B',FALSE), |
24 |
| - ('c19ba0c4-014f-4dc3-a63f-ff9aefc9b5ec','invalid character in isbn is not treated as zero','3-598-P1581-X',FALSE), |
25 |
| - ('28025280-2c39-4092-9719-f3234b89c627','X is only valid as a check digit','3-598-2X507-9',FALSE), |
26 |
| - ('f6294e61-7e79-46b3-977b-f48789a4945b','valid isbn without separating dashes','3598215088',TRUE), |
27 |
| - ('185ab99b-3a1b-45f3-aeec-b80d80b07f0b','isbn without separating dashes and X as check digit','359821507X',TRUE), |
28 |
| - ('7725a837-ec8e-4528-a92a-d981dd8cf3e2','isbn without check digit and dashes','359821507',FALSE), |
29 |
| - ('47e4dfba-9c20-46ed-9958-4d3190630bdf','too long isbn and no dashes','3598215078X',FALSE), |
30 |
| - ('737f4e91-cbba-4175-95bf-ae630b41fb60','too short isbn','00',FALSE), |
31 |
| - ('5458a128-a9b6-4ff8-8afb-674e74567cef','isbn without check digit','3-598-21507',FALSE), |
32 |
| - ('70b6ad83-d0a2-4ca7-a4d5-a9ab731800f7','check digit of X should not be used for 0','3-598-21515-X',FALSE), |
33 |
| - ('94610459-55ab-4c35-9b93-ff6ea1a8e562','empty isbn','',FALSE), |
34 |
| - ('7bff28d4-d770-48cc-80d6-b20b3a0fb46c','input is 9 characters','134456729',FALSE), |
35 |
| - ('ed6e8d1b-382c-4081-8326-8b772c581fec','invalid characters are not ignored after checking length','3132P34035',FALSE), |
36 |
| - ('daad3e58-ce00-4395-8a8e-e3eded1cdc86','invalid characters are not ignored before checking length','3598P215088',FALSE), |
37 |
| - ('fb5e48d8-7c03-4bfb-a088-b101df16fdc3','input is too long but contains a valid isbn','98245726788',FALSE); |
| 18 | +INSERT INTO |
| 19 | + tests (uuid, description, isbn, expected) |
| 20 | +VALUES |
| 21 | + ( |
| 22 | + '0caa3eac-d2e3-4c29-8df8-b188bc8c9292', |
| 23 | + 'valid isbn', |
| 24 | + '3-598-21508-8', |
| 25 | + TRUE |
| 26 | + ), |
| 27 | + ( |
| 28 | + '19f76b53-7c24-45f8-87b8-4604d0ccd248', |
| 29 | + 'invalid isbn check digit', |
| 30 | + '3-598-21508-9', |
| 31 | + FALSE |
| 32 | + ), |
| 33 | + ( |
| 34 | + '4164bfee-fb0a-4a1c-9f70-64c6a1903dcd', |
| 35 | + 'valid isbn with a check digit of 10', |
| 36 | + '3-598-21507-X', |
| 37 | + TRUE |
| 38 | + ), |
| 39 | + ( |
| 40 | + '3ed50db1-8982-4423-a993-93174a20825c', |
| 41 | + 'check digit is a character other than X', |
| 42 | + '3-598-21507-A', |
| 43 | + FALSE |
| 44 | + ), |
| 45 | + ( |
| 46 | + '9416f4a5-fe01-4b61-a07b-eb75892ef562', |
| 47 | + 'invalid check digit in isbn is not treated as zero', |
| 48 | + '4-598-21507-B', |
| 49 | + FALSE |
| 50 | + ), |
| 51 | + ( |
| 52 | + 'c19ba0c4-014f-4dc3-a63f-ff9aefc9b5ec', |
| 53 | + 'invalid character in isbn is not treated as zero', |
| 54 | + '3-598-P1581-X', |
| 55 | + FALSE |
| 56 | + ), |
| 57 | + ( |
| 58 | + '28025280-2c39-4092-9719-f3234b89c627', |
| 59 | + 'X is only valid as a check digit', |
| 60 | + '3-598-2X507-9', |
| 61 | + FALSE |
| 62 | + ), |
| 63 | + ( |
| 64 | + 'f6294e61-7e79-46b3-977b-f48789a4945b', |
| 65 | + 'valid isbn without separating dashes', |
| 66 | + '3598215088', |
| 67 | + TRUE |
| 68 | + ), |
| 69 | + ( |
| 70 | + '185ab99b-3a1b-45f3-aeec-b80d80b07f0b', |
| 71 | + 'isbn without separating dashes and X as check digit', |
| 72 | + '359821507X', |
| 73 | + TRUE |
| 74 | + ), |
| 75 | + ( |
| 76 | + '7725a837-ec8e-4528-a92a-d981dd8cf3e2', |
| 77 | + 'isbn without check digit and dashes', |
| 78 | + '359821507', |
| 79 | + FALSE |
| 80 | + ), |
| 81 | + ( |
| 82 | + '47e4dfba-9c20-46ed-9958-4d3190630bdf', |
| 83 | + 'too long isbn and no dashes', |
| 84 | + '3598215078X', |
| 85 | + FALSE |
| 86 | + ), |
| 87 | + ( |
| 88 | + '737f4e91-cbba-4175-95bf-ae630b41fb60', |
| 89 | + 'too short isbn', |
| 90 | + '00', |
| 91 | + FALSE |
| 92 | + ), |
| 93 | + ( |
| 94 | + '5458a128-a9b6-4ff8-8afb-674e74567cef', |
| 95 | + 'isbn without check digit', |
| 96 | + '3-598-21507', |
| 97 | + FALSE |
| 98 | + ), |
| 99 | + ( |
| 100 | + '70b6ad83-d0a2-4ca7-a4d5-a9ab731800f7', |
| 101 | + 'check digit of X should not be used for 0', |
| 102 | + '3-598-21515-X', |
| 103 | + FALSE |
| 104 | + ), |
| 105 | + ( |
| 106 | + '94610459-55ab-4c35-9b93-ff6ea1a8e562', |
| 107 | + 'empty isbn', |
| 108 | + '', |
| 109 | + FALSE |
| 110 | + ), |
| 111 | + ( |
| 112 | + '7bff28d4-d770-48cc-80d6-b20b3a0fb46c', |
| 113 | + 'input is 9 characters', |
| 114 | + '134456729', |
| 115 | + FALSE |
| 116 | + ), |
| 117 | + ( |
| 118 | + 'ed6e8d1b-382c-4081-8326-8b772c581fec', |
| 119 | + 'invalid characters are not ignored after checking length', |
| 120 | + '3132P34035', |
| 121 | + FALSE |
| 122 | + ), |
| 123 | + ( |
| 124 | + 'daad3e58-ce00-4395-8a8e-e3eded1cdc86', |
| 125 | + 'invalid characters are not ignored before checking length', |
| 126 | + '3598P215088', |
| 127 | + FALSE |
| 128 | + ), |
| 129 | + ( |
| 130 | + 'fb5e48d8-7c03-4bfb-a088-b101df16fdc3', |
| 131 | + 'input is too long but contains a valid isbn', |
| 132 | + '98245726788', |
| 133 | + FALSE |
| 134 | + ); |
0 commit comments