stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: Convention for defining/calling type-based test cases
Date Fri, 25 Apr 2008 19:13:48 GMT
Eric Lemings wrote:
>  
> I've noticed a lot of test employing the following convention:

That's a workaround for compilers that can't handle this kind
of thing (see, for example, the EXPLICIT_ARG.cpp config test).
Some older compilers that did grok the explicit argument list
weren't able to overload on it. I don't think we have any of
these compilers on our matrix anymore so we can probably stop
using the workaround and maybe even delete the config test.

Btw., some time ago, we briefly discussed compiling a list
of essential C++ features that we should be able to assume
of every compiler. Seems that explicit function template
argument lists should be on that list.

See the thread Re: list of required C++ features:
   http://stdcxx.markmail.org/message/zuawhacu2cihto4y

Martin

>  
> template < typename T >
> test_case_X (T /*unused*/)
> {
>     ...
> }
>  
> static void
> run_test ()
> {
>     test_case_X (char ());
> }
>  
> The type argument is typically only used for implicit binding and unused
> with the test case function itself.  So couldn't the test case function
> be written without the argument and the type specified explicitly at the
> point of call?  Example:
> 
> template < typename T >
> test_case_X ()
> {
>     ...
> }
> 
> static void
> run_test ()
> {
>     test_case_X <char> ();
> }
> 
> This makes it a little more evident that the test case function only
> tests the type itself and not instances of the type.
> 
> Brad.


Mime
View raw message