stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: [PATCH] Update test 22.locale.num.put.mt.cpp to validate results [take 2]
Date Tue, 14 Aug 2007 01:45:07 GMT
Travis Vitek wrote:
>  
[...]
>>> +    TEST_N (data.bool_, bool, data.value_ != 0); 
>>> +    TEST_N (data.long_, long, data.value_);
>>> +    TEST_N (data.ulong_, unsigned long, data.value_);
>> I note you've changed the test from invoking one num_put member
>> per iteration to invoking all members each iteration. I'm curious
>> about your rationale for the change? (I don't necessarily disagree
>> with the approach, just wondering what if anything led you to make
>> the change.) FWIW, the one advantage to sticking with the original
>> testing strategy is that it would let us eliminate the call to
>> pubsetp() and (possibly) do away with the macros.
> 
> I'm missing something here. I don't see how we can eliminate the
> pubsetp() calls. If we did, then the next insertion operation will
> insert after the previous one. Instead of writing to the front of the
> buffer every time, we'd be appending to it. At some point an insertion
> will fail because the put pointer is at the end. Am I wrong?

You're right. I meant that if called put() only once each iteration
like we did before we would only need to call pubsetp() once as well.
Like so:

     for (opt_nloops) {
         buf.pubsetp (...);

         switch (overload_to_call) {
         case bool_overload: np.put ((bool)value); break;
         case int_overload: np.put ((int)value); break;
         case dbl_overload: np.put ((double)value); break;
         case ptr_overload: np.put ((void*)value); break;
         }

         RW_ASSERT (postconditions);
     }

Martin

Mime
View raw message