Priority-Queue Regression Tests


The library contains a single comprehensive regression test. For a given container type in pb_ds, the test creates an object of the container type and an object of the corresponding STL type (i.e., std::priority_queue). It then performs a random sequence of methods with random arguments (e.g., pushes, pops, and so forth) on both objects. At each operation, the test checks the return value of the method, and optionally both compares pb_ds's object with the STL's object as well as performing other consistency checks on pb_ds's object (e.g., that the size returned by the size method corresponds to the distance between its begin and end iterators).

Additionally, the test integrally checks exception safety and resource leaks. This is done as follows. A special allocator type, written for the purpose of the test, both randomly throws an exceptions when allocations are performed, and tracks allocations and de-allocations. The exceptions thrown at allocations simulate memory-allocation failures; the tracking mechanism checks for memory-related bugs (e.g., resource leaks and multiple de-allocations). Both pb_ds's containers and the containers' value-types are configured to use this allocator.

Tests checks all priority queue types.