File: test_non_char.cpp

package info (click to toggle)
boost 1.34.1-14
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 116,412 kB
  • ctags: 259,566
  • sloc: cpp: 642,395; xml: 56,450; python: 17,612; ansic: 14,520; sh: 2,265; yacc: 858; perl: 481; makefile: 478; lex: 94; sql: 74; csh: 6
file content (33 lines) | stat: -rw-r--r-- 1,046 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
///////////////////////////////////////////////////////////////////////////////
// test_non_char.cpp
//
//  Copyright 2004 Eric Niebler. Distributed under the Boost
//  Software License, Version 1.0. (See accompanying file
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#include <algorithm>
#include <boost/xpressive/traits/null_regex_traits.hpp>
#include "./test.hpp"

///////////////////////////////////////////////////////////////////////////////
// test_main
//   read the tests from the input file and execute them
int test_main( int, char*[] )
{
    static int const data[] = {0, 1, 2, 3, 4, 5, 6};
    null_regex_traits<int> nul;
    basic_regex<int const *> rex = imbue(nul)(1 >> +((set= 2,3) | 4) >> 5);
    match_results<int const *> what;

    if(!regex_search(data, data + (sizeof(data)/sizeof(*data)), what, rex))
    {
        BOOST_ERROR("regex_search on integral data failed");
    }
    else
    {
        BOOST_CHECK(*what[0].first == 1);
        BOOST_CHECK(*what[0].second == 6);
    }

    return 0;
}