Assignment title: Information
5.5 #7. Java provides a package, java.util.regex, to manipulate regular expressions.
Write a regular expression for URLs and then evaluate a set of URLs against your
regular expression. This assignment involves programming, since input structure
testing without automation is pointless.
(a) Write (or find) a regular expression for a URL. Your regular expression does not
need to be so general that it accounts for every possible URL, but give your best
effort (for example "*" will not be considered a good effort). You are strongly
encouraged to do some web surfing to find some candidate regular expressions.
One suggestion is to visit the Regular Expression Library.
(b) Collect a set of URLs from a small web site (such as a set of course web pages).
Your set needs to contain at least 20 (different) URLs. Use the java.util.regex
package to validate each URL against your regular expression.
(c) Construct a valid URL that is not valid with respect to your regular expression
(and show this with the appropriate java.util.regex call). If you have done an
outstanding job in part 1, explain why your regular expression does not have any
such URLs.
Solution:
5.1.1 #2. Just as with graphs, it is possible to generate an infinite number of tests
from a grammar. How and what makes this possible?
Solution:
5.1.2 #3. Consider the stream BNF in Section 5.1.1 and the ground string "B 10
06.27.94." Give three valid and three invalid mutants of the string. Stream BNF
from section 5.1.1: G 17 08.01.90
B 13 06.27.94
G 13 11.21.94
B 04 01.09.03
Solution: