test frame for the key file library
test frame for the key file libraryThis test frame calls the key file library, it is an interactive test frame capable of regression tests.
Interactive mode:
Call the program pblkftst from a UNIX or DOS shell.
The following commands to test the PBL Key File Library are supplied:
q FOR QUIT createInteractive mode example:open close | flush | delete insert ninsert find < LT | LE | FI | EQ | LA | GE | GT > update ndelete first | last | next | prev | this | read list The following short examples demonstrates how to use the interactive test frame. Lines starting with a # are printed by the program lines starting with other characters are user input.
pblkftst##command: create /tmp/keytest # create filename # pblKfCreate( /tmp/keytest ) # ok!
##command: insert testkey testdata # insert key, data # pblKfInsert( 1, testkey, 8, testdata, 9 ) # rc 0, pbl_errno 0, errno 0
##command: first # pblKfFirst( 1 ) # datalen 9, key testkey, keylen 8
##command: close # pblKfClose( 1 ) # rc 0, pbl_errno 0, errno 0
##command: quit
Regression mode:
Put a sequence of test commands into a test batch file.
Example:
Open a new file KEY0001.TST and add the following lines
create /tmp/keytest2 insert testkey testdata first close quitThen run pblkftst KEY0001.TSTThe program creates a log file called pblkftst.log when run. This log file can be used as regression input file for further tests.
##command: create # create filename /tmp/key0001 # pblKfCreate( /tmp/key0001 ) # ok!Keep the contents of this file and diff it with the outout of the KEY0001.TST testcase you created whenever you change the code of the library.##command: insert # insert key, data testkey testdata # pblKfInsert( 1, testkey, 8, testdata, 9 ) # rc 0, pbl_errno 0, errno 0
##command: first # pblKfFirst( 1 ) # datalen 9, key testkey, keylen 8
##command: close # pblKfClose( 1 ) # rc 0, pbl_errno 0, errno 0
##command: quit
See pblISAMFILE_TestFrame for an example of regression tests with a test frame. The regression test cases given with pblISAMFILE_TestFrame of course also test the PBL Key File library.