| 1 | /* |
|---|
| 2 | * |
|---|
| 3 | * Copyright (c) 2004 |
|---|
| 4 | * John Maddock |
|---|
| 5 | * |
|---|
| 6 | * Use, modification and distribution are subject to the |
|---|
| 7 | * Boost Software License, Version 1.0. (See accompanying file |
|---|
| 8 | * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
|---|
| 9 | * |
|---|
| 10 | */ |
|---|
| 11 | |
|---|
| 12 | #include "test.hpp" |
|---|
| 13 | |
|---|
| 14 | #define BOOST_REGEX_TEST(x)\ |
|---|
| 15 | if(!(x)){ BOOST_REGEX_TEST_ERROR("Error in: " BOOST_STRINGIZE(x), char); } |
|---|
| 16 | |
|---|
| 17 | void test_overloads() |
|---|
| 18 | { |
|---|
| 19 | test_info<char>::set_typename("sub_match operators"); |
|---|
| 20 | |
|---|
| 21 | // test all the available overloads with *one* simple |
|---|
| 22 | // expression, doing all these tests with all the test |
|---|
| 23 | // cases would just take to long... |
|---|
| 24 | |
|---|
| 25 | boost::regex e("abc"); |
|---|
| 26 | std::string s("abc"); |
|---|
| 27 | const std::string& cs = s; |
|---|
| 28 | boost::smatch sm; |
|---|
| 29 | boost::cmatch cm; |
|---|
| 30 | // regex_match: |
|---|
| 31 | BOOST_REGEX_TEST(boost::regex_match(cs.begin(), cs.end(), sm, e)) |
|---|
| 32 | BOOST_REGEX_TEST(boost::regex_match(cs.begin(), cs.end(), sm, e, boost::regex_constants::match_default)) |
|---|
| 33 | BOOST_REGEX_TEST(boost::regex_match(cs.begin(), cs.end(), e)) |
|---|
| 34 | BOOST_REGEX_TEST(boost::regex_match(cs.begin(), cs.end(), e, boost::regex_constants::match_default)) |
|---|
| 35 | BOOST_REGEX_TEST(boost::regex_match(s.c_str(), cm, e)) |
|---|
| 36 | BOOST_REGEX_TEST(boost::regex_match(s.c_str(), cm, e, boost::regex_constants::match_default)) |
|---|
| 37 | BOOST_REGEX_TEST(boost::regex_match(s.c_str(), e)) |
|---|
| 38 | BOOST_REGEX_TEST(boost::regex_match(s.c_str(), e, boost::regex_constants::match_default)) |
|---|
| 39 | BOOST_REGEX_TEST(boost::regex_match(s, sm, e)) |
|---|
| 40 | BOOST_REGEX_TEST(boost::regex_match(s, sm, e, boost::regex_constants::match_default)) |
|---|
| 41 | BOOST_REGEX_TEST(boost::regex_match(s, e)) |
|---|
| 42 | BOOST_REGEX_TEST(boost::regex_match(s, e, boost::regex_constants::match_default)) |
|---|
| 43 | // regex_search: |
|---|
| 44 | BOOST_REGEX_TEST(boost::regex_search(cs.begin(), cs.end(), sm, e)) |
|---|
| 45 | BOOST_REGEX_TEST(boost::regex_search(cs.begin(), cs.end(), sm, e, boost::regex_constants::match_default)) |
|---|
| 46 | BOOST_REGEX_TEST(boost::regex_search(cs.begin(), cs.end(), e)) |
|---|
| 47 | BOOST_REGEX_TEST(boost::regex_search(cs.begin(), cs.end(), e, boost::regex_constants::match_default)) |
|---|
| 48 | BOOST_REGEX_TEST(boost::regex_search(s.c_str(), cm, e)) |
|---|
| 49 | BOOST_REGEX_TEST(boost::regex_search(s.c_str(), cm, e, boost::regex_constants::match_default)) |
|---|
| 50 | BOOST_REGEX_TEST(boost::regex_search(s.c_str(), e)) |
|---|
| 51 | BOOST_REGEX_TEST(boost::regex_search(s.c_str(), e, boost::regex_constants::match_default)) |
|---|
| 52 | BOOST_REGEX_TEST(boost::regex_search(s, sm, e)) |
|---|
| 53 | BOOST_REGEX_TEST(boost::regex_search(s, sm, e, boost::regex_constants::match_default)) |
|---|
| 54 | BOOST_REGEX_TEST(boost::regex_search(s, e)) |
|---|
| 55 | BOOST_REGEX_TEST(boost::regex_search(s, e, boost::regex_constants::match_default)) |
|---|
| 56 | } |
|---|