Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(635)

Side by Side Diff: Source/wtf/text/StringBufferTest.cpp

Issue 520723002: Stop inlining StringBuffer<CharType>::shrink(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: StringBuffer::shrink(). Warnings signed 0 compared to unsigned length. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/wtf/text/StringBuffer.h ('k') | Source/wtf/wtf.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 The Chromium Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7 #include "config.h"
8
9 #include "wtf/text/StringBuffer.h"
10
11 #include <gtest/gtest.h>
12
13 namespace {
14
15
16 TEST(StringBuffer, Initial)
17 {
18 StringBuffer<LChar> buf1;
19 EXPECT_EQ(0u, buf1.length());
20 EXPECT_FALSE(buf1.characters());
21
22 StringBuffer<LChar> buf2(0);
23 EXPECT_EQ(0u, buf2.length());
24 EXPECT_FALSE(buf2.characters());
25
26 StringBuffer<LChar> buf3(1);
27 EXPECT_EQ(1u, buf3.length());
28 EXPECT_TRUE(buf3.characters());
29 }
30
31 TEST(StringBuffer, shrink)
32 {
33 StringBuffer<LChar> buf(2);
34 EXPECT_EQ(2u, buf.length());
35 buf[0] = 'a';
36 buf[1] = 'b';
37
38 buf.shrink(1);
39 EXPECT_EQ(1u, buf.length());
40 EXPECT_EQ('a', buf[0]);
41
42 buf.shrink(0);
43 EXPECT_EQ(0u, buf.length());
44 }
45
46 } // namespace
OLDNEW
« no previous file with comments | « Source/wtf/text/StringBuffer.h ('k') | Source/wtf/wtf.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698