1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 3 4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 5<head> 6 <meta name="generator" content= 7 "HTML Tidy for Linux/x86 (vers 12 April 2005), see www.w3.org" /> 8 9 <title>Priority-Queue Regression Tests</title> 10 <meta http-equiv="Content-Type" content= 11 "text/html; charset=us-ascii" /> 12 </head> 13 14<body> 15 <div id="page"> 16 <h1>Priority-Queue Regression Tests</h1> 17 18 <h2><a name="assoc_desc" id="assoc_desc">Description</a></h2> 19 20 <p>The library contains a single comprehensive regression test. 21 For a given container type in <tt>pb_ds</tt>, the test creates 22 an object of the container type and an object of the 23 corresponding STL type (<i>i.e.</i>, 24 <tt>std::priority_queue</tt>). It then performs a random 25 sequence of methods with random arguments (<i>e.g.</i>, pushes, 26 pops, and so forth) on both objects. At each operation, the 27 test checks the return value of the method, and optionally both 28 compares <tt>pb_ds</tt>'s object with the STL's object as well 29 as performing other consistency checks on <tt>pb_ds</tt>'s 30 object (<i>e.g.</i>, that the size returned by the 31 <tt>size</tt> method corresponds to the distance between its 32 <tt>begin</tt> and end iterators).</p> 33 34 <p>Additionally, the test integrally checks exception safety 35 and resource leaks. This is done as follows. A special 36 allocator type, written for the purpose of the test, both 37 randomly throws an exceptions when allocations are performed, 38 and tracks allocations and de-allocations. The exceptions thrown 39 at allocations simulate memory-allocation failures; the 40 tracking mechanism checks for memory-related bugs (<i>e.g.</i>, 41 resource leaks and multiple de-allocations). Both 42 <tt>pb_ds</tt>'s containers and the containers' value-types are 43 configured to use this allocator.</p> 44 45 <h2><a name="pq_tests" id="pq_tests">Tests</a></h2> 46 47 <p><a href= 48 "http://gcc.gnu.org/viewcvs/*checkout*/trunk/libstdc%2B%2B-v3/testsuite/ext/pb_ds/regression/priority_queue_rand.cc"><tt>priority_queue_rand.cc</tt></a> 49 checks all priority queue types.</p> 50 </div> 51</body> 52</html> 53