# tag: Tom Lord Tue Dec 4 15:05:27 2001 (bitset-tests/DESC) # We test the installed header files to make sure they compile. unit-bitset Reads a test script that describes a series of set operations. Writes a file of results. Compares the expected and actual results. The test script and results are generated by a Scheme program using lists to represent sets. Each operation is tested for a variety of bitset sizes including 0, 1, sizeof(subset) - 1, sizeof (subset), and several others. At each size, the operation is tried with fencepost bits (the bits before and after the set) set to all four possible combinations (0/0, 0/1, 1/0, 1/1) and these bits are watched for overwrites. For each size/fencepost combination, operations are repeated with empty sets, full sets, and random sets. When an operation requires a bit position, it is tried with position 0, position `n-1' (the last bit in an n-bit set), and a random position. When an operation requires a range of bits, it is tried with the entire set, a randomly chosen empty range, a randomly chosen non-empty range, and randomly chosen prefix and suffix ranges (ranges beginning at 0 or ending at `n-1'.) (These tests caught many bugs that were not otherwise detected as the bitset library was written and modified.) unit-bitset-tree This test works by constructing equivalent flat bitsets and bitset trees, performing operations on both, and comparing the results. Tests are repeated for full bitsets, empty bitsets, and randomly populated bitsets. Tests that require a bit index are repeated with index 0, index `n-1' (for an n-bit set) and a randomly chosen idnex. Tests that require a range of indexes are repeated for the entire bitset, for a randomly chosen empty range, a randomly chosen non-empty ranges of various sizes, and random prefix and suffix ranges. Bitset trees are compacted upon construction. After they are operated on, the result is tested without compaction, then is compacted, then tested again. A weakness of this test is that only one `bits_tree_rule' is tested. bits This is the same as the bitset tree tests, using `bits' instead of `bits_tree'. bitset_print bitset_tree_print bits_print uni_bits These are not directly tested, but if they don't work correctly, other tests (notably the unicode database) will (likely) fail.