1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-07-08 01:54:21 +03:00

adding tests ; not enough yet

This commit is contained in:
Zed Lopez 2023-04-23 16:33:48 -07:00
parent a0f0d59b29
commit 6a18ea63c3
6 changed files with 118 additions and 0 deletions

View file

@ -9,6 +9,8 @@ To begin:
run test B;
run test C;
run test D;
run test E;
run test F;
To run test A:
let Neptune be text;
@ -46,3 +48,34 @@ To run test D:
replace the punctuated word "system," in Neptune with "toad";
replace the punctuated word "." in Neptune with "!";
say "The redacted text: [Neptune][line break]".
To run test E:
let Neptune be text;
let Neptune be "The capture of Triton may explain a number of features of the Neptunian system, including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants.";
let cap be "capture";
if Neptune matches the text cap:
say "matched '[cap]' from [start index of text match] to [final index of text match]: [length of text match] characters.";
unless cap matches the text Neptune:
say "'[cap]' did not match long string. [start index of text match] to [final index of text match]: [length of text match] characters.";
if cap matches the text "":
say "'[cap]' matched empty string. [start index of text match] to [final index of text match]: [length of text match] characters.";
unless Neptune matches the text "giants..":
say "Neptune did not match 'giants..' [start index of text match] to [final index of text match]: [length of text match] characters.";
if Neptune matches the text "t", case insensitively:
say "Neptune insensitively matched 't' [start index of text match] to [final index of text match]: [length of text match] characters.";
To run test F:
let Neptune be text;
let Neptune be "The capture of Triton may explain a number of features of the Neptunian system, including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants.";
if Neptune matches the regular expression "explain\s+(<a-d>+)\s*(num<^\s>+).+e(c+)":
repeat with i running from 0 to 3:
say "subexpression [i]: from [start index of subexpression i] to [final index of subexpression i], length [length of subexpression i] [text matching subexpression i].";
[ unless cap matches the text Neptune:
say "'[cap]' did not match long string. [start index of text match] to [final index of text match]: [length of text match] characters.";
if cap matches the text "":
say "'[cap]' matched empty string. [start index of text match] to [final index of text match]: [length of text match] characters.";
unless Neptune matches the text "giants..":
say "Neptune did not match 'giants..' [start index of text match] to [final index of text match]: [length of text match] characters.";
if Neptune matches the text "t", case insensitively:
say "Neptune insensitively matched 't' [start index of text match] to [final index of text match]: [length of text match] characters.";
]

View file

@ -9,6 +9,8 @@ To begin:
run test B;
run test C;
run test D;
run test E;
run test F;
To run test A:
let Neptune be text;
@ -46,3 +48,34 @@ To run test D:
replace the punctuated word "system," in Neptune with "toad";
replace the punctuated word "." in Neptune with "!";
say "The redacted text: [Neptune][line break]".
To run test E:
let Neptune be text;
let Neptune be "The capture of Triton may explain a number of features of the Neptunian system, including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants.";
let cap be "capture";
if Neptune matches the text cap:
say "matched '[cap]' from [start index of text match] to [final index of text match]: [length of text match] characters.";
unless cap matches the text Neptune:
say "'[cap]' did not match long string. [start index of text match] to [final index of text match]: [length of text match] characters.";
if cap matches the text "":
say "'[cap]' matched empty string. [start index of text match] to [final index of text match]: [length of text match] characters.";
unless Neptune matches the text "giants..":
say "Neptune did not match 'giants..' [start index of text match] to [final index of text match]: [length of text match] characters.";
if Neptune matches the text "t", case insensitively:
say "Neptune insensitively matched 't' [start index of text match] to [final index of text match]: [length of text match] characters.";
To run test F:
let Neptune be text;
let Neptune be "The capture of Triton may explain a number of features of the Neptunian system, including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants.";
if Neptune matches the regular expression "explain\s+(<a-d>+)\s*(num<^\s>+).+e(c+)":
repeat with i running from 0 to 3:
say "subexpression [i]: from [start index of subexpression i] to [final index of subexpression i], length [length of subexpression i] [text matching subexpression i].";
[ unless cap matches the text Neptune:
say "'[cap]' did not match long string. [start index of text match] to [final index of text match]: [length of text match] characters.";
if cap matches the text "":
say "'[cap]' matched empty string. [start index of text match] to [final index of text match]: [length of text match] characters.";
unless Neptune matches the text "giants..":
say "Neptune did not match 'giants..' [start index of text match] to [final index of text match]: [length of text match] characters.";
if Neptune matches the text "t", case insensitively:
say "Neptune insensitively matched 't' [start index of text match] to [final index of text match]: [length of text match] characters.";
]

View file

