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

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

Issue 2771783003: Move wtf_unittests to platform/wtf/. (Closed)
Patch Set: Rebase. Created 3 years, 8 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
(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 "wtf/text/StringBuffer.h"
8
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace WTF {
12
13 TEST(StringBufferTest, Initial) {
14 StringBuffer<LChar> buf1;
15 EXPECT_EQ(0u, buf1.length());
16 EXPECT_FALSE(buf1.characters());
17
18 StringBuffer<LChar> buf2(0);
19 EXPECT_EQ(0u, buf2.length());
20 EXPECT_FALSE(buf2.characters());
21
22 StringBuffer<LChar> buf3(1);
23 EXPECT_EQ(1u, buf3.length());
24 EXPECT_TRUE(buf3.characters());
25 }
26
27 TEST(StringBufferTest, shrink) {
28 StringBuffer<LChar> buf(2);
29 EXPECT_EQ(2u, buf.length());
30 buf[0] = 'a';
31 buf[1] = 'b';
32
33 buf.shrink(1);
34 EXPECT_EQ(1u, buf.length());
35 EXPECT_EQ('a', buf[0]);
36
37 buf.shrink(0);
38 EXPECT_EQ(0u, buf.length());
39 }
40
41 } // namespace WTF
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698