The
Gtest color information display looks more eye-catching, boost. Test's memory leak check is useful. I wish two functions in a library, can save a lot of things. But if you want to use these two features together before the authors do so, the following methods can be tried.
1: #include <iostream>
2:
3: #include <gtest/gtest.h>
4: #pragma comment (lib, "Gtes Td_d.lib ")
5:
6: #include <boost/test/unit_test.hpp>
7:
8:test (footest, test)
9: {
10:char *t = new Char[2];
11:expect_eq (3, 3);
12:expect_eq (2, 3);
13:}
:
15:using boost::unit_test::test_case
16:void testf ()
: {
18:char *t = new char[2];
19: Boost_check (3 = 3);
20:boost_check (2 = 3);
21:}
:
23:using boost::unit_test::test_suite
24:test_suite* init_unit_test_suite (int argc, char* argv[])
{
26:std::cout << "gtest...\n";
:: Testing::initgoogletest (&ARGC, argv);
::: Testing::u Nittest::getinstance ()->run ();
:
30:std::cout << "\ n \ boost.test...\n";
31:test_suite* ts = boost_test_suite ("");
32:ts->add (Boost_test_case (&TESTF));
33:return ts;
:}
(Use test case only with Gtest, both of which are written only for a comparison)
Gtest 1.3.0
http://code.google.com/p/googletest/
Booost 1.8.0
http://www.boost.org/
Output