Testsuite additions
Chris Jefferson
caj@cs.york.ac.uk
Sat Nov 13 16:57:00 GMT 2004
I submitted an earlier version of this, but have since cleaned it up
some more.
testsuite_iterators.h is able to wrap a basic pointer as any of the
categories of iterator. It also checks to see if any operations are
performed on the iterator which should not be. By defining
DISABLE_ITERATOR_DEBUG the debugging features can be removed and in this
case the pointers should be as efficent as simple raw pointers, giving a
way of testing an algorithm's performance on each type of input operator.
Note: Some comically, I don't promise that I've managed to test all of
this testsuite :) So should you try and use it and find that you get an
error, suspect the testsuite as well as the algorithm. Hopefully these
should be sorted out over time. I already have a bunch of other tests
written, but I want to check these get accepted before neatening them up
and submitted.
To show the use of testsuite_iterators.h, I attach alg_test.cc which
tests search_n and also search_n_performance.cc , which tests the
performance of search_n under both random_access and forward iterators
(yes they are identical at the moment, but they might not be soon).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alg_test.cc
Type: text/x-c++src
Size: 3122 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041113/9399b003/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testsuite_iterators.h
Type: text/x-chdr
Size: 14044 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041113/9399b003/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: search_n.cc
Type: text/x-c++src
Size: 2597 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041113/9399b003/attachment-0002.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_testsuite
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20041113/9399b003/attachment.ksh>
More information about the Libstdc++
mailing list