diff options
author | Josh Gao <jmgao@google.com> | 2020-03-31 01:53:01 -0700 |
---|---|---|
committer | Josh Gao <jmgao@google.com> | 2020-04-02 17:11:07 -0700 |
commit | d11b5091fa26f11aa1f91446a6540e81188a86a6 (patch) | |
tree | 1d21cc54f54fcf1948ec10199f7fdc4ae1a402e5 /types_test.cpp | |
parent | bfcd8ffb4cc435775ef08c81b8c9b282e2d2c9d5 (diff) | |
download | adb-d11b5091fa26f11aa1f91446a6540e81188a86a6.tar.gz |
adb: fix front_size, front_data.
Bug: https://issuetracker.google.com/150827486
Test: adb_test
Change-Id: I3d2c73a20a703d793efb56e592cf33149815f89b
Diffstat (limited to 'types_test.cpp')
-rw-r--r-- | types_test.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/types_test.cpp b/types_test.cpp index 2c99f951..41fa1db2 100644 --- a/types_test.cpp +++ b/types_test.cpp @@ -117,3 +117,20 @@ TEST(IOVector, misaligned_split) { ASSERT_EQ(1ULL, bc.size()); ASSERT_EQ(create_block("x"), bc.coalesce()); } + +TEST(IOVector, drop_front) { + IOVector vec; + + vec.append(create_block('x', 2)); + vec.append(create_block('y', 1000)); + ASSERT_EQ(2U, vec.front_size()); + ASSERT_EQ(1002U, vec.size()); + + vec.drop_front(1); + ASSERT_EQ(1U, vec.front_size()); + ASSERT_EQ(1001U, vec.size()); + + vec.drop_front(1); + ASSERT_EQ(1000U, vec.front_size()); + ASSERT_EQ(1000U, vec.size()); +} |