]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/test/example/unit_test_example_02.cpp
1 // (C) Copyright Gennadiy Rozental 2002-2014.
2 // (C) Copyright Gennadiy Rozental & Ullrich Koethe 2001.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/test for the library home page.
10 #include <boost/test/unit_test.hpp>
11 using namespace boost::unit_test
;
13 //____________________________________________________________________________//
15 // you could easily implement test cases as a free functions
16 // this test case will need to be explecetely registered in test tree
17 void free_test_function()
19 // reports 'error in "free_test_function": test 2 == 1 failed'
20 BOOST_CHECK(2 == 1); // non-critical test => continue after failure
22 // reports 'unknown location(0): fatal error in "free_test_function": memory access violation
23 // d:\source code\boost\libs\test\example\unit_test_example_02.cpp(25): last checkpoint'
25 BOOST_CHECK( *p
== 0 );
28 //____________________________________________________________________________//
32 init_unit_test_suite( int, char* [] ) {
33 framework::master_test_suite().p_name
.value
= "Unit test example 02";
35 // register the test case in test tree and specify number of expected failures so
36 // this example will pass at runtime. We expect 2 errors: one from failed check and
37 // one from memory acces violation
38 framework::master_test_suite().add( BOOST_TEST_CASE( &free_test_function
), 2 );
43 //____________________________________________________________________________//