Using Unit Tests w/Codewarrior Pro 8.3
Folks, I'd like to be able to run a boost unit test, e.g. is_convertible_test.cpp, as kind of a one-shot apart from having to deal with the rest of boost. So I read the documentation on the unit test framework, and it seems like this should be relatively straightforward. I've created a Carbon Console project in Codewarrior, which contains the following files: is_convertible_test.cpp init.cpp (from type_traits/test) unit_test_main.cpp unit_test_suite.cpp unit_test_result.cpp unit_test_log.cpp unit_test_monitor.cpp execution_monitor.cpp unit_test_parameters.cpp test_tools.cpp This all compiles and links file, which is a relief in and of itself. :-) However, when I simply run the app, I get "*** No errors detected". If I remove is_convertible_test.cpp and rebuild and run again, I get the same result. :-) So my suspicion is that I need to do more to let the framework know that it needs to run is_convertible_test.cpp. Can someone please clue me in as to what that is, in minimal terms? Thanks!
Somewhere in the E.U., le 05/03/2003
Bonjour
I suspect that what you need is to allow the messages to appear
in the console, which can be brought about by typing the following
before the creation of the test_unit (that's the way I mage it work for
me, at least):
::boost::unit_test_framework::unit_test_log::instance().set_log_threshold
_level_by_name("messages");
Bon courage
Hubert Holin
In article
Folks,
I'd like to be able to run a boost unit test, e.g. is_convertible_test.cpp, as kind of a one-shot apart from having to deal with the rest of boost. So I read the documentation on the unit test framework, and it seems like this should be relatively straightforward. I've created a Carbon Console project in Codewarrior, which contains the following files:
is_convertible_test.cpp init.cpp (from type_traits/test) unit_test_main.cpp unit_test_suite.cpp unit_test_result.cpp unit_test_log.cpp unit_test_monitor.cpp execution_monitor.cpp unit_test_parameters.cpp test_tools.cpp
This all compiles and links file, which is a relief in and of itself. :-)
However, when I simply run the app, I get "*** No errors detected". If I remove is_convertible_test.cpp and rebuild and run again, I get the same result. :-) So my suspicion is that I need to do more to let the framework know that it needs to run is_convertible_test.cpp. Can someone please clue me in as to what that is, in minimal terms?
Thanks!
Info: http://www.boost.org Wiki: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl Unsubscribe: mailto:boost-users-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
In article
Somewhere in the E.U., le 05/03/2003
Bonjour
I suspect that what you need is to allow the messages to appear in the console, which can be brought about by typing the following before the creation of the test_unit (that's the way I mage it work for me, at least):
::boost::unit_test_framework::unit_test_log::instance().set_log_threshold _level_by_name("messages");
You and John were both quite right. I posted a reply saying that I got an empty test case and 0 assertions succeeded/failed, and pointed out that it wasn't clear to me that the constructor that adds the test case to the master unit was being called. I needed to follow that line of reasoning to its logical conclusion! It turns out that, in my Codewarrior project, I simply needed to have the linker not dead-strip static initializers. That did the trick. Thanks for your help!
Bon courage
Hubert Holin
Best regards, Paul
I'd like to be able to run a boost unit test, e.g. is_convertible_test.cpp, as kind of a one-shot apart from having to deal with the rest of boost. So I read the documentation on the unit test framework, and it seems like this should be relatively straightforward. I've created a Carbon Console project in Codewarrior, which contains the following files:
is_convertible_test.cpp init.cpp (from type_traits/test) unit_test_main.cpp unit_test_suite.cpp unit_test_result.cpp unit_test_log.cpp unit_test_monitor.cpp execution_monitor.cpp unit_test_parameters.cpp test_tools.cpp
This all compiles and links file, which is a relief in and of itself. :-)
However, when I simply run the app, I get "*** No errors detected". If I remove is_convertible_test.cpp and rebuild and run again, I get the same result. :-) So my suspicion is that I need to do more to let the framework know that it needs to run is_convertible_test.cpp. Can someone please clue me in as to what that is, in minimal terms?
No you've got it right - it's just that the unit test lib doesn't report much by default - if you look at the jamfile you will see that it uses the following command line args: --report_level=detailed --build_info=yes --log_level=messages you can do all this with bjam BTW, with: bjam is_convertible_test.test Hope this helps, John.
In article <014801c2e308$cabfb4c0$6cbb193e@fsnet.co.uk>,
"John Maddock"
No you've got it right - it's just that the unit test lib doesn't report much by default - if you look at the jamfile you will see that it uses the following command line args:
--report_level=detailed --build_info=yes --log_level=messages
you can do all this with bjam BTW, with:
bjam is_convertible_test.test
Hope this helps,
It certainly does, thanks! So I nastily hard-coded those values into my copy of unit_test_main.cpp, and now I get: Test case "" passed with: 0 assertions out of 0 passed 0 assertions out of 0 failed This is consistent with what I see when I step through the program with the debugger: there's a loop through the test case, and the body of that loop is never executed. From looking at the pre-processed source code of the test case, it would appear that the framework relies on a constructor of a class for side-effects, specifically to add the test case to the unit. My guess is that this constructor is never getting called for some reason. Any further insights are most welcome. Thanks again!
John.
Best regards, Paul
participants (4)
-
Hubert Holin
-
John Maddock
-
Paul Snively
-
paul_snively <paul_snively@yahoo.com>