Commit ada7babc authored by Michael Lee's avatar Michael Lee Committed by facebook-github-bot-4

Turn off a FBStringTest for Android.

Summary:
The wstring support on KitKat is not exactly working.  Works
on Lollipop though.

Reviewed By: markisaa

Differential Revision: D2901732

fb-gh-sync-id: 97b57fb4d8c645192be62dca25d8fb1b2397ad7d
parent 6bfc6869
...@@ -981,9 +981,13 @@ template <class String> void clause11_21_4_8_9_a(String & test) { ...@@ -981,9 +981,13 @@ template <class String> void clause11_21_4_8_9_a(String & test) {
TEST(FBString, testAllClauses) { TEST(FBString, testAllClauses) {
EXPECT_TRUE(1) << "Starting with seed: " << seed; EXPECT_TRUE(1) << "Starting with seed: " << seed;
std::string r; std::string r;
std::wstring wr;
folly::fbstring c; folly::fbstring c;
#ifndef __ANDROID__
// Disabled on Android: wchar support is not recommended and does not
// always behave as expected
std::wstring wr;
folly::basic_fbstring<wchar_t> wc; folly::basic_fbstring<wchar_t> wc;
#endif
int count = 0; int count = 0;
auto l = [&](const char * const clause, auto l = [&](const char * const clause,
...@@ -995,8 +999,10 @@ TEST(FBString, testAllClauses) { ...@@ -995,8 +999,10 @@ TEST(FBString, testAllClauses) {
randomString(&r); randomString(&r);
c = r; c = r;
EXPECT_EQ(c, r); EXPECT_EQ(c, r);
#ifndef __ANDROID__
wr = std::wstring(r.begin(), r.end()); wr = std::wstring(r.begin(), r.end());
wc = folly::basic_fbstring<wchar_t>(wr.c_str()); wc = folly::basic_fbstring<wchar_t>(wr.c_str());
#endif
auto localSeed = seed + count; auto localSeed = seed + count;
rng = RandomT(localSeed); rng = RandomT(localSeed);
f_string(r); f_string(r);
...@@ -1006,6 +1012,7 @@ TEST(FBString, testAllClauses) { ...@@ -1006,6 +1012,7 @@ TEST(FBString, testAllClauses) {
<< "Lengths: " << r.size() << " vs. " << c.size() << "Lengths: " << r.size() << " vs. " << c.size()
<< "\nReference: '" << r << "'" << "\nReference: '" << r << "'"
<< "\nActual: '" << c.data()[0] << "'"; << "\nActual: '" << c.data()[0] << "'";
#ifndef __ANDROID__
rng = RandomT(localSeed); rng = RandomT(localSeed);
f_wfbstring(wc); f_wfbstring(wc);
int wret = wcslen(wc.c_str()); int wret = wcslen(wc.c_str());
...@@ -1016,6 +1023,7 @@ TEST(FBString, testAllClauses) { ...@@ -1016,6 +1023,7 @@ TEST(FBString, testAllClauses) {
std::string one(mb); std::string one(mb);
std::string two(mc); std::string two(mc);
EXPECT_EQ(one, two); EXPECT_EQ(one, two);
#endif
} while (++count % 100 != 0); } while (++count % 100 != 0);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment