Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / platform / WebVectorTest.cpp
blobe103c38e104af6cf170945067ad0eab085ef5ba8
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "config.h"
6 #include "public/platform/WebVector.h"
8 #include "wtf/Vector.h"
9 #include <gtest/gtest.h>
11 namespace blink {
13 TEST(WebVectorTest, beginend)
15 Vector<int> input;
16 for (int i = 0; i < 5; ++i)
17 input.append(i);
19 WebVector<int> webVector(input);
20 ASSERT_EQ(input.size(), webVector.size());
22 EXPECT_EQ(webVector.data(), webVector.begin());
23 EXPECT_EQ(webVector.data() + webVector.size(), webVector.end());
25 // Use begin()/end() iterators directly.
26 Vector<int> output;
27 for (WebVector<int>::iterator it = webVector.begin(); it != webVector.end(); ++it)
28 output.append(*it);
29 ASSERT_EQ(input.size(), output.size());
30 for (size_t i = 0; i < input.size(); ++i)
31 EXPECT_EQ(input[i], output[i]);
33 // Use begin()/end() const_iterators directly.
34 output.clear();
35 const WebVector<int>& constWebVector = webVector;
36 for (WebVector<int>::const_iterator it = constWebVector.begin(); it != constWebVector.end(); ++it)
37 output.append(*it);
38 ASSERT_EQ(input.size(), output.size());
39 for (size_t i = 0; i < input.size(); ++i)
40 EXPECT_EQ(input[i], output[i]);
42 // Use range-based for loop.
43 output.clear();
44 for (int x : webVector)
45 output.append(x);
46 ASSERT_EQ(input.size(), output.size());
47 for (size_t i = 0; i < input.size(); ++i)
48 EXPECT_EQ(input[i], output[i]);
51 } // namespace blink