| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 | 1509 |
| 1510 Deque<ShouldBeTraced> m_deque1; | 1510 Deque<ShouldBeTraced> m_deque1; |
| 1511 Vector<ShouldBeTraced> m_vector1; | 1511 Vector<ShouldBeTraced> m_vector1; |
| 1512 Deque<Member<IntWrapper> > m_deque2; | 1512 Deque<Member<IntWrapper> > m_deque2; |
| 1513 Vector<Member<IntWrapper> > m_vector2; | 1513 Vector<Member<IntWrapper> > m_vector2; |
| 1514 HashSet<Member<IntWrapper> > m_hashSet; | 1514 HashSet<Member<IntWrapper> > m_hashSet; |
| 1515 HashMap<void*, Member<IntWrapper> > m_hashMap; | 1515 HashMap<void*, Member<IntWrapper> > m_hashMap; |
| 1516 ListHashSet<Member<IntWrapper> > m_listHashSet; | 1516 ListHashSet<Member<IntWrapper> > m_listHashSet; |
| 1517 }; | 1517 }; |
| 1518 | 1518 |
| 1519 TEST(HeapTest, HeapVectorFilledWithValue) |
| 1520 { |
| 1521 IntWrapper* val = IntWrapper::create(1); |
| 1522 HeapVector<Member<IntWrapper> > vector(10, val); |
| 1523 EXPECT_EQ(10u, vector.size()); |
| 1524 for (size_t i = 0; i < vector.size(); i++) |
| 1525 EXPECT_EQ(val, vector[i]); |
| 1526 } |
| 1527 |
| 1519 TEST(HeapTest, HeapVectorWithInlineCapacity) | 1528 TEST(HeapTest, HeapVectorWithInlineCapacity) |
| 1520 { | 1529 { |
| 1521 IntWrapper* one = IntWrapper::create(1); | 1530 IntWrapper* one = IntWrapper::create(1); |
| 1522 IntWrapper* two = IntWrapper::create(2); | 1531 IntWrapper* two = IntWrapper::create(2); |
| 1523 IntWrapper* three = IntWrapper::create(3); | 1532 IntWrapper* three = IntWrapper::create(3); |
| 1524 IntWrapper* four = IntWrapper::create(4); | 1533 IntWrapper* four = IntWrapper::create(4); |
| 1525 IntWrapper* five = IntWrapper::create(5); | 1534 IntWrapper* five = IntWrapper::create(5); |
| 1526 IntWrapper* six = IntWrapper::create(6); | 1535 IntWrapper* six = IntWrapper::create(6); |
| 1527 { | 1536 { |
| 1528 HeapVector<Member<IntWrapper>, 2> vector; | 1537 HeapVector<Member<IntWrapper>, 2> vector; |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2263 it->value.append(IntWrapper::create(42)); | 2272 it->value.append(IntWrapper::create(42)); |
| 2264 EXPECT_EQ(1u, map->get(key).size()); | 2273 EXPECT_EQ(1u, map->get(key).size()); |
| 2265 | 2274 |
| 2266 Persistent<HeapHashMap<void*, IntVector> > keepAlive(map); | 2275 Persistent<HeapHashMap<void*, IntVector> > keepAlive(map); |
| 2267 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 2276 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 2268 EXPECT_EQ(1u, map->get(key).size()); | 2277 EXPECT_EQ(1u, map->get(key).size()); |
| 2269 EXPECT_EQ(0, IntWrapper::s_destructorCalls); | 2278 EXPECT_EQ(0, IntWrapper::s_destructorCalls); |
| 2270 } | 2279 } |
| 2271 | 2280 |
| 2272 } // namespace | 2281 } // namespace |
| OLD | NEW |