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

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

Issue 1611343002: wtf reformat test Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pydent Created 4 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 The Chromium Authors. All rights reserved. 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 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 6
7 #include "wtf/text/StringBuffer.h" 7 #include "wtf/text/StringBuffer.h"
8 8
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace WTF { 11 namespace WTF {
12 12
13 TEST(StringBufferTest, Initial) 13 TEST(StringBufferTest, Initial) {
14 { 14 StringBuffer<LChar> buf1;
15 StringBuffer<LChar> buf1; 15 EXPECT_EQ(0u, buf1.length());
16 EXPECT_EQ(0u, buf1.length()); 16 EXPECT_FALSE(buf1.characters());
17 EXPECT_FALSE(buf1.characters());
18 17
19 StringBuffer<LChar> buf2(0); 18 StringBuffer<LChar> buf2(0);
20 EXPECT_EQ(0u, buf2.length()); 19 EXPECT_EQ(0u, buf2.length());
21 EXPECT_FALSE(buf2.characters()); 20 EXPECT_FALSE(buf2.characters());
22 21
23 StringBuffer<LChar> buf3(1); 22 StringBuffer<LChar> buf3(1);
24 EXPECT_EQ(1u, buf3.length()); 23 EXPECT_EQ(1u, buf3.length());
25 EXPECT_TRUE(buf3.characters()); 24 EXPECT_TRUE(buf3.characters());
26 } 25 }
27 26
28 TEST(StringBufferTest, shrink) 27 TEST(StringBufferTest, shrink) {
29 { 28 StringBuffer<LChar> buf(2);
30 StringBuffer<LChar> buf(2); 29 EXPECT_EQ(2u, buf.length());
31 EXPECT_EQ(2u, buf.length()); 30 buf[0] = 'a';
32 buf[0] = 'a'; 31 buf[1] = 'b';
33 buf[1] = 'b';
34 32
35 buf.shrink(1); 33 buf.shrink(1);
36 EXPECT_EQ(1u, buf.length()); 34 EXPECT_EQ(1u, buf.length());
37 EXPECT_EQ('a', buf[0]); 35 EXPECT_EQ('a', buf[0]);
38 36
39 buf.shrink(0); 37 buf.shrink(0);
40 EXPECT_EQ(0u, buf.length()); 38 EXPECT_EQ(0u, buf.length());
41 } 39 }
42 40
43 } // namespace WTF 41 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/text/StringBuffer.h ('k') | third_party/WebKit/Source/wtf/text/StringBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698