| OLD | NEW |
| 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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 } | 596 } |
| 597 | 597 |
| 598 // Only odd numbers left. | 598 // Only odd numbers left. |
| 599 { | 599 { |
| 600 int i = 1; | 600 int i = 1; |
| 601 for (int v : deque) | 601 for (int v : deque) |
| 602 EXPECT_EQ(i + 2, v); | 602 EXPECT_EQ(i + 2, v); |
| 603 } | 603 } |
| 604 } | 604 } |
| 605 | 605 |
| 606 struct Item { |
| 607 Item(int value1, int value2) : value1(value1), value2(value2) {} |
| 608 int value1; |
| 609 int value2; |
| 610 }; |
| 611 |
| 612 TEST(DequeTest, emplace_back) { |
| 613 Deque<Item> deque; |
| 614 deque.emplace_back(1, 2); |
| 615 deque.emplace_back(3, 4); |
| 616 |
| 617 EXPECT_EQ(2u, deque.size()); |
| 618 EXPECT_EQ(1, deque[0].value1); |
| 619 EXPECT_EQ(2, deque[0].value2); |
| 620 EXPECT_EQ(3, deque[1].value1); |
| 621 EXPECT_EQ(4, deque[1].value2); |
| 622 } |
| 623 |
| 624 TEST(DequeTest, emplace_front) { |
| 625 Deque<Item> deque; |
| 626 deque.emplace_front(1, 2); |
| 627 deque.emplace_front(3, 4); |
| 628 |
| 629 EXPECT_EQ(2u, deque.size()); |
| 630 EXPECT_EQ(3, deque[0].value1); |
| 631 EXPECT_EQ(4, deque[0].value2); |
| 632 EXPECT_EQ(1, deque[1].value1); |
| 633 EXPECT_EQ(2, deque[1].value2); |
| 634 } |
| 635 |
| 606 } // anonymous namespace | 636 } // anonymous namespace |
| 607 | 637 |
| 608 } // namespace WTF | 638 } // namespace WTF |
| OLD | NEW |