Merge pull request #39 from boostorg/develop

Merge develop to master
This commit is contained in:
jzmaddock
2017-10-09 18:27:25 +01:00
committed by GitHub
86 changed files with 1712 additions and 1028 deletions

View File

@ -20,11 +20,11 @@
#define UNICODE
#define _UNICODE
#include <boost/regex.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#include <boost/regex.h>
#ifndef BOOST_NO_WREGEX
#include <wchar.h>

View File

@ -16,10 +16,10 @@
* DESCRIPTION: Test for indefinite recursion and/or stack overrun.
*/
#include <string>
#include <boost/regex.hpp>
#include <boost/detail/lightweight_main.hpp>
#include "../test_macros.hpp"
#include <string>
#ifdef BOOST_INTEL
#pragma warning(disable:1418 981 983 383)

View File

@ -16,10 +16,10 @@
* DESCRIPTION: Test for indefinite recursion and/or stack overrun.
*/
#include <string>
#include <boost/regex.hpp>
#include <boost/detail/lightweight_main.hpp>
#include "../test_macros.hpp"
#include <string>
#ifdef BOOST_INTEL
#pragma warning(disable:1418 981 983 383)

View File

@ -155,12 +155,19 @@ void test_assertion_escapes()
TEST_REGEX_SEARCH("\\R", perl, "foo\nbar", match_default, make_array(3, 4, -2, -2));
TEST_REGEX_SEARCH("\\R", perl, "foo\rbar", match_default, make_array(3, 4, -2, -2));
TEST_REGEX_SEARCH("\\R", perl, "foo\r\nbar", match_default, make_array(3, 5, -2, -2));
TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\r\nbar", match_default, make_array(0, 5, -2, -2));
TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\012bar", match_default, make_array(0, 4, -2, -2));
TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\013bar", match_default, make_array(0, 4, -2, -2));
TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\013bar", match_default, make_array(0, 4, -2, -2));
TEST_REGEX_SEARCH("(?x) abc \\R", perl, "abc\205bar", match_default, make_array(0, 4, -2, -2));
// see if \u works:
const wchar_t* w = L"\u2028";
if(*w == 0x2028u)
{
TEST_REGEX_SEARCH_W(L"\\R", perl, L"foo\u2028bar", match_default, make_array(3, 4, -2, -2));
TEST_REGEX_SEARCH_W(L"\\R", perl, L"foo\u2029bar", match_default, make_array(3, 4, -2, -2));
TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl, L"abc\u2028bar", match_default, make_array(0, 4, -2, -2));
TEST_REGEX_SEARCH_W(L"(?x) abc \\R", perl, L"abc\u2029bar", match_default, make_array(0, 4, -2, -2));
}
}

View File

@ -96,6 +96,40 @@ void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<2> const*)
BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
}
}
//
// We don't have a way to access a list of named sub-expressions since we only store
// hashes, but "abc" and "N" are common names used in our tests, so check those:
//
if (w1["abc"].matched)
{
if (w2["abc"].matched == 0)
{
BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
}
if ((w1.position("abc") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2.prefix().first), iterator_type(w2["abc"].first))) || (w1.length("abc") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2["abc"].first), iterator_type(w2["abc"].second))))
{
BOOST_REGEX_TEST_ERROR("Iterator mismatch in match_results class", UChar32);
}
}
else if (w2["abc"].matched)
{
BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
}
if (w1["N"].matched)
{
if (w2["N"].matched == 0)
{
BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
}
if ((w1.position("N") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2.prefix().first), iterator_type(w2["N"].first))) || (w1.length("N") != boost::BOOST_REGEX_DETAIL_NS::distance(iterator_type(w2["N"].first), iterator_type(w2["N"].second))))
{
BOOST_REGEX_TEST_ERROR("Iterator mismatch in match_results class", UChar32);
}
}
else if (w2["N"].matched)
{
BOOST_REGEX_TEST_ERROR("Matched mismatch in match_results class", UChar32);
}
}
template <class MR1, class MR2>
void compare_result(const MR1& w1, const MR2& w2, boost::mpl::int_<1> const*)

View File

@ -486,5 +486,15 @@ void test_pocessive_repeats()
TEST_INVALID_REGEX("\\d*++", perl);
TEST_INVALID_REGEX("\\d?++", perl);
TEST_INVALID_REGEX("\\d{1,2}++", perl);
TEST_REGEX_SEARCH("(ab +)", perl|mod_x, "abbb", match_default, make_array(0, 4, 0, 4, -2, -2));
TEST_REGEX_SEARCH("(ab +?)", perl | mod_x, "abbb", match_default, make_array(0, 2, 0, 2, -2, -2));
TEST_REGEX_SEARCH("(ab + ?)", perl | mod_x, "abbb", match_default, make_array(0, 2, 0, 2, -2, -2));
TEST_REGEX_SEARCH("(ab ++)", perl | mod_x, "abbb", match_default, make_array(0, 4, 0, 4, -2, -2));
TEST_REGEX_SEARCH("(ab + +)", perl | mod_x, "abbb", match_default, make_array(0, 4, 0, 4, -2, -2));
TEST_INVALID_REGEX("(ab + ++)", perl | mod_x);
TEST_INVALID_REGEX("(ab + + +)", perl | mod_x);
TEST_INVALID_REGEX("(ab + + ?)", perl | mod_x);
}

View File

@ -16,11 +16,11 @@
* DESCRIPTION: test program for boost::static_mutex.
*/
#include <iostream>
#include <iomanip>
#include <boost/regex/pending/static_mutex.hpp>
#include <boost/thread/thread.hpp>
#include <boost/timer.hpp>
#include <iostream>
#include <iomanip>
//
// we cannot use the regular Boost.Test in here: it is not thread safe