Boost logo

Boost Users :

Subject: [Boost-users] include suite name in error report [Was: naming a test]
From: Eric Prud'hommeaux (eric_at_[hidden])
Date: 2014-05-29 05:40:37


* Richard <legalize+jeeves_at_[hidden]> [2014-05-28 20:47+0000]
> Eric Prud'hommeaux <eric_at_[hidden]> spake the secret code
> <20140528082105.GB29665_at_[hidden]> thusly:
>
> >* Richard <legalize+jeeves_at_[hidden]> [2014-05-27 23:20+0000]
> >> Did you really mean to pass in 1 as the number of characters?
> >
> >Yes, but just because my original attached example had trivial names
> >constructed by crossing the chars in argv[1] and argv[2], e.g.
> > abc 12 -> a1 b1 c1 a2 b2 c2.

oops, should have written that as a/1 b/1 c/1 a/2 b/2 c/2, which gives the highly informative names "1" and "2" as test case names.

This brings up a feature request (or maybe I just didn't find it) which would be that the error reports look like:
  filename(num): error in test "a/1"
Currently, it only includes the test name ("1" in this case) but I think the suite hierarcy would be very helpful for folks who see an error and need to frob up a --run_test=a/1 to run it again in a debugger.

> In this case the number of characters in the test names are 2 :-)
>
> >That makes sense. I wonder why the macros invoke make_test_cast, which
> >then invokes the constructor:
> >
> >from boost/test/unit_test_suite_impl.hpp:252:
> > inline test_case*
> > make_test_case( callback0<> const& test_func, const_string tc_name )
> > {
> > return new test_case( ut_detail::normalize_test_case_name( tc_name
> >), test_func );
> > }
> >, maybe some mechanical constraints on invoking constructors from
> >macros?
>
> No, it is just so that they can call normalize_test_case_name which
> strips the leading '&' from any name, so if you did
> BOOST_TEST_CASE(&fn), the test case name would be 'fn', not '&fn'.
> --
> "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
> The Computer Graphics Museum <http://computergraphicsmuseum.org>
> The Terminals Wiki <http://terminals.classiccmp.org>
> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

-- 
-ericP
office: +1.617.599.3509
mobile: +33.6.80.80.35.59
(eric_at_[hidden])
Feel free to forward this message to any list for any purpose other than
email address distribution.
There are subtle nuances encoded in font variation and clever layout
which can only be seen by printing this message on high-clay paper.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net