DELTA 533 7209 49 SVN'«Y«Y€«YWhite Box Test Cases Ellen Kephart These test cases are specifically intended to exercise each logical path of each routine. As such, each routine is tested individually. Where a routine calls another routine or uses a global data structure, that routine or data structure is stubbed instead (see framework.txt) to return or contain the appropriate value (as needed for testing). Tests: For each function, the necessary stubs are listed, and then the tests. A preceding colon indicates a "test"; an asterisk indicates a condition to be true for multiple following tests. A "set" of tests for a single conditional is demarcated by hyphens. A "test case" will consist of performing one test from each set in the sequence they are presented; the "test suite" for each routine will consist of the set of all possible test cases. The output and / or program state to be checked after each test case is completed is indicated by arrows. Parentheses indicate a note. ignore_check : ------------- Stubs to be simulated by wrapper program: cheap_last - an array cheap_penu - an array ign_hash - a function returning a pointer Tests: -- : The passed name is an array of size 0. : the passed name is an array of a size from 1 to unreasonably large. -- * cheap_last and cheap_penu contain a different character at each index, but : both contain 0 at the tested index --> FALSE returned : cheap_last contains 0 at the tested index and cheap_penu does not, --> FALSE returned : and vice versa. (the characters are different so the specific index being accessed can be easily determined.) --> FALSE returned : neither array contains 0 at the specified index, but every other index is 0. -- : ign_hash returns 0 : ign_hash returns a valid pointer --> TRUE returned -- : opt_debug & DBG_IGNORE returns TRUE --> Messages are printed to stderr : it returns FALSE : it returns MAYBE (see the bool_t typedef!) -- : expr_list is empty : expr_list contains a single regular expression : expr_list contains several regular expressions -- : name and all values gmatch to 0 --> FALSE returned : name and at least one value gmatch to a nonzero value --> TRUE returned ------------------------------------------------------------------------------- ignore_file : ----------- Stubs: cheap_check -- a function returning nothing ign_hash -- returns nothing in this case Tests: -- : opt_debug & DBG_IGNORE returns TRUE --> Messages are printed to stderr : it returns FALSE : it returns MAYBE -- --> The cheap_check and ign_hash functions were called properly ------------------------------------------------------------------------------- ignore_expr : ----------- Stubs: cheap_check -- a function returning nothing Tests: -- : expr has size 0 * expr has a non-zero size : from 1 : to unreasonably large -- : allocating new node with malloc fails : it succeeds -- : lp is equal to 0 : lp is equal to something else -- : opt_debug & DBG_IGNORE returns TRUE --> Messages are printed to stderr : it returns FALSE : it returns MAYBE -- --> All memory has been allocated and written to (or not) properly ------------------------------------------------------------------------------- ignore_pgm : ---------- Stubs: A program to generate files or regexps Tests: -- : opt_debug & DBG_IGNORE returns TRUE --> Messages are printed to stderr : it returns FALSE : it returns MAYBE -- :fp is NULL --> routine returns with an error : program is called properly and fp is non-NULL -- :fgets is initially 0 :fgets is initially nonzero -- : inbuf is empty : inbuf contains content -- : inbuf has leading whitespace : inbuf has no leading whitespace -- : *s return false -->nothing should be added : *s has content -- --> cheap_check and ign_hash were properly called --> the input read matches what the program should generate ------------------------------------------------------------------------------- ign_hash: -------- Stubs: Tests: -- : *name is empty : *name contains valid characters -- : alloc is 0 : alloc is nonzero -- : pp is a null address : pp is a valid address -- :strcmp returns 0 : strcmp does not return 0 -- --> if alloc was nonzero: : malloc succeeded : malloc failed -- --> Memory was properly allocated and the lists properly generated ------------------------------------------------------------------------------- cheap_check: ----------- Stubs: cheap_last and cheap_penu arrays -- this should be tested both with these empty, and with these populated or partially populated. Tests: -- : name has size 0 * name has a non-zero size : from 1 : to unreasonably large -- : name ends in a wildcard character --> all values of cheap_last and cheap_ penu are set to 1 : name ends in a non-wildcard --> corresponding character in cheap_last is set to 1, and no other characters are changed -- : penultimate character is wildcard --> all valuse of cheap_penu are set to 1 : penultimate character is a non-wildcard --> corresponding character in cheap_penu is set to 1, and no other characters are changed -- ------------------------------------------------------------------------------- ignore_reset: ------------ Stubs: cheap_last and cheap_penu -- arrays filled with random data file_list -- hash chain expr_list -- hash chain Tests: : one or more of the stubs are in invalid memory locations : all stubs are valid -- --> All memory belonging to the data structure was freed (or set to 0) appropriately --> No inappropriate memory was overwritten or freed ------------------------------------------------------------------------------- ENDREP id: xa.0.r535/5632 type: file pred: xa.0.r534/5200 count: 2 text: 535 0 5607 5593 4069f43291da4a24c922c00afb90211a cpath: /ekephart/project4/whitebox_cases.txt copyroot: 0 / PLAIN K 20 acceptance_cases.txt V 19 file x8.0.r534/5025 K 18 blackbox_cases.txt V 20 file xd.26.r534/4807 K 13 framework.txt V 19 file xc.0.r534/5377 K 8 ignore.c V 19 file x9.0.r533/9139 K 14 postmortem.txt V 19 file xb.0.r533/9439 K 18 whitebox_cases.txt V 19 file xa.0.r535/5632 END ENDREP id: wh.0.r535/6101 type: dir pred: wh.0.r534/5843 count: 3 text: 535 5807 281 281 542d8e9b56540af055261d6641facf8d cpath: /ekephart/project4 copyroot: 0 / PLAIN K 5 proj1 V 18 dir wg.0.r481/6510 K 8 project4 V 18 dir wh.0.r535/6101 END ENDREP id: 5a.0.r535/6345 type: dir pred: 5a.0.r534/6088 count: 17 text: 535 6257 75 75 1c22e64566af17124406b215b37c4b5c cpath: /ekephart copyroot: 0 / PLAIN K 7 ahunter V 16 dir 1.0.r330/522 K 16 alamottemitchell V 17 dir 2.0.r401/6823 K 8 apienkos V 18 dir 6e.0.r168/5452 K 8 asampson V 16 dir 3.0.r430/455 K 7 blickly V 18 dir 17.0.r435/2704 K 9 bmclarnon V 17 dir 4.0.r141/2350 K 7 calvino V 18 dir r5.0.r444/3792 K 7 chebert V 17 dir 5.0.r378/2064 K 8 croberts V 18 dir 4d.0.r433/1118 K 11 dlapayowker V 17 dir 6.0.r532/3373 K 8 ekephart V 18 dir 5a.0.r535/6345 K 10 eruvalcaba V 17 dir 7.0.r442/1735 K 7 gfarnum V 18 dir 18.0.r465/9836 K 8 hjustice V 17 dir 8.0.r369/2317 K 8 jfennell V 17 dir 6d.0.r128/757 K 9 jmarkello V 17 dir 9.0.r276/1385 K 7 jsimons V 18 dir 7e.0.r164/2562 K 5 kkarr V 18 dir r4.0.r460/2674 K 9 labramyan V 18 dir 4g.0.r439/1598 K 8 lmarkham V 16 dir 2r.0.r530/50 K 9 mbuchanan V 17 dir a.0.r245/1133 K 8 mconbere V 17 dir b.0.r440/2500 K 10 mgibiansky V 15 dir c.0.r44/950 K 8 mmcknett V 18 dir 4e.0.r341/1645 K 5 mpyne V 17 dir d.0.r269/1955 K 8 mroberts V 17 dir e.0.r398/1502 K 9 nchenette V 18 dir f.0.r129/13332 K 7 pmiller V 18 dir 2s.0.r511/2727 K 6 ssloss V 19 dir vg.0.r480/58966 K 9 sstriplin V 18 dir 4f.0.r412/3193 K 8 striglia V 17 dir 7f.0.r420/976 END ENDREP id: 0.0.r535/7644 type: dir pred: 0.0.r534/7388 count: 535 text: 535 6491 1140 1140 d4b0f53f4c7a3e46764c843e08ab3e43 cpath: / copyroot: 0 / xa.0.t534-1 modify true false /ekephart/project4/whitebox_cases.txt 7644 7785