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

Side by Side Diff: Source/wtf/VectorTest.cpp

Issue 654933004: Remove now-unnecessary VectorTraits specializations. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 EXPECT_EQ(3u, vectorB.size()); 279 EXPECT_EQ(3u, vectorB.size());
280 EXPECT_EQ(2, vectorB.at(0).get()); 280 EXPECT_EQ(2, vectorB.at(0).get());
281 EXPECT_EQ(3, vectorB.at(1).get()); 281 EXPECT_EQ(3, vectorB.at(1).get());
282 EXPECT_EQ(4, vectorB.at(2).get()); 282 EXPECT_EQ(4, vectorB.at(2).get());
283 283
284 vectorB.swap(vectorA); 284 vectorB.swap(vectorA);
285 } 285 }
286 286
287 class Comparable { 287 class Comparable {
288 }; 288 };
289 bool operator==(const Comparable& a, const Comparable& b) { return true; }
290 289
291 template<typename T> void compare() 290 template<typename T> void compare()
292 { 291 {
293 EXPECT_TRUE(Vector<T>() == Vector<T>()); 292 EXPECT_TRUE(Vector<T>() == Vector<T>());
294 EXPECT_FALSE(Vector<T>(1) == Vector<T>(0)); 293 EXPECT_FALSE(Vector<T>(1) == Vector<T>(0));
295 EXPECT_FALSE(Vector<T>() == Vector<T>(1)); 294 EXPECT_FALSE(Vector<T>() == Vector<T>(1));
296 EXPECT_TRUE(Vector<T>(1) == Vector<T>(1)); 295 EXPECT_TRUE(Vector<T>(1) == Vector<T>(1));
297 } 296 }
298 297
299 TEST(VectorTest, Compare) 298 TEST(VectorTest, Compare)
300 { 299 {
301 compare<int>(); 300 compare<int>();
302 compare<Comparable>(); 301 compare<Comparable>();
303 compare<WTF::String>(); 302 compare<WTF::String>();
304 } 303 }
304
305 class PODTest {
306 public:
307 Comparable m_struct;
308 WTF::WeakHandlingFlag m_enum;
309 };
310
311 TEST(VectorTest, Traits)
312 {
313 // FIXME: expand, test more types.
314 COMPILE_ASSERT(!WTF::VectorTraits<PODTest>::needsDestruction, ExpectedToHave ATrivialDestructor);
315 COMPILE_ASSERT(WTF::VectorTraits<PODTest>::canInitializeWithMemset, Expected ToBeInitializableWithMemset);
316 }
317
305 } // namespace 318 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698