summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/cfx_bytestring_unittest.cpp30
-rw-r--r--core/fxcrt/cfx_widestring_unittest.cpp26
2 files changed, 2 insertions, 54 deletions
diff --git a/core/fxcrt/cfx_bytestring_unittest.cpp b/core/fxcrt/cfx_bytestring_unittest.cpp
index 415b4621a1..dcb8577b65 100644
--- a/core/fxcrt/cfx_bytestring_unittest.cpp
+++ b/core/fxcrt/cfx_bytestring_unittest.cpp
@@ -13,9 +13,6 @@
TEST(fxcrt, ByteStringElementAccess) {
const CFX_ByteString abc("abc");
-#ifndef NDEBUG
- EXPECT_DEATH({ abc[-1]; }, ".*");
-#endif
EXPECT_EQ('a', abc[0]);
EXPECT_EQ('b', abc[1]);
EXPECT_EQ('c', abc[2]);
@@ -29,11 +26,8 @@ TEST(fxcrt, ByteStringElementAccess) {
EXPECT_EQ('b', mutable_abc[1]);
EXPECT_EQ('c', mutable_abc[2]);
EXPECT_EQ(abc.c_str(), mutable_abc.c_str());
-
-#ifndef NDEBUG
- EXPECT_DEATH({ mutable_abc.SetAt(-1, 'd'); }, ".*");
EXPECT_EQ("abc", abc);
-#endif
+
const char* c_str = abc.c_str();
mutable_abc.SetAt(0, 'd');
EXPECT_EQ(c_str, abc.c_str());
@@ -414,8 +408,6 @@ TEST(fxcrt, ByteStringReplace) {
TEST(fxcrt, ByteStringInsert) {
CFX_ByteString fred("FRED");
- EXPECT_EQ(4u, fred.Insert(-1, 'X'));
- EXPECT_EQ("FRED", fred);
EXPECT_EQ(5u, fred.Insert(0, 'S'));
EXPECT_EQ("SFRED", fred);
EXPECT_EQ(6u, fred.Insert(1, 'T'));
@@ -428,11 +420,6 @@ TEST(fxcrt, ByteStringInsert) {
EXPECT_EQ("STFRUEDV", fred);
{
CFX_ByteString empty;
- EXPECT_EQ(0u, empty.Insert(-1, 'X'));
- EXPECT_NE("X", empty);
- }
- {
- CFX_ByteString empty;
EXPECT_EQ(1u, empty.Insert(0, 'X'));
EXPECT_EQ("X", empty);
}
@@ -487,8 +474,6 @@ TEST(fxcrt, ByteStringDelete) {
EXPECT_EQ("ED", fred);
EXPECT_EQ(1u, fred.Delete(1));
EXPECT_EQ("E", fred);
- EXPECT_EQ(1u, fred.Delete(-1));
- EXPECT_EQ("E", fred);
EXPECT_EQ(0u, fred.Delete(0));
EXPECT_EQ("", fred);
EXPECT_EQ(0u, fred.Delete(0));
@@ -497,8 +482,6 @@ TEST(fxcrt, ByteStringDelete) {
CFX_ByteString empty;
EXPECT_EQ(0u, empty.Delete(0));
EXPECT_EQ("", empty);
- EXPECT_EQ(0u, empty.Delete(-1));
- EXPECT_EQ("", empty);
EXPECT_EQ(0u, empty.Delete(1));
EXPECT_EQ("", empty);
}
@@ -519,7 +502,6 @@ TEST(fxcrt, ByteStringMid) {
EXPECT_EQ("FRED", fred.Mid(0, 4));
EXPECT_EQ("", fred.Mid(0, 10));
- EXPECT_EQ("", fred.Mid(-1, 2));
EXPECT_EQ("RED", fred.Mid(1, 3));
EXPECT_EQ("", fred.Mid(4, 1));
@@ -536,12 +518,10 @@ TEST(fxcrt, ByteStringLeft) {
EXPECT_EQ("FRED", fred.Left(4));
EXPECT_EQ("", fred.Left(5));
- EXPECT_EQ("", fred.Left(-1));
CFX_ByteString empty;
EXPECT_EQ("", empty.Left(0));
EXPECT_EQ("", empty.Left(1));
- EXPECT_EQ("", empty.Left(-1));
}
TEST(fxcrt, ByteStringRight) {
@@ -553,12 +533,10 @@ TEST(fxcrt, ByteStringRight) {
EXPECT_EQ("FRED", fred.Right(4));
EXPECT_EQ("", fred.Right(5));
- EXPECT_EQ("", fred.Right(-1));
CFX_ByteString empty;
EXPECT_EQ("", empty.Right(0));
EXPECT_EQ("", empty.Right(1));
- EXPECT_EQ("", empty.Right(-1));
}
TEST(fxcrt, ByteStringFind) {
@@ -1009,12 +987,9 @@ TEST(fxcrt, ByteStringCMid) {
CFX_ByteStringC longer_string("abcdef");
EXPECT_EQ(longer_string, longer_string.Mid(0, 6));
EXPECT_EQ("", longer_string.Mid(0, 187));
- EXPECT_EQ("", longer_string.Mid(-42, 6));
- EXPECT_EQ("", longer_string.Mid(-42, 187));
CFX_ByteStringC leading_substring("ab");
EXPECT_EQ(leading_substring, longer_string.Mid(0, 2));
- EXPECT_EQ("", longer_string.Mid(-1, 2));
CFX_ByteStringC middle_substring("bcde");
EXPECT_EQ(middle_substring, longer_string.Mid(1, 4));
@@ -1027,9 +1002,6 @@ TEST(fxcrt, ByteStringCMid) {
TEST(fxcrt, ByteStringCElementAccess) {
// CFX_ByteStringC includes the NUL terminator for non-empty strings.
CFX_ByteStringC abc("abc");
-#ifndef NDEBUG
- EXPECT_DEATH({ abc[-1]; }, ".*");
-#endif
EXPECT_EQ('a', static_cast<char>(abc[0]));
EXPECT_EQ('b', static_cast<char>(abc[1]));
EXPECT_EQ('c', static_cast<char>(abc[2]));
diff --git a/core/fxcrt/cfx_widestring_unittest.cpp b/core/fxcrt/cfx_widestring_unittest.cpp
index 1408d10f15..7b12d50601 100644
--- a/core/fxcrt/cfx_widestring_unittest.cpp
+++ b/core/fxcrt/cfx_widestring_unittest.cpp
@@ -12,9 +12,6 @@
TEST(fxcrt, WideStringElementAccess) {
const CFX_WideString abc(L"abc");
-#ifndef NDEBUG
- EXPECT_DEATH({ abc[-1]; }, ".*");
-#endif
EXPECT_EQ(L'a', abc[0]);
EXPECT_EQ(L'b', abc[1]);
EXPECT_EQ(L'c', abc[2]);
@@ -28,10 +25,8 @@ TEST(fxcrt, WideStringElementAccess) {
EXPECT_EQ(L'b', mutable_abc[1]);
EXPECT_EQ(L'c', mutable_abc[2]);
EXPECT_EQ(abc.c_str(), mutable_abc.c_str());
-#ifndef NDEBUG
- EXPECT_DEATH({ mutable_abc.SetAt(-1, L'd'); }, ".*");
EXPECT_EQ(L"abc", abc);
-#endif
+
const wchar_t* c_str = abc.c_str();
mutable_abc.SetAt(0, L'd');
EXPECT_EQ(c_str, abc.c_str());
@@ -373,8 +368,6 @@ TEST(fxcrt, WideStringReplace) {
TEST(fxcrt, WideStringInsert) {
CFX_WideString fred(L"FRED");
- EXPECT_EQ(4u, fred.Insert(-1, 'X'));
- EXPECT_EQ(L"FRED", fred);
EXPECT_EQ(5u, fred.Insert(0, 'S'));
EXPECT_EQ(L"SFRED", fred);
EXPECT_EQ(6u, fred.Insert(1, 'T'));
@@ -387,11 +380,6 @@ TEST(fxcrt, WideStringInsert) {
EXPECT_EQ(L"STFRUEDV", fred);
{
CFX_WideString empty;
- EXPECT_EQ(0u, empty.Insert(-1, 'X'));
- EXPECT_NE(L"X", empty);
- }
- {
- CFX_WideString empty;
EXPECT_EQ(1u, empty.Insert(0, 'X'));
EXPECT_EQ(L"X", empty);
}
@@ -446,8 +434,6 @@ TEST(fxcrt, WideStringDelete) {
EXPECT_EQ(L"ED", fred);
EXPECT_EQ(1u, fred.Delete(1));
EXPECT_EQ(L"E", fred);
- EXPECT_EQ(1u, fred.Delete(-1));
- EXPECT_EQ(L"E", fred);
EXPECT_EQ(0u, fred.Delete(0));
EXPECT_EQ(L"", fred);
EXPECT_EQ(0u, fred.Delete(0));
@@ -456,8 +442,6 @@ TEST(fxcrt, WideStringDelete) {
CFX_WideString empty;
EXPECT_EQ(0u, empty.Delete(0));
EXPECT_EQ(L"", empty);
- EXPECT_EQ(0u, empty.Delete(-1));
- EXPECT_EQ(L"", empty);
EXPECT_EQ(0u, empty.Delete(1));
EXPECT_EQ(L"", empty);
}
@@ -478,7 +462,6 @@ TEST(fxcrt, WideStringMid) {
EXPECT_EQ(L"FRED", fred.Mid(0, 4));
EXPECT_EQ(L"", fred.Mid(0, 10));
- EXPECT_EQ(L"", fred.Mid(-1, 2));
EXPECT_EQ(L"", fred.Mid(1, 4));
EXPECT_EQ(L"", fred.Mid(4, 1));
@@ -495,12 +478,10 @@ TEST(fxcrt, WideStringLeft) {
EXPECT_EQ(L"FRED", fred.Left(4));
EXPECT_EQ(L"", fred.Left(5));
- EXPECT_EQ(L"", fred.Left(-1));
CFX_WideString empty;
EXPECT_EQ(L"", empty.Left(0));
EXPECT_EQ(L"", empty.Left(1));
- EXPECT_EQ(L"", empty.Left(-1));
}
TEST(fxcrt, WideStringRight) {
@@ -512,12 +493,10 @@ TEST(fxcrt, WideStringRight) {
EXPECT_EQ(L"FRED", fred.Right(4));
EXPECT_EQ(L"", fred.Right(5));
- EXPECT_EQ(L"", fred.Right(-1));
CFX_WideString empty;
EXPECT_EQ(L"", empty.Right(0));
EXPECT_EQ(L"", empty.Right(1));
- EXPECT_EQ(L"", empty.Right(-1));
}
TEST(fxcrt, WideStringFind) {
@@ -818,9 +797,6 @@ TEST(fxcrt, WideStringCFromVector) {
TEST(fxcrt, WideStringCElementAccess) {
CFX_WideStringC abc(L"abc");
-#ifndef NDEBUG
- EXPECT_DEATH({ abc[-1]; }, ".*");
-#endif
EXPECT_EQ(L'a', static_cast<wchar_t>(abc[0]));
EXPECT_EQ(L'b', static_cast<wchar_t>(abc[1]));
EXPECT_EQ(L'c', static_cast<wchar_t>(abc[2]));