Error messages from Boost.test

I have been trying to improve error messages from wrapping functions using John Maddock's math functions. His error handling allows excellent messages from the function chisqr, including the 'offending' argument value(s), but I am unclear at part of the messages from Boost.test. The whole test output is: Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\test_chisqr.exe" Running 1 test case... unknown location(0): fatal error in "test_main_caller( argc, argv )": std::domain_error: Error in function float __cdecl boost::math::chisqr<float,float>(float,float): chisqr argument is -2, but must be > 0! ..\..\..\..\..\..\boost-sandbox\libs\math_functions\test\test_chisqr.cpp(119 ): last checkpoint *** 1 failure detected in test suite "Test Program" Project : error PRJ0019: A tool returned an error code from "Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\test_chisqr.exe"" Autorun "i:\boost-06-05-03-1300\libs\math\test\Math_test\debug\test_chisqr.exe" comes from the IDE (post-build event description field). Running 1 test case... is the start from test. std::domain_error: Error in function float __cdecl boost::math::chisqr<float,float>(float,float): chisqr argument is -2, but must be > 0! is the error message output from chisqr function, (BTW any comments on the formatting of this message: "chisqr argument is -2, but must be > 0!") But why does the test suite then output: unknown location(0) unknown location(0): fatal error in "test_main_caller( argc, argv )": This also shows in the example \boost\libs\test\example\unit_test_example_02.cpp output is // reports 'unknown location(0): fatal error in "free_test_function": memory access violation // d:\source code\boost\libs\test\example\unit_test_example_02.cpp(25): last checkpoint' Could/should it show file and line here? Am I using this wrongly? Or is this just a feature? ..\..\..\..\..\..\boost-sandbox\libs\math_functions\test\test_chisqr.cpp(119 ): last checkpoint Does show the (deliberately) offending file and line, which is good. Comments/suggestions? Paul --- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow@hetp.u-net.com

"Paul A Bristow" <pbristow@hetp.u-net.com> wrote in message news:E1FtqT5-0005lW-> But why does the test suite then output:
unknown location(0)
unknown location(0): fatal error in "test_main_caller( argc, argv )":
[...]
Could/should it show file and line here? Am I using this wrongly? Or is this just a feature?
Essencially the reason is that Boost.Test does indeed do not know where the error occured. Let's say we have .... 123: BOOST_CHECK( foo() ); If there is a fatal error within function foo invokation Boost.Test doesn't know where it actually occured. I couldn't state that it occured at line 123, since the assertion is not validated yet. What I could show is that we enterred the expression at line 123 and then something happend (vs. an error occured with assertion at line 123)
..\..\..\..\..\..\boost-sandbox\libs\math_functions\test\test_chisqr.cpp(119
): last checkpoint
Does show the (deliberately) offending file and line, which is good.
Is it good enough? Gennadiy

| -----Original Message----- | From: boost-bounces@lists.boost.org | [mailto:boost-bounces@lists.boost.org] On Behalf Of Gennadiy Rozental | Sent: 24 June 2006 06:28 | To: boost@lists.boost.org | Subject: Re: [boost] Error messages from Boost.test | | | "Paul A Bristow" <pbristow@hetp.u-net.com> wrote in message | news:E1FtqT5-0005lW-> But why does the test suite then output: | > | > unknown location(0) | > | > unknown location(0): fatal error in "test_main_caller( | argc, argv )": | | [...] | | > Could/should it show file and line here? Am I using this | wrongly? Or is | > this just a feature? | | Essencially the reason is that Boost.Test does indeed do not | know where the | error occured. | | Let's say we have | | .... | 123: BOOST_CHECK( foo() ); | | If there is a fatal error within function foo invokation | Boost.Test doesn't | know where it actually occured. I couldn't state that it | occured at line | 123, since the assertion is not validated yet. What I could | show is that we | enterred the expression at line 123 and then something | happend (vs. an error | occured with assertion at line 123) | | | > | ..\..\..\..\..\..\boost-sandbox\libs\math_functions\test\test | _chisqr.cpp(119 | > ): last checkpoint | > | > Does show the (deliberately) offending file and line, | which is good. | | Is it good enough? It is certainly good enough, but the existing 1st message has confused me - not difficult ;-) It suggested to me that I was missing something. Could the first message easily and usefully say "After line 123" perhaps? Paul --- Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539561830 & SMS, Mobile +44 7714 330204 & SMS pbristow@hetp.u-net.com
participants (2)
-
Gennadiy Rozental
-
Paul A Bristow