Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
COMP1406 Assignment 2 Temperature & Boxes
Assignment 6: Category-Partition
This individual assignment has two parts. For Part I, you must generate test case
specifications for the version of the encode utility, whose specs are provided below, using
the category-partition method. For Part II, you will demonstrate how some of your test
frames may be used, by developing test cases that implement them.
Concise Specification of the encode Utility
●
NAME:
encode – encodes words in a file.
●
SYNOPSIS
encode OPT <filename>
where OPTcan be zero or more of
○
○
○
-a
(-r | -k) <string>
-c <string>
●
COMMAND-LINE ARGUMENTS AND OPTIONS
<
-r|-k) <string>:if specified, the utility will remove(-r) or keep (-k) only the
alphabetic characters (capitalization insensitive) in the file which are included in the
required <string>. All non-alphabetic characters are unaffected. -r and -k are
mutually exclusive.
–
c <string>:if specified, the encodeutility will reverse the capitalization (i.e.,
lowercase to uppercase, and uppercase to lowercase) of all the occurrences, in the
file, of the characters specified in the required <string>argument.
If none of the OPT flags is specified, encode will default to applying -c to all
letters A-Z.
●
NOTES
○
While the last command-line parameter provided is always treated as the
filename, OPT flags can be provided in any order; no matter the order of the
parameters, though, option -awill always be applied last.
●
EXAMPLES OF USAGE
Example 1:
encode file1.txt
(
where the content of the file is “abcXYZ”)
Reverses the capitalization of all letters. (resulting in “ABCxyz”).
Example 2:
encode -r aZ file1.txt
Removes all instances of a, A, z and Z from the file.
Example 3:
encode -c “aeiou” -k “aeiouxyz” file1.txt
Changes all occurrences of characters ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’ to uppercase, and all
occurrences of characters ‘A’, ‘E’, ‘I’, ‘O’ and ‘U’ to lowercase. Then, removes all
letters other than ‘a’, ‘e’, ‘i’, ‘o’, ‘u’, ‘x’, ‘y’, ‘z’, ‘A’. ‘E’, ‘I’, ‘O’, ‘U’, ‘X’, ‘Y’ and ‘Z’.
Example 4:
encode -a -k abc file1.txt
Removes all letters that are not ‘a’, ‘b’, ‘c’, ‘A’, ‘B’, or ‘C’. Then, encodes ‘a’ to ‘z’, ‘b’ to
‘
y’, and ‘c’ to ‘x’ (and the corresponding capitalized equivalents.)