-------+--------------------------------------------------------------------------------------------------------------- Test # | Purpose of Tests -------+--------------------------------------------------------------------------------------------------------------- 1 | Tests the command line parsing -------+--------------------------------------------------------------------------------------------------------------- 2-7 | Tests that the commands are syntactically valid -------+--------------------------------------------------------------------------------------------------------------- 8-14 | Tests the implementation of the vector (standard use versus erroneous use) -------+--------------------------------------------------------------------------------------------------------------- -------+--------------+---------+--------------------------------------------+----------------------------------------- Test # | Type of Test | Line #s | Reason for Test | Analysis of Test -------+--------------+---------+--------------------------------------------+----------------------------------------- 1 | Boundary. | Part A | All commands and comments must start in the| As can be seen, rejected both a comment | command | 3-4, | first column of the line; otherwise, they | and a command which started in column 2. | placement | 5-9, | are considered invalid. All other commands | However valid comments are properly | | 34-35 | start in column 1. | processed i.e. ignored. -------+--------------+---------+--------------------------------------------+----------------------------------------- 2 | Boundary. | Part A | Invalid number of parameters for assign | Commands are rejected since an error | # parameters | 10-11,15| command (too few or too many). | message about invalid # of parameters is | for assign | 36-37, | | printed for each of these commands. | | 39,41,43| | -------+--------------+---------+--------------------------------------------+----------------------------------------- 3 | Boundary. | Part A | Invalid vector number specified. Since test| Commands are rejected since an error | v < 0, v > 2 | 12-14 | for vector is applied to all commands but | message about invalid vector # printed | v != integer | 38,40,42| the comment, only test for assignment. | for each invalid specification. -------+--------------+---------+--------------------------------------------+----------------------------------------- 4 | Boundary. | Part A | Invalid number of parameters for fetch | Commands are rejected since an error | # parameters | 20-22 | command (too few or too many). | message about invalid # of parameters is | for fetch | 45-47 | | printed for each of these commands. -------+--------------+---------+--------------------------------------------+----------------------------------------- 5 | Boundary. | Part A | Invalid number of parameters for status | Commands are rejected since an error | # parameters | 26-27 | command (too few or too many). | message about invalid # of parameters is | for status | 48-49 | | printed for each of these commands. -------+--------------+---------+--------------------------------------------+----------------------------------------- 6 | Boundary. | Part A | Invalid number specified. Since test for | Command is rejected since an error | subscript or | 16,44 | for integer is applied to all arguments of | message about invalid integer # printed. | value != | | all commands but the comment, only test for| | integer | | assignment command. | -------+--------------+---------+--------------------------------------------+----------------------------------------- 7 | General | Part A | Test a random invalid command to ensure | Commands are rejected since error | random error | 31-32 | it is detected as an invalid command. | messages about an unknown command are | command | 50-52 | Test includes a blank line. | printed. -------+--------------+---------+--------------------------------------------+----------------------------------------- 8 | Boundary. | Part B | Test status command on empty vectors. Also | As can be seen from the messages, all | Status on | 54-58 | serves to check that vectors are correctly | vectors have no non-zero entries and | empty vector | 78-80 | initialized to all non-zero items and no | correctly print out no range of indices | | | non-zero element index range. | for non-zero elements. -------+--------------+---------+--------------------------------------------+----------------------------------------- 9 | Boundary. | Part B | Fetch an element from an empty vector and | Since vector contains no non-zero | Fetch on | 61-62 | verify that vector is left unchanged. | elements, fetch correctly returns 0 for | empty vector | 81-82 | Also determines whether or not correctly | the specified index. Status shows vector | | | returns 0 for index position not explicitly| still has 0 non-zero elements and no | | | set to 0 or non-0 value. | index range. -------+--------------+---------+--------------------------------------------+----------------------------------------- 10 | Boundary. | Part B | Assign a 0 element to an empty vector and | Status still shows that vector has 0 | Insert 0 | 65-66 | check that the status is unchanged. | non-zero elements and no index range. | | 83 | | -------+--------------+---------+--------------------------------------------+----------------------------------------- 11 | General | Part B | Ensure that all changes to vector 0 have | Status still shows that vector has 0 | | 68 | left the other vectors unchanged (only need| non-zero elements and no index range. | | 84 | to check one of the others to ensure all ok| -------+--------------+---------+--------------------------------------------+----------------------------------------- 12 | Boundary. | Part B | Assign a non-0 element to an empty vector | Status shows that vector has 1 non-zero | Insert non-0 | 71-72 | and check that the status is correctly | element and the index range correctly | empty vector | 85 | changed. | encompasses the single index as both | | | | ends of the index range. -------+--------------+---------+--------------------------------------------+---------------------------------------- 13 | General | Part B | Insert non-0 elements to either end of | Status shows that vector correctly | Insert non-0 | 73-74 | previous index range and verify that the | contains 3 elements now, and that the | into non- | 86 | range was correctly extended. | range has been expanded correctly in | empty vector | | | both directions. -------+--------------+---------+--------------------------------------------+----------------------------------------- 14 | General. | Part B | Perform a fetch on an index associated with| Fetch correctly returns the value 101 | Fetch from | 76 | a non-0 value. | with the index 100. Since the vector is | non-empty | 87 | | dynamic, no boundaries need be tested. | vector | | | -------+--------------+---------+--------------------------------------------+----------------------------------------- PART A ------ 1 Script started on Wed May 05 14:11:17 1999 2 cs343@fitch.math[51]% cat invalid 3 * Command not starting in first column 4 ? 0 5 * Verify that errors are correctly reported for each 6 * command by testing # of arguments, invalid commands, 7 * and invalid vector specifications. 8 * 9 * Assignment 10 = 11 = 0 12 = -1 13 = 3 14 = x 15 = 3 1 1 1 16 = 0 x 1 17 * 18 * Fetch 19 * 20 ? 21 ? 0 22 ? 0 1 1 23 * 24 * Status 25 * 26 s 27 s 0 1 28 * 29 * Other commands should be ignored 30 * 31 x 32 1 33 cs343@fitch.math[52]% ./flexvec < invalid 34 ERROR: unknown command ' * Command not starting in first column' entered. 35 ERROR: unknown command ' ? 0' entered. 36 ERROR: invalid number of parameters for '='. 37 ERROR: invalid number of parameters for '= 0'. 38 ERROR: invalid vector specification '-1' entered for '= -1'. 39 ERROR: invalid number of parameters for '= -1'. 40 ERROR: invalid vector specification '3' entered for '= 3'. 41 ERROR: invalid number of parameters for '= 3'. 42 ERROR: invalid integer 'x' entered for '= x'. 43 ERROR: invalid number of parameters for '= 3 1 1 1'. 44 ERROR: invalid integer 'x' entered for '= 0 x 1'. 45 ERROR: invalid number of parameters for '?'. 46 ERROR: invalid number of parameters for '? 0'. 47 ERROR: invalid number of parameters for '? 0 1 1'. 48 ERROR: invalid number of parameters for 's'. 49 ERROR: invalid number of parameters for 's 0 1'. 50 ERROR: unknown command 'x' entered. 51 ERROR: unknown command '1' entered. 52 ERROR: unknown command '' entered. PART B ------ 53 cs343_ctkierst@fitch.math[53]% cat valid 54 * First verify the status of each vector. Also double-checks status 55 * command. 56 s 0 57 s 1 58 s 2 59 * Make a reference to a vector's element and verify that 60 * the status hasn't changed. 61 ? 0 5 62 s 0 63 * Insert a zero element and ensure that the vector status has not 64 * been modified 65 = 0 0 0 66 s 0 67 * First verify that vector 1 was untouched by other operations. 68 s 1 69 * Insert several non-zero items into a vector and verify 70 * that the status information has been correctly updated. 71 = 1 9 10 72 s 1 73 = 1 100 101 74 = 1 -10 -9 75 s 1 76 ? 1 100 77 cs343_ctkierst@fitch.math[54]% ./flexvec < valid 78 Vector0 has 0 non-zero entries. 79 Vector1 has 0 non-zero entries. 80 Vector2 has 0 non-zero entries. 81 FETCH returns 0 82 Vector0 has 0 non-zero entries. 83 Vector0 has 0 non-zero entries. 84 Vector1 has 0 non-zero entries. 85 Vector1 has 1 non-zero entries. Vector subscripts are in the range [9, 9]. 86 Vector1 has 3 non-zero entries. Vector subscripts are in the range [-10, 100]. 87 FETCH returns 101 88 cs343_ctkierst@fitch.math[55]% ex 89 script done on Wed May 05 14:17:05 1999