зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 186127d71076 (bug 1126295) because of test bustage on Windows on a CLOSED TREE
--HG-- rename : xpcom/tests/gtest/TestAtoms.cpp => xpcom/tests/TestAtoms.cpp rename : xpcom/tests/gtest/UTFStrings.h => xpcom/tests/UTFStrings.h
This commit is contained in:
Родитель
39a6fe9c60
Коммит
a4a005ae1b
|
@ -11,85 +11,98 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsStaticAtom.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
namespace TestAtoms {
|
||||
|
||||
TEST(Atoms, Basic)
|
||||
bool
|
||||
test_basic()
|
||||
{
|
||||
for (unsigned int i = 0; i < ArrayLength(ValidStrings); ++i) {
|
||||
nsDependentString str16(ValidStrings[i].m16);
|
||||
nsDependentCString str8(ValidStrings[i].m8);
|
||||
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(str16);
|
||||
|
||||
EXPECT_TRUE(atom->Equals(str16));
|
||||
EXPECT_TRUE(atom->EqualsUTF8(str8));
|
||||
|
||||
if (!atom->Equals(str16) || !atom->EqualsUTF8(str8))
|
||||
return false;
|
||||
|
||||
nsString tmp16;
|
||||
nsCString tmp8;
|
||||
atom->ToString(tmp16);
|
||||
atom->ToUTF8String(tmp8);
|
||||
EXPECT_TRUE(str16.Equals(tmp16));
|
||||
EXPECT_TRUE(str8.Equals(tmp8));
|
||||
if (!str16.Equals(tmp16) || !str8.Equals(tmp8))
|
||||
return false;
|
||||
|
||||
EXPECT_TRUE(nsDependentString(atom->GetUTF16String()).Equals(str16));
|
||||
if (!nsDependentString(atom->GetUTF16String()).Equals(str16))
|
||||
return false;
|
||||
|
||||
EXPECT_TRUE(nsAtomString(atom).Equals(str16));
|
||||
EXPECT_TRUE(nsDependentAtomString(atom).Equals(str16));
|
||||
EXPECT_TRUE(nsAtomCString(atom).Equals(str8));
|
||||
if (!nsAtomString(atom).Equals(str16) ||
|
||||
!nsDependentAtomString(atom).Equals(str16) ||
|
||||
!nsAtomCString(atom).Equals(str8))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
TEST(Atoms, 16vs8)
|
||||
bool
|
||||
test_16vs8()
|
||||
{
|
||||
for (unsigned int i = 0; i < ArrayLength(ValidStrings); ++i) {
|
||||
nsCOMPtr<nsIAtom> atom16 = do_GetAtom(ValidStrings[i].m16);
|
||||
nsCOMPtr<nsIAtom> atom8 = do_GetAtom(ValidStrings[i].m8);
|
||||
EXPECT_EQ(atom16, atom8);
|
||||
if (atom16 != atom8)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
TEST(Atoms, BufferSharing)
|
||||
bool
|
||||
test_buffersharing()
|
||||
{
|
||||
nsString unique;
|
||||
unique.AssignLiteral("this is a unique string !@#$");
|
||||
|
||||
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(unique);
|
||||
|
||||
EXPECT_EQ(unique.get(), atom->GetUTF16String());
|
||||
|
||||
return unique.get() == atom->GetUTF16String();
|
||||
}
|
||||
|
||||
TEST(Atoms, NUll)
|
||||
bool
|
||||
test_null()
|
||||
{
|
||||
nsAutoString str(NS_LITERAL_STRING("string with a \0 char"));
|
||||
nsDependentString strCut(str.get());
|
||||
|
||||
EXPECT_FALSE(str.Equals(strCut));
|
||||
|
||||
if (str.Equals(strCut))
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIAtom> atomCut = do_GetAtom(strCut);
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(str);
|
||||
|
||||
EXPECT_EQ(atom->GetLength(), str.Length());
|
||||
EXPECT_TRUE(atom->Equals(str));
|
||||
EXPECT_TRUE(atom->EqualsUTF8(NS_ConvertUTF16toUTF8(str)));
|
||||
EXPECT_NE(atom, atomCut);
|
||||
EXPECT_TRUE(atomCut->Equals(strCut));
|
||||
|
||||
return atom->GetLength() == str.Length() &&
|
||||
atom->Equals(str) &&
|
||||
atom->EqualsUTF8(NS_ConvertUTF16toUTF8(str)) &&
|
||||
atom != atomCut &&
|
||||
atomCut->Equals(strCut);
|
||||
}
|
||||
|
||||
TEST(Atoms, Invalid)
|
||||
bool
|
||||
test_invalid()
|
||||
{
|
||||
for (unsigned int i = 0; i < ArrayLength(Invalid16Strings); ++i) {
|
||||
nsrefcnt count = NS_GetNumberOfAtoms();
|
||||
|
||||
{
|
||||
nsCOMPtr<nsIAtom> atom16 = do_GetAtom(Invalid16Strings[i].m16);
|
||||
EXPECT_TRUE(atom16->Equals(nsDependentString(Invalid16Strings[i].m16)));
|
||||
if (!atom16->Equals(nsDependentString(Invalid16Strings[i].m16)))
|
||||
return false;
|
||||
}
|
||||
|
||||
EXPECT_EQ(count, NS_GetNumberOfAtoms());
|
||||
|
||||
if (count != NS_GetNumberOfAtoms())
|
||||
return false;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < ArrayLength(Invalid8Strings); ++i) {
|
||||
|
@ -98,11 +111,13 @@ TEST(Atoms, Invalid)
|
|||
{
|
||||
nsCOMPtr<nsIAtom> atom8 = do_GetAtom(Invalid8Strings[i].m8);
|
||||
nsCOMPtr<nsIAtom> atom16 = do_GetAtom(Invalid8Strings[i].m16);
|
||||
EXPECT_EQ(atom16, atom8);
|
||||
EXPECT_TRUE(atom16->Equals(nsDependentString(Invalid8Strings[i].m16)));
|
||||
if (atom16 != atom8 ||
|
||||
!atom16->Equals(nsDependentString(Invalid8Strings[i].m16)))
|
||||
return false;
|
||||
}
|
||||
|
||||
EXPECT_EQ(count, NS_GetNumberOfAtoms());
|
||||
|
||||
if (count != NS_GetNumberOfAtoms())
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't run this test in debug builds as that intentionally asserts.
|
||||
|
@ -113,10 +128,13 @@ TEST(Atoms, Invalid)
|
|||
nsrefcnt count = NS_GetNumberOfAtoms();
|
||||
|
||||
nsCOMPtr<nsIAtom> atom8 = do_GetAtom(Malformed8Strings[i]);
|
||||
EXPECT_EQ(atom8, emptyAtom);
|
||||
EXPECT_EQ(count, NS_GetNumberOfAtoms());
|
||||
if (atom8 != emptyAtom ||
|
||||
count != NS_GetNumberOfAtoms())
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define FIRST_ATOM_STR "first static atom. Hello!"
|
||||
|
@ -149,62 +167,112 @@ isStaticAtom(nsIAtom* atom)
|
|||
(atom->Release() == 1);
|
||||
}
|
||||
|
||||
TEST(Atoms, Table)
|
||||
bool
|
||||
test_atomtable()
|
||||
{
|
||||
nsrefcnt count = NS_GetNumberOfAtoms();
|
||||
|
||||
|
||||
nsCOMPtr<nsIAtom> thirdNonPerm = do_GetAtom(THIRD_ATOM_STR);
|
||||
|
||||
if (isStaticAtom(thirdNonPerm))
|
||||
return false;
|
||||
|
||||
EXPECT_FALSE(isStaticAtom(thirdNonPerm));
|
||||
|
||||
EXPECT_TRUE(thirdNonPerm);
|
||||
EXPECT_EQ(NS_GetNumberOfAtoms(), count + 1);
|
||||
if (!thirdNonPerm || NS_GetNumberOfAtoms() != count + 1)
|
||||
return false;
|
||||
|
||||
NS_RegisterStaticAtoms(sAtoms_info);
|
||||
|
||||
EXPECT_TRUE(sAtom1);
|
||||
EXPECT_TRUE(sAtom1->Equals(NS_LITERAL_STRING(FIRST_ATOM_STR)));
|
||||
EXPECT_TRUE(isStaticAtom(sAtom1));
|
||||
EXPECT_TRUE(sAtom2);
|
||||
EXPECT_TRUE(sAtom2->Equals(NS_LITERAL_STRING(SECOND_ATOM_STR)));
|
||||
EXPECT_TRUE(isStaticAtom(sAtom2));
|
||||
EXPECT_TRUE(sAtom3);
|
||||
EXPECT_TRUE(sAtom3->Equals(NS_LITERAL_STRING(THIRD_ATOM_STR)));
|
||||
EXPECT_TRUE(isStaticAtom(sAtom3));
|
||||
EXPECT_EQ(NS_GetNumberOfAtoms(), count + 3);
|
||||
EXPECT_EQ(thirdNonPerm, sAtom3);
|
||||
return sAtom1 &&
|
||||
sAtom1->Equals(NS_LITERAL_STRING(FIRST_ATOM_STR)) &&
|
||||
isStaticAtom(sAtom1) &&
|
||||
sAtom2 &&
|
||||
sAtom2->Equals(NS_LITERAL_STRING(SECOND_ATOM_STR)) &&
|
||||
isStaticAtom(sAtom2) &&
|
||||
sAtom3 &&
|
||||
sAtom3->Equals(NS_LITERAL_STRING(THIRD_ATOM_STR)) &&
|
||||
isStaticAtom(sAtom3) &&
|
||||
NS_GetNumberOfAtoms() == count + 3 &&
|
||||
thirdNonPerm == sAtom3;
|
||||
}
|
||||
|
||||
#define FIRST_PERM_ATOM_STR "first permanent atom. Hello!"
|
||||
#define SECOND_PERM_ATOM_STR "second permanent atom. @World!"
|
||||
|
||||
TEST(Atoms, Permanent)
|
||||
bool
|
||||
test_permanent()
|
||||
{
|
||||
nsrefcnt count = NS_GetNumberOfAtoms();
|
||||
|
||||
{
|
||||
nsCOMPtr<nsIAtom> first = do_GetAtom(FIRST_PERM_ATOM_STR);
|
||||
EXPECT_TRUE(first->Equals(NS_LITERAL_STRING(FIRST_PERM_ATOM_STR)));
|
||||
EXPECT_FALSE(isStaticAtom(first));
|
||||
|
||||
if (!first->Equals(NS_LITERAL_STRING(FIRST_PERM_ATOM_STR)) ||
|
||||
isStaticAtom(first))
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIAtom> first_p =
|
||||
NS_NewPermanentAtom(NS_LITERAL_STRING(FIRST_PERM_ATOM_STR));
|
||||
EXPECT_TRUE(first_p->Equals(NS_LITERAL_STRING(FIRST_PERM_ATOM_STR)));
|
||||
EXPECT_TRUE(isStaticAtom(first_p));
|
||||
EXPECT_EQ(first, first_p);
|
||||
|
||||
if (!first_p->Equals(NS_LITERAL_STRING(FIRST_PERM_ATOM_STR)) ||
|
||||
!isStaticAtom(first_p) ||
|
||||
first != first_p)
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIAtom> second_p =
|
||||
NS_NewPermanentAtom(NS_LITERAL_STRING(SECOND_PERM_ATOM_STR));
|
||||
EXPECT_TRUE(second_p->Equals(NS_LITERAL_STRING(SECOND_PERM_ATOM_STR)));
|
||||
EXPECT_TRUE(isStaticAtom(second_p));
|
||||
|
||||
if (!second_p->Equals(NS_LITERAL_STRING(SECOND_PERM_ATOM_STR)) ||
|
||||
!isStaticAtom(second_p))
|
||||
return false;
|
||||
|
||||
nsCOMPtr<nsIAtom> second = do_GetAtom(SECOND_PERM_ATOM_STR);
|
||||
EXPECT_TRUE(second->Equals(NS_LITERAL_STRING(SECOND_PERM_ATOM_STR)));
|
||||
EXPECT_TRUE(isStaticAtom(second));
|
||||
EXPECT_EQ(second, second_p);
|
||||
if (!second->Equals(NS_LITERAL_STRING(SECOND_PERM_ATOM_STR)) ||
|
||||
!isStaticAtom(second) ||
|
||||
second != second_p)
|
||||
return false;
|
||||
}
|
||||
|
||||
EXPECT_EQ(NS_GetNumberOfAtoms(), count + 2);
|
||||
return NS_GetNumberOfAtoms() == count + 2;
|
||||
}
|
||||
|
||||
typedef bool (*TestFunc)();
|
||||
|
||||
static const struct Test
|
||||
{
|
||||
const char* name;
|
||||
TestFunc func;
|
||||
}
|
||||
tests[] =
|
||||
{
|
||||
{ "test_basic", test_basic },
|
||||
{ "test_16vs8", test_16vs8 },
|
||||
{ "test_buffersharing", test_buffersharing },
|
||||
{ "test_null", test_null },
|
||||
{ "test_invalid", test_invalid },
|
||||
// FIXME: Bug 577500 TestAtoms fails when run in dist/bin due to
|
||||
// static atom table already being closed. TestStaticAtoms has similar
|
||||
// failure.
|
||||
#if 0
|
||||
{ "test_atomtable", test_atomtable },
|
||||
{ "test_permanent", test_permanent },
|
||||
#endif
|
||||
{ nullptr, nullptr }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
using namespace TestAtoms;
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
nsCOMPtr<nsIServiceManager> servMan;
|
||||
NS_InitXPCOM2(getter_AddRefs(servMan), nullptr, nullptr);
|
||||
|
||||
for (const Test* t = tests; t->name != nullptr; ++t)
|
||||
{
|
||||
printf("%25s : %s\n", t->name, t->func() ? "SUCCESS" : "FAILURE <--");
|
||||
}
|
||||
}
|
||||
|
||||
NS_ShutdownXPCOM(nullptr);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,110 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef utfstrings_h__
|
||||
#define utfstrings_h__
|
||||
|
||||
struct UTFStringsStringPair
|
||||
{
|
||||
char16_t m16[16];
|
||||
char m8[16];
|
||||
};
|
||||
|
||||
static const UTFStringsStringPair ValidStrings[] =
|
||||
{
|
||||
{ { 'a', 'b', 'c', 'd' },
|
||||
{ 'a', 'b', 'c', 'd' } },
|
||||
{ { '1', '2', '3', '4' },
|
||||
{ '1', '2', '3', '4' } },
|
||||
{ { 0x7F, 'A', 0x80, 'B', 0x101, 0x200 },
|
||||
{ 0x7F, 'A', 0xC2, 0x80, 'B', 0xC4, 0x81, 0xC8, 0x80 } },
|
||||
{ { 0x7FF, 0x800, 0x1000 },
|
||||
{ 0xDF, 0xBF, 0xE0, 0xA0, 0x80, 0xE1, 0x80, 0x80 } },
|
||||
{ { 0xD7FF, 0xE000, 0xF00F, 'A', 0xFFF0 },
|
||||
{ 0xED, 0x9F, 0xBF, 0xEE, 0x80, 0x80, 0xEF, 0x80, 0x8F, 'A', 0xEF, 0xBF, 0xB0 } },
|
||||
{ { 0xFFF7, 0xFFFC, 0xFFFD, 0xFFFD },
|
||||
{ 0xEF, 0xBF, 0xB7, 0xEF, 0xBF, 0xBC, 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD } },
|
||||
{ { 0xD800, 0xDC00, 0xD800, 0xDCFF },
|
||||
{ 0xF0, 0x90, 0x80, 0x80, 0xF0, 0x90, 0x83, 0xBF } },
|
||||
{ { 0xDBFF, 0xDFFF, 0xDBB7, 0xDCBA },
|
||||
{ 0xF4, 0x8F, 0xBF, 0xBF, 0xF3, 0xBD, 0xB2, 0xBA } },
|
||||
{ { 0xFFFD, 0xFFFF },
|
||||
{ 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBF } },
|
||||
{ { 0xFFFD, 0xFFFE, 0xFFFF },
|
||||
{ 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBE, 0xEF, 0xBF, 0xBF } },
|
||||
};
|
||||
|
||||
static const UTFStringsStringPair Invalid16Strings[] =
|
||||
{
|
||||
{ { 'a', 'b', 0xD800 },
|
||||
{ 'a', 'b', 0xEF, 0xBF, 0xBD } },
|
||||
{ { 0xD8FF, 'b' },
|
||||
{ 0xEF, 0xBF, 0xBD, 'b' } },
|
||||
{ { 0xD821 },
|
||||
{ 0xEF, 0xBF, 0xBD } },
|
||||
{ { 0xDC21 },
|
||||
{ 0xEF, 0xBF, 0xBD } },
|
||||
{ { 0xDC00, 0xD800, 'b' },
|
||||
{ 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD, 'b' } },
|
||||
{ { 'b', 0xDC00, 0xD800 },
|
||||
{ 'b', 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD } },
|
||||
{ { 0xDC00, 0xD800 },
|
||||
{ 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD } },
|
||||
{ { 0xDC00, 0xD800, 0xDC00, 0xD800 },
|
||||
{ 0xEF, 0xBF, 0xBD, 0xF0, 0x90, 0x80, 0x80, 0xEF, 0xBF, 0xBD } },
|
||||
{ { 0xDC00, 0xD800, 0xD800, 0xDC00 },
|
||||
{ 0xEF, 0xBF, 0xBD, 0xEF, 0xBF, 0xBD, 0xF0, 0x90, 0x80, 0x80 } },
|
||||
};
|
||||
|
||||
static const UTFStringsStringPair Invalid8Strings[] =
|
||||
{
|
||||
{ { 'a', 0xFFFD, 'b' },
|
||||
{ 'a', 0xC0, 0x80, 'b' } },
|
||||
{ { 0xFFFD, 0x80 },
|
||||
{ 0xC1, 0xBF, 0xC2, 0x80 } },
|
||||
{ { 0xFFFD },
|
||||
{ 0xC1, 0xBF } },
|
||||
{ { 0xFFFD, 'x', 0x0800 },
|
||||
{ 0xE0, 0x80, 0x80, 'x', 0xE0, 0xA0, 0x80 } },
|
||||
{ { 0xFFFD, 'x', 0xFFFD },
|
||||
{ 0xF0, 0x80, 0x80, 0x80, 'x', 0xF0, 0x80, 0x8F, 0x80 } },
|
||||
{ { 0xFFFD, 0xFFFD },
|
||||
{ 0xF4, 0x90, 0x80, 0x80, 0xF7, 0xBF, 0xBF, 0xBF } },
|
||||
{ { 0xFFFD, 'x', 0xD800, 0xDC00, 0xFFFD },
|
||||
{ 0xF0, 0x8F, 0xBF, 0xBF, 'x', 0xF0, 0x90, 0x80, 0x80, 0xF0, 0x8F, 0xBF, 0xBF } },
|
||||
{ { 0xFFFD, 'x', 0xFFFD },
|
||||
{ 0xF8, 0x80, 0x80, 0x80, 0x80, 'x', 0xF8, 0x88, 0x80, 0x80, 0x80 } },
|
||||
{ { 0xFFFD, 0xFFFD },
|
||||
{ 0xFB, 0xBF, 0xBF, 0xBF, 0xBF, 0xFC, 0xA0, 0x80, 0x80, 0x80, 0x80 } },
|
||||
{ { 0xFFFD, 0xFFFD },
|
||||
{ 0xFC, 0x80, 0x80, 0x80, 0x80, 0x80, 0xFD, 0xBF, 0xBF, 0xBF, 0xBF, 0xBF } },
|
||||
};
|
||||
|
||||
// Don't use this array in debug builds as that intentionally asserts.
|
||||
#ifndef DEBUG
|
||||
static const char Malformed8Strings[][16] =
|
||||
{
|
||||
{ 0x80 },
|
||||
{ 'a', 0xC8, 'c' },
|
||||
{ 'a', 0xC0 },
|
||||
{ 'a', 0xE8, 'c' },
|
||||
{ 'a', 0xE8, 0x80, 'c' },
|
||||
{ 'a', 0xE8, 0x80 },
|
||||
{ 0xE8, 0x7F, 0x80 },
|
||||
{ 'a', 0xE8, 0xE8, 0x80 },
|
||||
{ 'a', 0xF4 },
|
||||
{ 'a', 0xF4, 0x80, 0x80, 'c', 'c' },
|
||||
{ 'a', 0xF4, 0x80, 'x', 0x80 },
|
||||
{ 0xF4, 0x80, 0x80, 0x80, 0x80 },
|
||||
{ 'a', 0xFA, 'c' },
|
||||
{ 'a', 0xFA, 0x80, 0x80, 0x7F, 0x80, 'c' },
|
||||
{ 'a', 0xFA, 0x80, 0x80, 0x80, 0x80, 0x80, 'c' },
|
||||
{ 'a', 0xFD },
|
||||
{ 'a', 0xFD, 0x80, 0x80, 0x80, 0x80, 'c' },
|
||||
{ 'a', 0xFD, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80 },
|
||||
{ 'a', 0xFC, 0x80, 0x80, 0x40, 0x80, 0x80, 'c' },
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,110 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef utfstrings_h__
|
||||
#define utfstrings_h__
|
||||
|
||||
struct UTFStringsStringPair
|
||||
{
|
||||
char16_t m16[16];
|
||||
char m8[16];
|
||||
};
|
||||
|
||||
static const UTFStringsStringPair ValidStrings[] =
|
||||
{
|
||||
{ { 'a', 'b', 'c', 'd' },
|
||||
{ 'a', 'b', 'c', 'd' } },
|
||||
{ { '1', '2', '3', '4' },
|
||||
{ '1', '2', '3', '4' } },
|
||||
{ { 0x7F, 'A', 0x80, 'B', 0x101, 0x200 },
|
||||
{ 0x7F, 'A', char(0xC2), char(0x80), 'B', char(0xC4), char(0x81), char(0xC8), char(0x80) } },
|
||||
{ { 0x7FF, 0x800, 0x1000 },
|
||||
{ char(0xDF), char(0xBF), char(0xE0), char(0xA0), char(0x80), char(0xE1), char(0x80), char(0x80) } },
|
||||
{ { 0xD7FF, 0xE000, 0xF00F, 'A', 0xFFF0 },
|
||||
{ char(0xED), char(0x9F), char(0xBF), char(0xEE), char(0x80), char(0x80), char(0xEF), char(0x80), char(0x8F), 'A', char(0xEF), char(0xBF), char(0xB0) } },
|
||||
{ { 0xFFF7, 0xFFFC, 0xFFFD, 0xFFFD },
|
||||
{ char(0xEF), char(0xBF), char(0xB7), char(0xEF), char(0xBF), char(0xBC), char(0xEF), char(0xBF), char(0xBD), char(0xEF), char(0xBF), char(0xBD) } },
|
||||
{ { 0xD800, 0xDC00, 0xD800, 0xDCFF },
|
||||
{ char(0xF0), char(0x90), char(0x80), char(0x80), char(0xF0), char(0x90), char(0x83), char(0xBF) } },
|
||||
{ { 0xDBFF, 0xDFFF, 0xDBB7, 0xDCBA },
|
||||
{ char(0xF4), char(0x8F), char(0xBF), char(0xBF), char(0xF3), char(0xBD), char(0xB2), char(0xBA) } },
|
||||
{ { 0xFFFD, 0xFFFF },
|
||||
{ char(0xEF), char(0xBF), char(0xBD), char(0xEF), char(0xBF), char(0xBF) } },
|
||||
{ { 0xFFFD, 0xFFFE, 0xFFFF },
|
||||
{ char(0xEF), char(0xBF), char(0xBD), char(0xEF), char(0xBF), char(0xBE), char(0xEF), char(0xBF), char(0xBF) } },
|
||||
};
|
||||
|
||||
static const UTFStringsStringPair Invalid16Strings[] =
|
||||
{
|
||||
{ { 'a', 'b', 0xD800 },
|
||||
{ 'a', 'b', char(0xEF), char(0xBF), char(0xBD) } },
|
||||
{ { 0xD8FF, 'b' },
|
||||
{ char(0xEF), char(0xBF), char(0xBD), 'b' } },
|
||||
{ { 0xD821 },
|
||||
{ char(0xEF), char(0xBF), char(0xBD) } },
|
||||
{ { 0xDC21 },
|
||||
{ char(0xEF), char(0xBF), char(0xBD) } },
|
||||
{ { 0xDC00, 0xD800, 'b' },
|
||||
{ char(0xEF), char(0xBF), char(0xBD), char(0xEF), char(0xBF), char(0xBD), 'b' } },
|
||||
{ { 'b', 0xDC00, 0xD800 },
|
||||
{ 'b', char(0xEF), char(0xBF), char(0xBD), char(0xEF), char(0xBF), char(0xBD) } },
|
||||
{ { 0xDC00, 0xD800 },
|
||||
{ char(0xEF), char(0xBF), char(0xBD), char(0xEF), char(0xBF), char(0xBD) } },
|
||||
{ { 0xDC00, 0xD800, 0xDC00, 0xD800 },
|
||||
{ char(0xEF), char(0xBF), char(0xBD), char(0xF0), char(0x90), char(0x80), char(0x80), char(0xEF), char(0xBF), char(0xBD) } },
|
||||
{ { 0xDC00, 0xD800, 0xD800, 0xDC00 },
|
||||
{ char(0xEF), char(0xBF), char(0xBD), char(0xEF), char(0xBF), char(0xBD), char(0xF0), char(0x90), char(0x80), char(0x80) } },
|
||||
};
|
||||
|
||||
static const UTFStringsStringPair Invalid8Strings[] =
|
||||
{
|
||||
{ { 'a', 0xFFFD, 'b' },
|
||||
{ 'a', char(0xC0), char(0x80), 'b' } },
|
||||
{ { 0xFFFD, 0x80 },
|
||||
{ char(0xC1), char(0xBF), char(0xC2), char(0x80) } },
|
||||
{ { 0xFFFD },
|
||||
{ char(0xC1), char(0xBF) } },
|
||||
{ { 0xFFFD, 'x', 0x0800 },
|
||||
{ char(0xE0), char(0x80), char(0x80), 'x', char(0xE0), char(0xA0), char(0x80) } },
|
||||
{ { 0xFFFD, 'x', 0xFFFD },
|
||||
{ char(0xF0), char(0x80), char(0x80), char(0x80), 'x', char(0xF0), char(0x80), char(0x8F), char(0x80) } },
|
||||
{ { 0xFFFD, 0xFFFD },
|
||||
{ char(0xF4), char(0x90), char(0x80), char(0x80), char(0xF7), char(0xBF), char(0xBF), char(0xBF) } },
|
||||
{ { 0xFFFD, 'x', 0xD800, 0xDC00, 0xFFFD },
|
||||
{ char(0xF0), char(0x8F), char(0xBF), char(0xBF), 'x', char(0xF0), char(0x90), char(0x80), char(0x80), char(0xF0), char(0x8F), char(0xBF), char(0xBF) } },
|
||||
{ { 0xFFFD, 'x', 0xFFFD },
|
||||
{ char(0xF8), char(0x80), char(0x80), char(0x80), char(0x80), 'x', char(0xF8), char(0x88), char(0x80), char(0x80), char(0x80) } },
|
||||
{ { 0xFFFD, 0xFFFD },
|
||||
{ char(0xFB), char(0xBF), char(0xBF), char(0xBF), char(0xBF), char(0xFC), char(0xA0), char(0x80), char(0x80), char(0x80), char(0x80) } },
|
||||
{ { 0xFFFD, 0xFFFD },
|
||||
{ char(0xFC), char(0x80), char(0x80), char(0x80), char(0x80), char(0x80), char(0xFD), char(0xBF), char(0xBF), char(0xBF), char(0xBF), char(0xBF) } },
|
||||
};
|
||||
|
||||
// Don't use this array in debug builds as that intentionally asserts.
|
||||
#ifndef DEBUG
|
||||
static const char Malformed8Strings[][16] =
|
||||
{
|
||||
{ char(0x80) },
|
||||
{ 'a', char(0xC8), 'c' },
|
||||
{ 'a', char(0xC0) },
|
||||
{ 'a', char(0xE8), 'c' },
|
||||
{ 'a', char(0xE8), char(0x80), 'c' },
|
||||
{ 'a', char(0xE8), char(0x80) },
|
||||
{ char(0xE8), 0x7F, char(0x80) },
|
||||
{ 'a', char(0xE8), char(0xE8), char(0x80) },
|
||||
{ 'a', char(0xF4) },
|
||||
{ 'a', char(0xF4), char(0x80), char(0x80), 'c', 'c' },
|
||||
{ 'a', char(0xF4), char(0x80), 'x', char(0x80) },
|
||||
{ char(0xF4), char(0x80), char(0x80), char(0x80), char(0x80) },
|
||||
{ 'a', char(0xFA), 'c' },
|
||||
{ 'a', char(0xFA), char(0x80), char(0x80), 0x7F, char(0x80), 'c' },
|
||||
{ 'a', char(0xFA), char(0x80), char(0x80), char(0x80), char(0x80), char(0x80), 'c' },
|
||||
{ 'a', char(0xFD) },
|
||||
{ 'a', char(0xFD), char(0x80), char(0x80), char(0x80), char(0x80), 'c' },
|
||||
{ 'a', char(0xFD), char(0x80), char(0x80), char(0x80), char(0x80), char(0x80), char(0x80) },
|
||||
{ 'a', char(0xFC), char(0x80), char(0x80), 0x40, char(0x80), char(0x80), 'c' },
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -5,7 +5,6 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'TestAtoms.cpp',
|
||||
'TestCRT.cpp',
|
||||
'TestEncoding.cpp',
|
||||
'TestExpirationTracker.cpp',
|
||||
|
|
|
@ -83,6 +83,7 @@ if CONFIG['MOZ_MEMORY']:
|
|||
# 'TestThreads',
|
||||
# 'TestXPIDLString',
|
||||
# 'TestUTF',
|
||||
# 'TestAtoms',
|
||||
#]
|
||||
|
||||
# FIXME: bug 577500 TestStaticAtoms fails when run in dist/bin
|
||||
|
|
Загрузка…
Ссылка в новой задаче