@ -9,6 +9,8 @@ To begin:
run test B;
run test C;
run test D;
run test E;
run test F;
To run test A:
let Neptune be text;
@ -46,3 +48,26 @@ To run test D:
replace the punctuated word "system," in Neptune with "toad";
replace the punctuated word "." in Neptune with "!";
say "The redacted text: [Neptune][line break]".
To run test E:
let Neptune be text;
let Neptune be "The capture of Triton may explain a number of features of the Neptunian system, including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants.";
let cap be "capture";
if Neptune matches the text cap:
say "matched '[cap]' from [start index of text match] to [final index of text match]: [length of text match] characters.";
unless cap matches the text Neptune:
say "'[cap]' did not match long string. [start index of text match] to [final index of text match]: [length of text match] characters.";
if cap matches the text "":
say "'[cap]' matched empty string. [start index of text match] to [final index of text match]: [length of text match] characters.";
unless Neptune matches the text "giants..":
say "Neptune did not match 'giants..' [start index of text match] to [final index of text match]: [length of text match] characters.";
if Neptune matches the text "t", case insensitively:
say "Neptune insensitively matched 't' [start index of text match] to [final index of text match]: [length of text match] characters.";
To run test F:
let Neptune be text;
let Neptune be "The capture of Triton may explain a number of features of the Neptunian system, including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants.";
if Neptune matches the regular expression "explain\s+(<a-d>+)\s*(num<^\s>+).+e(c+)":
repeat with i running from 0 to 3:
say "subexpression [i]: from [start index of subexpression i] to [final index of subexpression i], length [length of subexpression i] [text matching subexpression i].";

View file

@ -15,3 +15,12 @@ The original text: the capture of Triton may explain a number of features of the
The redacted text: potato capture of Triton may explain a number of features of potato Neptunian frog, including potato extremely eccentric orbit of Neptune's moon Nereid and potato scarcity of moons as compared to potato other gas giants.
The original text: The capture of Triton may explain a number of features of the Neptunian system, including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants.
The redacted text: The capture of Triton may explain a number of features of the Neptunian toad including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants!
matched "capture" from 5 to 11: 7 characters.
"capture" did not match long string. 0 to -1: 0 characters.
"capture" matched empty string. 1 to 0: 0 characters.
Neptune did not match "giants.." 0 to -1: 0 characters.
Neptune insensitively matched "t" 1 to 1: 1 characters.
subexpression 0: from 27 to 107, length 81 explain a number of features of the Neptunian system, including the extremely ecc.
subexpression 1: from 35 to 35, length 1 a.
subexpression 2: from 37 to 42, length 6 number.
subexpression 3: from 106 to 107, length 2 cc.

View file

@ -15,3 +15,12 @@ The original text: the capture of Triton may explain a number of features of the
The redacted text: potato capture of Triton may explain a number of features of potato Neptunian frog, including potato extremely eccentric orbit of Neptune's moon Nereid and potato scarcity of moons as compared to potato other gas giants.
The original text: The capture of Triton may explain a number of features of the Neptunian system, including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants.
The redacted text: The capture of Triton may explain a number of features of the Neptunian toad including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants!
matched "capture" from 5 to 11: 7 characters.
"capture" did not match long string. 0 to -1: 0 characters.
"capture" matched empty string. 1 to 0: 0 characters.
Neptune did not match "giants.." 0 to -1: 0 characters.
Neptune insensitively matched "t" 1 to 1: 1 characters.
subexpression 0: from 27 to 107, length 81 explain a number of features of the Neptunian system, including the extremely ecc.
subexpression 1: from 35 to 35, length 1 a.
subexpression 2: from 37 to 42, length 6 number.
subexpression 3: from 106 to 107, length 2 cc.

View file

@ -15,3 +15,12 @@
The redacted text: potato capture of Triton may explain a number of features of potato Neptunian frog, including potato extremely eccentric orbit of Neptune's moon Nereid and potato scarcity of moons as compared to potato other gas giants.
The original text: The capture of Triton may explain a number of features of the Neptunian system, including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants.
The redacted text: The capture of Triton may explain a number of features of the Neptunian toad including the extremely eccentric orbit of Neptune's moon Nereid and the scarcity of moons as compared to the other gas giants!
matched "capture" from 5 to 11: 7 characters.
"capture" did not match long string. 0 to -1: 0 characters.
"capture" matched empty string. 1 to 0: 0 characters.
Neptune did not match "giants.." 0 to -1: 0 characters.
Neptune insensitively matched "t" 1 to 1: 1 characters.
subexpression 0: from 27 to 107, length 81 explain a number of features of the Neptunian system, including the extremely ecc.
subexpression 1: from 35 to 35, length 1 a.
subexpression 2: from 37 to 42, length 6 number.
subexpression 3: from 106 to 107, length 2 cc.