OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 ++i; | 207 ++i; |
208 } | 208 } |
209 i = 0; | 209 i = 0; |
210 for (auto& e : ArrayView<const char>(av)) { | 210 for (auto& e : ArrayView<const char>(av)) { |
211 EXPECT_EQ(arr + i, &e); | 211 EXPECT_EQ(arr + i, &e); |
212 // e = 'q' + i; // Compile error, because e is a const char&. | 212 // e = 'q' + i; // Compile error, because e is a const char&. |
213 ++i; | 213 ++i; |
214 } | 214 } |
215 } | 215 } |
216 | 216 |
217 TEST(ArrayViewTest, TestEmpty) { | |
218 EXPECT_TRUE(ArrayView<int>().empty()); | |
219 const int a[] = {1, 2, 3}; | |
220 EXPECT_FALSE(ArrayView<const int>(a).empty()); | |
221 } | |
222 | |
223 TEST(ArrayViewTest, TestCompare) { | |
hlundin-webrtc
2015/11/05 15:22:28
Is it conceivable to have two ArrayViews with the
kwiberg-webrtc
2015/11/05 19:00:07
Yes, that's of course entirely possible. Will add
| |
224 int a[] = {1, 2, 3}; | |
225 int b[] = {1, 2, 3}; | |
226 EXPECT_EQ(ArrayView<int>(a), ArrayView<int>(a)); | |
227 EXPECT_EQ(ArrayView<int>(), ArrayView<int>()); | |
228 EXPECT_NE(ArrayView<int>(a), ArrayView<int>(b)); | |
229 EXPECT_NE(ArrayView<int>(a), ArrayView<int>()); | |
230 } | |
231 | |
217 } // namespace rtc | 232 } // namespace rtc |
OLD | NEW |