Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/test/example/unit_test_example4.cpp @ 20

Last change on this file since 20 was 12, checked in by landauf, 18 years ago

added boost

File size: 1.0 KB
Line 
1//  (C) Copyright Gennadiy Rozental 2002-2005.
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)
6
7//  See http://www.boost.org/libs/test for the library home page.
8
9// Boost.Test
10#include <boost/test/unit_test.hpp>
11#include <boost/test/parameterized_test.hpp>
12using boost::unit_test::test_suite;
13
14// STL
15#include <vector>
16#include <string>
17
18void check_string( std::string const& s )
19{
20    // reports 'error in "check_string": test s.substr( 0, 3 ) == "hdr" failed [actual_value != hdr]'
21    BOOST_CHECK_EQUAL( s.substr( 0, 3 ), "hdr" );
22}
23
24test_suite*
25init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) {
26    test_suite* test= BOOST_TEST_SUITE( "Unit test example 4" );
27
28    std::string const params[] = { "hdr1 ", "hdr2", "3  " };
29
30    test->add( BOOST_PARAM_TEST_CASE( &check_string, (std::string const*)params, params+3 ) );
31
32    return test; 
33}
34
35// EOF
Note: See TracBrowser for help on using the repository browser.