It was noted that these tests were highly dependent on the state of the database at the time the test was run and were therefore not easily repeatable. However, it was decided that keeping multiple copies of the necessary data files would be quicker than writing a more complex test harness to construct test cases dynamically, and minimise the number of potential bugs in the test harness itself.
In order to test the getEventCounts() and getChangedEntries() methods, the event counts were extracted from the database using getEventCounts(). A few updates were then made to the database before the extracted event counts were passed to getChangedEntries(). The values returned by getChangedEntries() were then printed out so it could be checked that the correct entries had been returned.
The final function of the user database to be tested was the creation of a new user. The test for this was to pass in an IP address as a string, have the test program print out the representation of that IP address and the current time as 32-bit unsigned integers and then tell the database to create the user. (See appendix A.3.1.) The data files were then checked to make sure the user had been created and what UserID had been assigned. This was then manually checked against the information printed out by the test program which was extremely tedious, but helped to spot a serious problem. The order of precedence of operators meant that the original code of
unsigned long long uid = msb<<32 + ipaddr;did not produce the expected UserID and so was changed to: = (msb«32) + ipaddr;.