Fix failure found by David Chisnall
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140255 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
		@@ -22,7 +22,7 @@
 | 
			
		||||
 | 
			
		||||
template <class char_type>
 | 
			
		||||
void
 | 
			
		||||
test(const char_type* A, const char_type* expected)
 | 
			
		||||
test(const char_type* A, const std::basic_string<char_type>& expected)
 | 
			
		||||
{
 | 
			
		||||
    std::regex_traits<char_type> t;
 | 
			
		||||
    typedef forward_iterator<const char_type*> F;
 | 
			
		||||
@@ -31,155 +31,155 @@ test(const char_type* A, const char_type* expected)
 | 
			
		||||
 | 
			
		||||
int main()
 | 
			
		||||
{
 | 
			
		||||
    test("NUL", "\x00");
 | 
			
		||||
    test("alert", "\x07");
 | 
			
		||||
    test("backspace", "\x08");
 | 
			
		||||
    test("tab", "\x09");
 | 
			
		||||
    test("carriage-return", "\x0D");
 | 
			
		||||
    test("newline", "\x0A");
 | 
			
		||||
    test("vertical-tab", "\x0B");
 | 
			
		||||
    test("form-feed", "\x0C");
 | 
			
		||||
    test("space", " ");
 | 
			
		||||
    test("exclamation-mark", "!");
 | 
			
		||||
    test("quotation-mark", "\"");
 | 
			
		||||
    test("number-sign", "#");
 | 
			
		||||
    test("dollar-sign", "$");
 | 
			
		||||
    test("percent-sign", "%");
 | 
			
		||||
    test("ampersand", "&");
 | 
			
		||||
    test("apostrophe", "\'");
 | 
			
		||||
    test("left-parenthesis", "(");
 | 
			
		||||
    test("right-parenthesis", ")");
 | 
			
		||||
    test("asterisk", "*");
 | 
			
		||||
    test("plus-sign", "+");
 | 
			
		||||
    test("comma", ",");
 | 
			
		||||
    test("hyphen-minus", "-");
 | 
			
		||||
    test("hyphen", "-");
 | 
			
		||||
    test("full-stop", ".");
 | 
			
		||||
    test("period", ".");
 | 
			
		||||
    test("slash", "/");
 | 
			
		||||
    test("solidus", "/");
 | 
			
		||||
    test("zero", "0");
 | 
			
		||||
    test("one", "1");
 | 
			
		||||
    test("two", "2");
 | 
			
		||||
    test("three", "3");
 | 
			
		||||
    test("four", "4");
 | 
			
		||||
    test("five", "5");
 | 
			
		||||
    test("six", "6");
 | 
			
		||||
    test("seven", "7");
 | 
			
		||||
    test("eight", "8");
 | 
			
		||||
    test("nine", "9");
 | 
			
		||||
    test("colon", ":");
 | 
			
		||||
    test("semicolon", ";");
 | 
			
		||||
    test("less-than-sign", "<");
 | 
			
		||||
    test("equals-sign", "=");
 | 
			
		||||
    test("greater-than-sign", ">");
 | 
			
		||||
    test("question-mark", "?");
 | 
			
		||||
    test("commercial-at", "@");
 | 
			
		||||
    test("NUL", std::string("\x00", 1));
 | 
			
		||||
    test("alert", std::string("\x07"));
 | 
			
		||||
    test("backspace", std::string("\x08"));
 | 
			
		||||
    test("tab", std::string("\x09"));
 | 
			
		||||
    test("carriage-return", std::string("\x0D"));
 | 
			
		||||
    test("newline", std::string("\x0A"));
 | 
			
		||||
    test("vertical-tab", std::string("\x0B"));
 | 
			
		||||
    test("form-feed", std::string("\x0C"));
 | 
			
		||||
    test("space", std::string(" "));
 | 
			
		||||
    test("exclamation-mark", std::string("!"));
 | 
			
		||||
    test("quotation-mark", std::string("\""));
 | 
			
		||||
    test("number-sign", std::string("#"));
 | 
			
		||||
    test("dollar-sign", std::string("$"));
 | 
			
		||||
    test("percent-sign", std::string("%"));
 | 
			
		||||
    test("ampersand", std::string("&"));
 | 
			
		||||
    test("apostrophe", std::string("\'"));
 | 
			
		||||
    test("left-parenthesis", std::string("("));
 | 
			
		||||
    test("right-parenthesis", std::string(")"));
 | 
			
		||||
    test("asterisk", std::string("*"));
 | 
			
		||||
    test("plus-sign", std::string("+"));
 | 
			
		||||
    test("comma", std::string(","));
 | 
			
		||||
    test("hyphen-minus", std::string("-"));
 | 
			
		||||
    test("hyphen", std::string("-"));
 | 
			
		||||
    test("full-stop", std::string("."));
 | 
			
		||||
    test("period", std::string("."));
 | 
			
		||||
    test("slash", std::string("/"));
 | 
			
		||||
    test("solidus", std::string("/"));
 | 
			
		||||
    test("zero", std::string("0"));
 | 
			
		||||
    test("one", std::string("1"));
 | 
			
		||||
    test("two", std::string("2"));
 | 
			
		||||
    test("three", std::string("3"));
 | 
			
		||||
    test("four", std::string("4"));
 | 
			
		||||
    test("five", std::string("5"));
 | 
			
		||||
    test("six", std::string("6"));
 | 
			
		||||
    test("seven", std::string("7"));
 | 
			
		||||
    test("eight", std::string("8"));
 | 
			
		||||
    test("nine", std::string("9"));
 | 
			
		||||
    test("colon", std::string(":"));
 | 
			
		||||
    test("semicolon", std::string(";"));
 | 
			
		||||
    test("less-than-sign", std::string("<"));
 | 
			
		||||
    test("equals-sign", std::string("="));
 | 
			
		||||
    test("greater-than-sign", std::string(">"));
 | 
			
		||||
    test("question-mark", std::string("?"));
 | 
			
		||||
    test("commercial-at", std::string("@"));
 | 
			
		||||
    for (char c = 'A'; c <= 'Z'; ++c)
 | 
			
		||||
    {
 | 
			
		||||
        const char a[2] = {c};
 | 
			
		||||
        test(a, a);
 | 
			
		||||
        test(a, std::string(a));
 | 
			
		||||
    }
 | 
			
		||||
    test("left-square-bracket", "[");
 | 
			
		||||
    test("backslash", "\\");
 | 
			
		||||
    test("reverse-solidus", "\\");
 | 
			
		||||
    test("right-square-bracket", "]");
 | 
			
		||||
    test("circumflex-accent", "^");
 | 
			
		||||
    test("circumflex", "^");
 | 
			
		||||
    test("low-line", "_");
 | 
			
		||||
    test("underscore", "_");
 | 
			
		||||
    test("grave-accent", "`");
 | 
			
		||||
    test("left-square-bracket", std::string("["));
 | 
			
		||||
    test("backslash", std::string("\\"));
 | 
			
		||||
    test("reverse-solidus", std::string("\\"));
 | 
			
		||||
    test("right-square-bracket", std::string("]"));
 | 
			
		||||
    test("circumflex-accent", std::string("^"));
 | 
			
		||||
    test("circumflex", std::string("^"));
 | 
			
		||||
    test("low-line", std::string("_"));
 | 
			
		||||
    test("underscore", std::string("_"));
 | 
			
		||||
    test("grave-accent", std::string("`"));
 | 
			
		||||
    for (char c = 'a'; c <= 'z'; ++c)
 | 
			
		||||
    {
 | 
			
		||||
        const char a[2] = {c};
 | 
			
		||||
        test(a, a);
 | 
			
		||||
        test(a, std::string(a));
 | 
			
		||||
    }
 | 
			
		||||
    test("left-brace", "{");
 | 
			
		||||
    test("left-curly-bracket", "{");
 | 
			
		||||
    test("vertical-line", "|");
 | 
			
		||||
    test("right-brace", "}");
 | 
			
		||||
    test("right-curly-bracket", "}");
 | 
			
		||||
    test("tilde", "~");
 | 
			
		||||
    test("left-brace", std::string("{"));
 | 
			
		||||
    test("left-curly-bracket", std::string("{"));
 | 
			
		||||
    test("vertical-line", std::string("|"));
 | 
			
		||||
    test("right-brace", std::string("}"));
 | 
			
		||||
    test("right-curly-bracket", std::string("}"));
 | 
			
		||||
    test("tilde", std::string("~"));
 | 
			
		||||
 | 
			
		||||
    test("tild", "");
 | 
			
		||||
    test("ch", "");
 | 
			
		||||
    test("tild", std::string(""));
 | 
			
		||||
    test("ch", std::string(""));
 | 
			
		||||
    std::locale::global(std::locale("cs_CZ.ISO8859-2"));
 | 
			
		||||
    test("ch", "ch");
 | 
			
		||||
    test("ch", std::string("ch"));
 | 
			
		||||
    std::locale::global(std::locale("C"));
 | 
			
		||||
 | 
			
		||||
    test(L"NUL", L"\x00");
 | 
			
		||||
    test(L"alert", L"\x07");
 | 
			
		||||
    test(L"backspace", L"\x08");
 | 
			
		||||
    test(L"tab", L"\x09");
 | 
			
		||||
    test(L"carriage-return", L"\x0D");
 | 
			
		||||
    test(L"newline", L"\x0A");
 | 
			
		||||
    test(L"vertical-tab", L"\x0B");
 | 
			
		||||
    test(L"form-feed", L"\x0C");
 | 
			
		||||
    test(L"space", L" ");
 | 
			
		||||
    test(L"exclamation-mark", L"!");
 | 
			
		||||
    test(L"quotation-mark", L"\"");
 | 
			
		||||
    test(L"number-sign", L"#");
 | 
			
		||||
    test(L"dollar-sign", L"$");
 | 
			
		||||
    test(L"percent-sign", L"%");
 | 
			
		||||
    test(L"ampersand", L"&");
 | 
			
		||||
    test(L"apostrophe", L"\'");
 | 
			
		||||
    test(L"left-parenthesis", L"(");
 | 
			
		||||
    test(L"right-parenthesis", L")");
 | 
			
		||||
    test(L"asterisk", L"*");
 | 
			
		||||
    test(L"plus-sign", L"+");
 | 
			
		||||
    test(L"comma", L",");
 | 
			
		||||
    test(L"hyphen-minus", L"-");
 | 
			
		||||
    test(L"hyphen", L"-");
 | 
			
		||||
    test(L"full-stop", L".");
 | 
			
		||||
    test(L"period", L".");
 | 
			
		||||
    test(L"slash", L"/");
 | 
			
		||||
    test(L"solidus", L"/");
 | 
			
		||||
    test(L"zero", L"0");
 | 
			
		||||
    test(L"one", L"1");
 | 
			
		||||
    test(L"two", L"2");
 | 
			
		||||
    test(L"three", L"3");
 | 
			
		||||
    test(L"four", L"4");
 | 
			
		||||
    test(L"five", L"5");
 | 
			
		||||
    test(L"six", L"6");
 | 
			
		||||
    test(L"seven", L"7");
 | 
			
		||||
    test(L"eight", L"8");
 | 
			
		||||
    test(L"nine", L"9");
 | 
			
		||||
    test(L"colon", L":");
 | 
			
		||||
    test(L"semicolon", L";");
 | 
			
		||||
    test(L"less-than-sign", L"<");
 | 
			
		||||
    test(L"equals-sign", L"=");
 | 
			
		||||
    test(L"greater-than-sign", L">");
 | 
			
		||||
    test(L"question-mark", L"?");
 | 
			
		||||
    test(L"commercial-at", L"@");
 | 
			
		||||
    test(L"NUL", std::wstring(L"\x00", 1));
 | 
			
		||||
    test(L"alert", std::wstring(L"\x07"));
 | 
			
		||||
    test(L"backspace", std::wstring(L"\x08"));
 | 
			
		||||
    test(L"tab", std::wstring(L"\x09"));
 | 
			
		||||
    test(L"carriage-return", std::wstring(L"\x0D"));
 | 
			
		||||
    test(L"newline", std::wstring(L"\x0A"));
 | 
			
		||||
    test(L"vertical-tab", std::wstring(L"\x0B"));
 | 
			
		||||
    test(L"form-feed", std::wstring(L"\x0C"));
 | 
			
		||||
    test(L"space", std::wstring(L" "));
 | 
			
		||||
    test(L"exclamation-mark", std::wstring(L"!"));
 | 
			
		||||
    test(L"quotation-mark", std::wstring(L"\""));
 | 
			
		||||
    test(L"number-sign", std::wstring(L"#"));
 | 
			
		||||
    test(L"dollar-sign", std::wstring(L"$"));
 | 
			
		||||
    test(L"percent-sign", std::wstring(L"%"));
 | 
			
		||||
    test(L"ampersand", std::wstring(L"&"));
 | 
			
		||||
    test(L"apostrophe", std::wstring(L"\'"));
 | 
			
		||||
    test(L"left-parenthesis", std::wstring(L"("));
 | 
			
		||||
    test(L"right-parenthesis", std::wstring(L")"));
 | 
			
		||||
    test(L"asterisk", std::wstring(L"*"));
 | 
			
		||||
    test(L"plus-sign", std::wstring(L"+"));
 | 
			
		||||
    test(L"comma", std::wstring(L","));
 | 
			
		||||
    test(L"hyphen-minus", std::wstring(L"-"));
 | 
			
		||||
    test(L"hyphen", std::wstring(L"-"));
 | 
			
		||||
    test(L"full-stop", std::wstring(L"."));
 | 
			
		||||
    test(L"period", std::wstring(L"."));
 | 
			
		||||
    test(L"slash", std::wstring(L"/"));
 | 
			
		||||
    test(L"solidus", std::wstring(L"/"));
 | 
			
		||||
    test(L"zero", std::wstring(L"0"));
 | 
			
		||||
    test(L"one", std::wstring(L"1"));
 | 
			
		||||
    test(L"two", std::wstring(L"2"));
 | 
			
		||||
    test(L"three", std::wstring(L"3"));
 | 
			
		||||
    test(L"four", std::wstring(L"4"));
 | 
			
		||||
    test(L"five", std::wstring(L"5"));
 | 
			
		||||
    test(L"six", std::wstring(L"6"));
 | 
			
		||||
    test(L"seven", std::wstring(L"7"));
 | 
			
		||||
    test(L"eight", std::wstring(L"8"));
 | 
			
		||||
    test(L"nine", std::wstring(L"9"));
 | 
			
		||||
    test(L"colon", std::wstring(L":"));
 | 
			
		||||
    test(L"semicolon", std::wstring(L";"));
 | 
			
		||||
    test(L"less-than-sign", std::wstring(L"<"));
 | 
			
		||||
    test(L"equals-sign", std::wstring(L"="));
 | 
			
		||||
    test(L"greater-than-sign", std::wstring(L">"));
 | 
			
		||||
    test(L"question-mark", std::wstring(L"?"));
 | 
			
		||||
    test(L"commercial-at", std::wstring(L"@"));
 | 
			
		||||
    for (wchar_t c = L'A'; c <= L'Z'; ++c)
 | 
			
		||||
    {
 | 
			
		||||
        const wchar_t a[2] = {c};
 | 
			
		||||
        test(a, a);
 | 
			
		||||
        test(a, std::wstring(a));
 | 
			
		||||
    }
 | 
			
		||||
    test(L"left-square-bracket", L"[");
 | 
			
		||||
    test(L"backslash", L"\\");
 | 
			
		||||
    test(L"reverse-solidus", L"\\");
 | 
			
		||||
    test(L"right-square-bracket", L"]");
 | 
			
		||||
    test(L"circumflex-accent", L"^");
 | 
			
		||||
    test(L"circumflex", L"^");
 | 
			
		||||
    test(L"low-line", L"_");
 | 
			
		||||
    test(L"underscore", L"_");
 | 
			
		||||
    test(L"grave-accent", L"`");
 | 
			
		||||
    test(L"left-square-bracket", std::wstring(L"["));
 | 
			
		||||
    test(L"backslash", std::wstring(L"\\"));
 | 
			
		||||
    test(L"reverse-solidus", std::wstring(L"\\"));
 | 
			
		||||
    test(L"right-square-bracket", std::wstring(L"]"));
 | 
			
		||||
    test(L"circumflex-accent", std::wstring(L"^"));
 | 
			
		||||
    test(L"circumflex", std::wstring(L"^"));
 | 
			
		||||
    test(L"low-line", std::wstring(L"_"));
 | 
			
		||||
    test(L"underscore", std::wstring(L"_"));
 | 
			
		||||
    test(L"grave-accent", std::wstring(L"`"));
 | 
			
		||||
    for (wchar_t c = L'a'; c <= L'z'; ++c)
 | 
			
		||||
    {
 | 
			
		||||
        const wchar_t a[2] = {c};
 | 
			
		||||
        test(a, a);
 | 
			
		||||
        test(a, std::wstring(a));
 | 
			
		||||
    }
 | 
			
		||||
    test(L"left-brace", L"{");
 | 
			
		||||
    test(L"left-curly-bracket", L"{");
 | 
			
		||||
    test(L"vertical-line", L"|");
 | 
			
		||||
    test(L"right-brace", L"}");
 | 
			
		||||
    test(L"right-curly-bracket", L"}");
 | 
			
		||||
    test(L"tilde", L"~");
 | 
			
		||||
    test(L"left-brace", std::wstring(L"{"));
 | 
			
		||||
    test(L"left-curly-bracket", std::wstring(L"{"));
 | 
			
		||||
    test(L"vertical-line", std::wstring(L"|"));
 | 
			
		||||
    test(L"right-brace", std::wstring(L"}"));
 | 
			
		||||
    test(L"right-curly-bracket", std::wstring(L"}"));
 | 
			
		||||
    test(L"tilde", std::wstring(L"~"));
 | 
			
		||||
 | 
			
		||||
    test(L"tild", L"");
 | 
			
		||||
    test(L"ch", L"");
 | 
			
		||||
    test(L"tild", std::wstring(L""));
 | 
			
		||||
    test(L"ch", std::wstring(L""));
 | 
			
		||||
    std::locale::global(std::locale("cs_CZ.ISO8859-2"));
 | 
			
		||||
    test(L"ch", L"ch");
 | 
			
		||||
    test(L"ch", std::wstring(L"ch"));
 | 
			
		||||
    std::locale::global(std::locale("C"));
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user