On Mon, Nov 9, 2009 at 4:31 PM, Glyn Matthews <[email protected]> wrote:
> Hi Kim,
>
> 2009/11/9 Kim Gräsman <[email protected]>
>>
>> Hi guys,
>>
>> On Sun, Nov 8, 2009 at 22:21, Glyn Matthews <[email protected]>
>> wrote:
>> >
>> >> > Consequently, I'd like to see all your unit tests repeated for
>> >> > std::wstring.  I think this is important to do because it will really
>> >> > justify the approach we are taking.
>> >>
>> >> I agree. Can this be done automatically? Copy-paste-replace?
>> >
>> > I wouldn't recommend copy-paste programming ;) Perhaps just refactor the
>> > original tests so that they use template member functions:
>> >
>> > BOOST_AUTO_TEST_CASE(my_uri_test) {
>> >     boost::network::basic_uri<tags::default_> instance;
>> >     my_uri_test_impl(instance);
>> > }
>> >
>> > BOOST_AUTO_TEST_CASE(my_uri_test_wstring) {
>> >     boost::network::basic_uri<tags::wstring> instance;
>> >     my_uri_test_impl(instance);
>> > }
>> >
>> > or something like that, it won't be difficult.  But looking at that,
>> > we'll
>> > need better names for the tags.
>>
>> For the xUnit, OO-style, test frameworks there's a pattern called
>> Abstract Test Case, where all test methods reside in a base class,
>> together with one or more abstract methods denoting variance. Then you
>> create derived, concrete classes that implement the variations for the
>> specific types, and the runner sees them as separate suites.
>>
>> That's essentially what you're describing above, except you would have
>> to repeat every test case for every variation.
>>
>> I wonder if there's a way to use Boost.Test fixtures to implement
>> Abstract Test Case with a type variation...?
>>
>
> This seems to be the recommended usage pattern for testing generic
> components with different template patterns:
> http://www.boost.org/doc/libs/1_40_0/libs/test/doc/html/utf/usage-recommendations/generic.html#id663542
>

Great find Glyn! Yup, this looks like the way to do it. :-)

Also, there's a way to have fixtures too (like setUp and tearDown) --
I don't know if we use this yet in the project, but I remember using
this for one of my proprietary projects back then. :)

Do either of you mind doing this on my URI implementation branch?
Maybe merging John's tests and mine into a single "coherent" test
suite? :D

BTW, does anybody want to take on a URL-encoding template function
that uses Boost.Spirit 2.1's Karma library? It'd be good to have that
function implemented as a standalone function so that we can write
user code like this:

  http::uri instance = string("http://foo.bar.com/q?";) +
urlencode("yadda='The quick brown fox! Jumps over the lazy
dog?#)(*#)@");

HTH :)

-- 
Dean Michael Berris
blog.cplusplus-soup.com | twitter.com/mikhailberis
linkedin.com/in/mikhailberis | facebook.com/dean.berris | deanberris.com

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Cpp-netlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel

Reply via email to