• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //  (C) Copyright Gennadiy Rozental 2005.
2 //  Distributed under the Boost Software License, Version 1.0.
3 //  (See accompanying file LICENSE_1_0.txt or copy at
4 //  http://www.boost.org/LICENSE_1_0.txt)
5 
6 //  See http://www.boost.org/libs/test for the library home page.
7 
8 // Boost.Test
9 
10 // each test module could contain no more then one 'main' file with init function defined
11 // alternatively you could define init function yourself
12 #define BOOST_TEST_MAIN
13 #include <boost/test/unit_test.hpp>
14 namespace bt = boost::unit_test;
15 
16 //____________________________________________________________________________//
17 
18 // most frequently you implement test cases as a free functions with automatic registration
BOOST_AUTO_TEST_CASE(test1)19 BOOST_AUTO_TEST_CASE( test1 )
20 {
21     // reports 'error in "test1": test 2 == 1 failed'
22     BOOST_TEST( 2 == 1 );
23 }
24 
25 //____________________________________________________________________________//
26 
27 // each test file may contain any number of test cases; each test case has to have unique name
BOOST_AUTO_TEST_CASE(test2)28 BOOST_AUTO_TEST_CASE( test2 )
29 {
30     int i = 0;
31 
32     // reports 'error in "test2": check i == 2 failed [0 != 2]'
33     BOOST_TEST( i == 2 );
34 
35     BOOST_TEST( i == 0 );
36 }
37 
38 //____________________________________________________________________________//
39 
40 // EOF
41