diff options
author | Steven Moreland <smoreland@google.com> | 2018-08-08 16:39:35 -0700 |
---|---|---|
committer | Steven Moreland <smoreland@google.com> | 2018-08-08 16:50:27 -0700 |
commit | 1b8981e972895d69eda3d6f96adf4581a450ee30 (patch) | |
tree | a156c6ee6e023967b965c3a818c5e6490af81e2d /base/parsedouble_test.cpp | |
parent | f41897a66e4e99cdda38c8150cd1cec543e2c393 (diff) | |
download | system_core-1b8981e972895d69eda3d6f96adf4581a450ee30.tar.gz system_core-1b8981e972895d69eda3d6f96adf4581a450ee30.tar.bz2 system_core-1b8981e972895d69eda3d6f96adf4581a450ee30.zip |
ParseDouble: allow validation only.
This change also updates documentation for Parse(Ui|I)nt functions
which recently had a corresponding change applied.
Bug: 110758329
Test: libbase_test
Change-Id: I4842c0500a6e49498eeb8a63d1117c06727fffdf
Diffstat (limited to 'base/parsedouble_test.cpp')
-rw-r--r-- | base/parsedouble_test.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/base/parsedouble_test.cpp b/base/parsedouble_test.cpp index 8734c4257..797a370bc 100644 --- a/base/parsedouble_test.cpp +++ b/base/parsedouble_test.cpp @@ -35,4 +35,9 @@ TEST(parsedouble, smoke) { ASSERT_FALSE(android::base::ParseDouble("3.0", &d, -1.0, 2.0)); ASSERT_TRUE(android::base::ParseDouble("1.0", &d, 0.0, 2.0)); ASSERT_DOUBLE_EQ(1.0, d); + + ASSERT_FALSE(android::base::ParseDouble("123.4x", nullptr)); + ASSERT_TRUE(android::base::ParseDouble("-123.4", nullptr)); + ASSERT_FALSE(android::base::ParseDouble("3.0", nullptr, -1.0, 2.0)); + ASSERT_TRUE(android::base::ParseDouble("1.0", nullptr, 0.0, 2.0)); } |