summaryrefslogtreecommitdiffstats
path: root/base/pickle_unittest.cc
diff options
context:
space:
mode:
authorrbyers@chromium.org <rbyers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-28 15:40:58 +0000
committerrbyers@chromium.org <rbyers@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-28 15:40:58 +0000
commitb1f61b03866ff2cccb0d9d07645d6780b719b0b9 (patch)
treea160789bccdf1da57ea8f444078ea1234aaf3f44 /base/pickle_unittest.cc
parentba2dda7f10ddc4d5559c0e608d2f78e49a9bb5af (diff)
downloadchromium_src-b1f61b03866ff2cccb0d9d07645d6780b719b0b9.zip
chromium_src-b1f61b03866ff2cccb0d9d07645d6780b719b0b9.tar.gz
chromium_src-b1f61b03866ff2cccb0d9d07645d6780b719b0b9.tar.bz2
Add support to Pickle for reading and writing floats
BUG=136034 Review URL: https://chromiumcodereview.appspot.com/11416150 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169957 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/pickle_unittest.cc')
-rw-r--r--base/pickle_unittest.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/base/pickle_unittest.cc b/base/pickle_unittest.cc
index 8cb1d2a1..c866acd 100644
--- a/base/pickle_unittest.cc
+++ b/base/pickle_unittest.cc
@@ -20,6 +20,7 @@ const int testdatalen = arraysize(testdata) - 1;
const bool testbool1 = false;
const bool testbool2 = true;
const uint16 testuint16 = 32123;
+const float testfloat = 3.1415926935f;
// checks that the result
void VerifyResult(const Pickle& pickle) {
@@ -47,6 +48,10 @@ void VerifyResult(const Pickle& pickle) {
EXPECT_TRUE(pickle.ReadUInt16(&iter, &outuint16));
EXPECT_EQ(testuint16, outuint16);
+ float outfloat;
+ EXPECT_TRUE(pickle.ReadFloat(&iter, &outfloat));
+ EXPECT_EQ(testfloat, outfloat);
+
const char* outdata;
int outdatalen;
EXPECT_TRUE(pickle.ReadData(&iter, &outdata, &outdatalen));
@@ -72,6 +77,7 @@ TEST(PickleTest, EncodeDecode) {
EXPECT_TRUE(pickle.WriteBool(testbool1));
EXPECT_TRUE(pickle.WriteBool(testbool2));
EXPECT_TRUE(pickle.WriteUInt16(testuint16));
+ EXPECT_TRUE(pickle.WriteFloat(testfloat));
EXPECT_TRUE(pickle.WriteData(testdata, testdatalen));
// Over allocate BeginWriteData so we can test TrimWriteData.