diff options
author | Michael Wright | 2016-05-09 08:43:31 -0500 |
---|---|---|
committer | Michael Wright | 2016-05-09 13:45:07 -0500 |
commit | 5bacef33c91e9625dfd09ecf638c2de7faecd34e (patch) | |
tree | 545ac749f183ec37edc89eb5e2066427cc0457fa /libutils/tests | |
parent | ea41a18c933d20264b89fc89febf387231dc0c24 (diff) | |
download | platform-system-core-5bacef33c91e9625dfd09ecf638c2de7faecd34e.tar.gz platform-system-core-5bacef33c91e9625dfd09ecf638c2de7faecd34e.tar.xz platform-system-core-5bacef33c91e9625dfd09ecf638c2de7faecd34e.zip |
Add String16#contains and strstr16 methods.
These are needed for aapt to find javadoc comments that contain
"@removed" in order to skip them when printing styleable docs.
Bug: 28663748
Change-Id: I8866d2167c41e11d6c2586da369560d5815fd13e
Diffstat (limited to 'libutils/tests')
-rw-r--r-- | libutils/tests/Unicode_test.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libutils/tests/Unicode_test.cpp b/libutils/tests/Unicode_test.cpp index 18c130c55..c263f75e2 100644 --- a/libutils/tests/Unicode_test.cpp +++ b/libutils/tests/Unicode_test.cpp | |||
@@ -29,6 +29,8 @@ protected: | |||
29 | 29 | ||
30 | virtual void TearDown() { | 30 | virtual void TearDown() { |
31 | } | 31 | } |
32 | |||
33 | char16_t const * const kSearchString = u"I am a leaf on the wind."; | ||
32 | }; | 34 | }; |
33 | 35 | ||
34 | TEST_F(UnicodeTest, UTF8toUTF16ZeroLength) { | 36 | TEST_F(UnicodeTest, UTF8toUTF16ZeroLength) { |
@@ -112,4 +114,37 @@ TEST_F(UnicodeTest, UTF8toUTF16Normal) { | |||
112 | << "should be NULL terminated"; | 114 | << "should be NULL terminated"; |
113 | } | 115 | } |
114 | 116 | ||
117 | TEST_F(UnicodeTest, strstr16EmptyTarget) { | ||
118 | EXPECT_EQ(strstr16(kSearchString, u""), kSearchString) | ||
119 | << "should return the original pointer"; | ||
120 | } | ||
121 | |||
122 | TEST_F(UnicodeTest, strstr16SameString) { | ||
123 | const char16_t* result = strstr16(kSearchString, kSearchString); | ||
124 | EXPECT_EQ(kSearchString, result) | ||
125 | << "should return the original pointer"; | ||
126 | } | ||
127 | |||
128 | TEST_F(UnicodeTest, strstr16TargetStartOfString) { | ||
129 | const char16_t* result = strstr16(kSearchString, u"I am"); | ||
130 | EXPECT_EQ(kSearchString, result) | ||
131 | << "should return the original pointer"; | ||
132 | } | ||
133 | |||
134 | |||
135 | TEST_F(UnicodeTest, strstr16TargetEndOfString) { | ||
136 | const char16_t* result = strstr16(kSearchString, u"wind."); | ||
137 | EXPECT_EQ(kSearchString+19, result); | ||
138 | } | ||
139 | |||
140 | TEST_F(UnicodeTest, strstr16TargetWithinString) { | ||
141 | const char16_t* result = strstr16(kSearchString, u"leaf"); | ||
142 | EXPECT_EQ(kSearchString+7, result); | ||
143 | } | ||
144 | |||
145 | TEST_F(UnicodeTest, strstr16TargetNotPresent) { | ||
146 | const char16_t* result = strstr16(kSearchString, u"soar"); | ||
147 | EXPECT_EQ(nullptr, result); | ||
148 | } | ||
149 | |||
115 | } | 150 | } |