libstdc++ Testsuite extension for sort, partial_sort, partial_sort_copy, nth_element

Paolo Carlini paolo.carlini@oracle.com
Mon Oct 21 08:45:00 GMT 2013


Hi,

On 10/19/2013 11:10 PM, Christopher Jefferson wrote:
> The following patch (related to my 58800 patch) adds many more tests
> for several important functions. While 58800 is my fault, the reason
> it was not caught earlier is that many functions in libstdc++ have
> almost no testing. This works toward fixing that.
>
> These tests are kept to an acceptable amount of time (~2 seconds/
> function) at the moment (and automatic reduction for simulators),
> although I would like to take much more time and do much more testing,
> but I realise that might annoy some people so it might not be on by
> default.
>
> I plan to write my tests if these are accepted (although writing this
> reminded me why gcc is the worst open source project for submitting
> code to I have ever worked with).
>
> 2013-10-16  Edward Smith-Rowland  <3dw4rd@verizon.net>
>
> * testsuite/util/testsuite_iterators.h : Add 'val' method to read
> testsuite container.
> * testsuite/25_algorithms/partial_sort/nth_element.cc : New
> * testsuite/25_algorithms/partial_sort/random_test.cc : New
> * testsuite/25_algorithms/partial_sort_copy/random_test.cc : New
> * testsuite/25_algorithms/sort/random_test.cc : New
> * testsuite/util/testsuite_containergen.h : New header for
> automatically testing functions on a large set of autogenerated
> headers
a bunch of nits and a more substantive issue. The nits are: the name in 
the ChangeLog ;); these days prefer -std=gnu++11 to 0x, only 2013 as 
Copyright date. Also, stylistically, we don't use curly braces in 
single-line for loop bodies. Watch out overlong lines, as usual (I 
spotted a couple)

Slightly more interesting: while we are at it, we are including the 
whole <random>, why not using uniform_int_distribution instead of 
fiddling with % in lots of places? It's also preferable from a 
statistical point of view (probably doesn't matter much in this specific 
application, but using % isn't something we want to recommend to people 
studying free software to learn about these topics, eh!)

Thanks,
Paolo.



More information about the Libstdc++ mailing list