stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: test for lib.partial.sum
Date Mon, 27 Feb 2006 22:15:55 GMT
Anton Pevtsov wrote:
> The attached file contains the test for the lib.partial.sum algorithm.

Thank you. Committed thus:
http://svn.apache.org/viewcvs?rev=381457&view=rev

[...]
> struct Y: public X
> {
[...]
>     Y (): X () { /* empty */ }
> 
>     Y (const Y &rhs): X (rhs) { /* empty */ }

The default and copy ctor are unnecessary here (the compiler-generated
versions are just as good). I removed them before committing the test.

> };
> 
> /* static */ size_t  Y::n_total_op_plus_;
                ^^^^^^

Careful about qualifying names with the std:: prefix. To detect these
errors compile with the EDG eccp demo. I corrected this in the final
version.

[...]

> template <class InputIterator, class OutputIterator>
> struct PartialSum : PartialSumBase
> {
[...]
>     virtual ~PartialSum() {}

Overriding the dtor here is unnecessary. I removed it.

[...]
> // exercises partial_sum (26.4.3)
> void test_partial_sum (const std::size_t       N,
>                        const PartialSumBase   &alg,
>                        bool                    binop,
>                        bool                    same_seq)
> {
[...]
>         rw_assert (success, 0, __LINE__,
>                    "step %zu: partial_sum <%s, %s%{?}, %s%{;}> = %p"
>                    " expected %p, difference %td",
>                    i + 1, itname, outname, binop, opname, res, dst_end,
>                    res - dst_end);

I think I now understand your suggestion for an %{Y=*.*} directive
analogous to %{X=*.*}. I think we can simply extend class X and
define operator+=() et al to avoid having to even define Y. Once
we've done than we need to remember to revisit these tests and
1) remove class Y and b) add enhance the diagnostic output to
print out the sequences of objects of type X as we do elsewhere.

Martin

Mime
View raw message