mirror of
https://github.com/boostorg/regex.git
synced 2025-07-01 23:00:59 +02:00
196 lines
7.4 KiB
C++
196 lines
7.4 KiB
C++
/*
|
|
*
|
|
* Copyright (c) 1998-2000
|
|
* Dr John Maddock
|
|
*
|
|
* Permission to use, copy, modify, distribute and sell this software
|
|
* and its documentation for any purpose is hereby granted without fee,
|
|
* provided that the above copyright notice appear in all copies and
|
|
* that both that copyright notice and this permission notice appear
|
|
* in supporting documentation. Dr John Maddock makes no representations
|
|
* about the suitability of this software for any purpose.
|
|
* It is provided "as is" without express or implied warranty.
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* LOCATION: see http://www.boost.org for most recent version.
|
|
* FILE regex_test.cpp
|
|
* VERSION 3.03
|
|
* DESCRIPTION: Builds regression test program with default
|
|
* locale and wide character tests. Also
|
|
* instantiates all the templates in the library
|
|
* as a sanity check.
|
|
*/
|
|
|
|
// disable automatic selection of support library:
|
|
#define BOOST_RE_NO_LIB
|
|
#define TEST_UNICODE
|
|
|
|
#include <boost/regex.hpp>
|
|
|
|
//
|
|
// instantiate templates used:
|
|
//
|
|
namespace boost{
|
|
|
|
typedef const wchar_t* ra_it;
|
|
typedef wchar_t char_type;
|
|
typedef std::basic_string<char_type> test_string_type;
|
|
|
|
bool pred1(const match_results<ra_it>&)
|
|
{ return true; }
|
|
|
|
typedef bool (*pred1_type)(const match_results<ra_it>&);
|
|
typedef bool (*pred2_type)(const match_results<test_string_type::const_iterator>&);
|
|
|
|
//check that all the defined flags are available:
|
|
regbase::flag_type f = regbase::escape_in_lists | regbase::char_classes | regbase::intervals | regbase::limited_ops
|
|
| regbase::newline_alt | regbase::bk_plus_qm | regbase::bk_braces
|
|
| regbase::bk_parens | regbase::bk_refs | regbase::bk_vbar | regbase::use_except
|
|
| regbase::failbit | regbase::literal | regbase::icase | regbase::nocollate | regbase::basic
|
|
| regbase::extended | regbase::normal | regbase::emacs | regbase::awk | regbase::grep | regbase::egrep | regbase::sed;
|
|
|
|
template class reg_expression<char_type>;
|
|
template struct sub_match<ra_it>;
|
|
template class match_results<ra_it>;
|
|
|
|
template bool regex_match(ra_it,
|
|
ra_it,
|
|
match_results<ra_it>& m,
|
|
const reg_expression<char_type>& e,
|
|
unsigned flags);
|
|
template bool regex_match(ra_it,
|
|
ra_it,
|
|
const reg_expression<char_type>& e,
|
|
unsigned flags);
|
|
template bool regex_search(ra_it,
|
|
ra_it,
|
|
match_results<ra_it>& m,
|
|
const reg_expression<char_type>& e,
|
|
unsigned flags);
|
|
template unsigned int regex_grep(pred1_type,
|
|
ra_it,
|
|
ra_it,
|
|
const reg_expression<char_type>& e,
|
|
unsigned flags);
|
|
template char_type* regex_format(char_type*,
|
|
const match_results<ra_it>& m,
|
|
const char_type* fmt,
|
|
unsigned flags);
|
|
template char_type* regex_format(char_type*,
|
|
const match_results<ra_it>& m,
|
|
const test_string_type& fmt,
|
|
unsigned flags);
|
|
template char_type* regex_merge(char_type*,
|
|
ra_it,
|
|
ra_it,
|
|
const reg_expression<char_type>&,
|
|
const char_type*,
|
|
unsigned int flags);
|
|
template char_type* regex_merge(char_type*,
|
|
ra_it,
|
|
ra_it,
|
|
const reg_expression<char_type>& e,
|
|
const test_string_type&,
|
|
unsigned int flags);
|
|
template std::size_t regex_split(test_string_type*,
|
|
test_string_type&,
|
|
const reg_expression<char_type>&,
|
|
unsigned flags,
|
|
std::size_t);
|
|
template std::size_t regex_split(test_string_type*,
|
|
test_string_type& s,
|
|
const reg_expression<char_type>& e,
|
|
unsigned flags);
|
|
|
|
template std::size_t regex_split(test_string_type*, test_string_type&);
|
|
|
|
#ifndef BOOST_RE_NO_PARTIAL_FUNC_SPEC
|
|
//
|
|
// the following prototypes are only available if partial ordering
|
|
// of template functions is supported:
|
|
//
|
|
template bool regex_match(const char_type*,
|
|
match_results<const char_type*>& m,
|
|
const reg_expression<char_type>& e,
|
|
unsigned flags);
|
|
template bool regex_match(const test_string_type&,
|
|
match_results<test_string_type::const_iterator>&,
|
|
const reg_expression<char_type>&,
|
|
unsigned flags);
|
|
template bool regex_match(const char_type*,
|
|
const reg_expression<char_type>&,
|
|
unsigned flags);
|
|
template bool regex_match(const test_string_type&,
|
|
const reg_expression<char_type>&,
|
|
unsigned flags);
|
|
template bool regex_search(const char_type*,
|
|
match_results<const char_type*>&,
|
|
const reg_expression<char_type>&,
|
|
unsigned flags);
|
|
template bool regex_search(const test_string_type&,
|
|
match_results<test_string_type::const_iterator>&,
|
|
const reg_expression<char_type>&,
|
|
unsigned flags);
|
|
template unsigned int regex_grep(pred1_type,
|
|
const char_type*,
|
|
const reg_expression<char_type>&,
|
|
unsigned flags);
|
|
template unsigned int regex_grep(pred2_type,
|
|
const test_string_type&,
|
|
const reg_expression<char_type>&,
|
|
unsigned flags);
|
|
template test_string_type regex_format
|
|
(const match_results<test_string_type::const_iterator>& m,
|
|
const char_type*,
|
|
unsigned flags);
|
|
template test_string_type regex_format
|
|
(const match_results<test_string_type::const_iterator>&,
|
|
const test_string_type&,
|
|
unsigned flags);
|
|
template test_string_type regex_merge(const test_string_type&,
|
|
const reg_expression<char_type>&,
|
|
const char_type*,
|
|
unsigned int flags);
|
|
template test_string_type regex_merge(const test_string_type&,
|
|
const reg_expression<char_type>&,
|
|
const test_string_type&,
|
|
unsigned int flags);
|
|
|
|
#endif
|
|
|
|
|
|
} // namespace boost
|
|
|
|
//
|
|
// include regression test source files:
|
|
//
|
|
#ifdef BOOST_RE_LOCALE_W32
|
|
#define BOOST_RE_TEST_LOCALE_W32
|
|
#elif !defined(BOOST_RE_LOCALE_C)
|
|
#define BOOST_RE_TEST_LOCALE_CPP
|
|
#endif
|
|
#include "tests.cpp"
|
|
#include "parse.cpp"
|
|
#include "regress.cpp"
|
|
|
|
//
|
|
// include library source files:
|
|
//
|
|
#ifdef BOOST_RE_LOCALE_W32
|
|
#include "libs/regex/src/w32_regex_traits.cpp"
|
|
#elif defined(BOOST_RE_LOCALE_C)
|
|
#include "libs/regex/src/c_regex_traits.cpp"
|
|
#else
|
|
#include "libs/regex/src/cpp_regex_traits.cpp"
|
|
#endif
|
|
#include "libs/regex/src/c_regex_traits_common.cpp"
|
|
#include "libs/regex/src/cregex.cpp"
|
|
#include "libs/regex/src/fileiter.cpp"
|
|
#include "libs/regex/src/regex.cpp"
|
|
#include "libs/regex/src/regex_debug.cpp"
|
|
#include "libs/regex/src/regex_synch.cpp"
|
|
#include "libs/regex/src/wide_posix_api.cpp"
|
|
|