| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 TEST(CanonicalizeCharacterSets) { | 1698 TEST(CanonicalizeCharacterSets) { |
| 1699 Zone zone; | 1699 Zone zone; |
| 1700 ZoneList<CharacterRange>* list = | 1700 ZoneList<CharacterRange>* list = |
| 1701 new(&zone) ZoneList<CharacterRange>(4, &zone); | 1701 new(&zone) ZoneList<CharacterRange>(4, &zone); |
| 1702 CharacterSet set(list); | 1702 CharacterSet set(list); |
| 1703 | 1703 |
| 1704 list->Add(CharacterRange(10, 20), &zone); | 1704 list->Add(CharacterRange(10, 20), &zone); |
| 1705 list->Add(CharacterRange(30, 40), &zone); | 1705 list->Add(CharacterRange(30, 40), &zone); |
| 1706 list->Add(CharacterRange(50, 60), &zone); | 1706 list->Add(CharacterRange(50, 60), &zone); |
| 1707 set.Canonicalize(); | 1707 set.Canonicalize(); |
| 1708 DCHECK_EQ(3, list->length()); | 1708 CHECK_EQ(3, list->length()); |
| 1709 DCHECK_EQ(10, list->at(0).from()); | 1709 CHECK_EQ(10, list->at(0).from()); |
| 1710 DCHECK_EQ(20, list->at(0).to()); | 1710 CHECK_EQ(20, list->at(0).to()); |
| 1711 DCHECK_EQ(30, list->at(1).from()); | 1711 CHECK_EQ(30, list->at(1).from()); |
| 1712 DCHECK_EQ(40, list->at(1).to()); | 1712 CHECK_EQ(40, list->at(1).to()); |
| 1713 DCHECK_EQ(50, list->at(2).from()); | 1713 CHECK_EQ(50, list->at(2).from()); |
| 1714 DCHECK_EQ(60, list->at(2).to()); | 1714 CHECK_EQ(60, list->at(2).to()); |
| 1715 | 1715 |
| 1716 list->Rewind(0); | 1716 list->Rewind(0); |
| 1717 list->Add(CharacterRange(10, 20), &zone); | 1717 list->Add(CharacterRange(10, 20), &zone); |
| 1718 list->Add(CharacterRange(50, 60), &zone); | 1718 list->Add(CharacterRange(50, 60), &zone); |
| 1719 list->Add(CharacterRange(30, 40), &zone); | 1719 list->Add(CharacterRange(30, 40), &zone); |
| 1720 set.Canonicalize(); | 1720 set.Canonicalize(); |
| 1721 DCHECK_EQ(3, list->length()); | 1721 CHECK_EQ(3, list->length()); |
| 1722 DCHECK_EQ(10, list->at(0).from()); | 1722 CHECK_EQ(10, list->at(0).from()); |
| 1723 DCHECK_EQ(20, list->at(0).to()); | 1723 CHECK_EQ(20, list->at(0).to()); |
| 1724 DCHECK_EQ(30, list->at(1).from()); | 1724 CHECK_EQ(30, list->at(1).from()); |
| 1725 DCHECK_EQ(40, list->at(1).to()); | 1725 CHECK_EQ(40, list->at(1).to()); |
| 1726 DCHECK_EQ(50, list->at(2).from()); | 1726 CHECK_EQ(50, list->at(2).from()); |
| 1727 DCHECK_EQ(60, list->at(2).to()); | 1727 CHECK_EQ(60, list->at(2).to()); |
| 1728 | 1728 |
| 1729 list->Rewind(0); | 1729 list->Rewind(0); |
| 1730 list->Add(CharacterRange(30, 40), &zone); | 1730 list->Add(CharacterRange(30, 40), &zone); |
| 1731 list->Add(CharacterRange(10, 20), &zone); | 1731 list->Add(CharacterRange(10, 20), &zone); |
| 1732 list->Add(CharacterRange(25, 25), &zone); | 1732 list->Add(CharacterRange(25, 25), &zone); |
| 1733 list->Add(CharacterRange(100, 100), &zone); | 1733 list->Add(CharacterRange(100, 100), &zone); |
| 1734 list->Add(CharacterRange(1, 1), &zone); | 1734 list->Add(CharacterRange(1, 1), &zone); |
| 1735 set.Canonicalize(); | 1735 set.Canonicalize(); |
| 1736 DCHECK_EQ(5, list->length()); | 1736 CHECK_EQ(5, list->length()); |
| 1737 DCHECK_EQ(1, list->at(0).from()); | 1737 CHECK_EQ(1, list->at(0).from()); |
| 1738 DCHECK_EQ(1, list->at(0).to()); | 1738 CHECK_EQ(1, list->at(0).to()); |
| 1739 DCHECK_EQ(10, list->at(1).from()); | 1739 CHECK_EQ(10, list->at(1).from()); |
| 1740 DCHECK_EQ(20, list->at(1).to()); | 1740 CHECK_EQ(20, list->at(1).to()); |
| 1741 DCHECK_EQ(25, list->at(2).from()); | 1741 CHECK_EQ(25, list->at(2).from()); |
| 1742 DCHECK_EQ(25, list->at(2).to()); | 1742 CHECK_EQ(25, list->at(2).to()); |
| 1743 DCHECK_EQ(30, list->at(3).from()); | 1743 CHECK_EQ(30, list->at(3).from()); |
| 1744 DCHECK_EQ(40, list->at(3).to()); | 1744 CHECK_EQ(40, list->at(3).to()); |
| 1745 DCHECK_EQ(100, list->at(4).from()); | 1745 CHECK_EQ(100, list->at(4).from()); |
| 1746 DCHECK_EQ(100, list->at(4).to()); | 1746 CHECK_EQ(100, list->at(4).to()); |
| 1747 | 1747 |
| 1748 list->Rewind(0); | 1748 list->Rewind(0); |
| 1749 list->Add(CharacterRange(10, 19), &zone); | 1749 list->Add(CharacterRange(10, 19), &zone); |
| 1750 list->Add(CharacterRange(21, 30), &zone); | 1750 list->Add(CharacterRange(21, 30), &zone); |
| 1751 list->Add(CharacterRange(20, 20), &zone); | 1751 list->Add(CharacterRange(20, 20), &zone); |
| 1752 set.Canonicalize(); | 1752 set.Canonicalize(); |
| 1753 DCHECK_EQ(1, list->length()); | 1753 CHECK_EQ(1, list->length()); |
| 1754 DCHECK_EQ(10, list->at(0).from()); | 1754 CHECK_EQ(10, list->at(0).from()); |
| 1755 DCHECK_EQ(30, list->at(0).to()); | 1755 CHECK_EQ(30, list->at(0).to()); |
| 1756 } | 1756 } |
| 1757 | 1757 |
| 1758 | 1758 |
| 1759 TEST(CharacterRangeMerge) { | 1759 TEST(CharacterRangeMerge) { |
| 1760 Zone zone; | 1760 Zone zone; |
| 1761 ZoneList<CharacterRange> l1(4, &zone); | 1761 ZoneList<CharacterRange> l1(4, &zone); |
| 1762 ZoneList<CharacterRange> l2(4, &zone); | 1762 ZoneList<CharacterRange> l2(4, &zone); |
| 1763 // Create all combinations of intersections of ranges, both singletons and | 1763 // Create all combinations of intersections of ranges, both singletons and |
| 1764 // longer. | 1764 // longer. |
| 1765 | 1765 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 // YYYY Y YYYY Y YYYY Y YYYY Y YYYY Y YYYY Y | 1827 // YYYY Y YYYY Y YYYY Y YYYY Y YYYY Y YYYY Y |
| 1828 | 1828 |
| 1829 l1.Add(CharacterRange::Range(offset, offset + 21), &zone); | 1829 l1.Add(CharacterRange::Range(offset, offset + 21), &zone); |
| 1830 l1.Add(CharacterRange::Range(offset + 31, offset + 52), &zone); | 1830 l1.Add(CharacterRange::Range(offset + 31, offset + 52), &zone); |
| 1831 for (int i = 0; i < 6; i++) { | 1831 for (int i = 0; i < 6; i++) { |
| 1832 l2.Add(CharacterRange::Range(offset + 2, offset + 5), &zone); | 1832 l2.Add(CharacterRange::Range(offset + 2, offset + 5), &zone); |
| 1833 l2.Add(CharacterRange::Singleton(offset + 8), &zone); | 1833 l2.Add(CharacterRange::Singleton(offset + 8), &zone); |
| 1834 offset += 9; | 1834 offset += 9; |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 DCHECK(CharacterRange::IsCanonical(&l1)); | 1837 CHECK(CharacterRange::IsCanonical(&l1)); |
| 1838 DCHECK(CharacterRange::IsCanonical(&l2)); | 1838 CHECK(CharacterRange::IsCanonical(&l2)); |
| 1839 | 1839 |
| 1840 ZoneList<CharacterRange> first_only(4, &zone); | 1840 ZoneList<CharacterRange> first_only(4, &zone); |
| 1841 ZoneList<CharacterRange> second_only(4, &zone); | 1841 ZoneList<CharacterRange> second_only(4, &zone); |
| 1842 ZoneList<CharacterRange> both(4, &zone); | 1842 ZoneList<CharacterRange> both(4, &zone); |
| 1843 } | 1843 } |
| 1844 | 1844 |
| 1845 | 1845 |
| 1846 TEST(Graph) { | 1846 TEST(Graph) { |
| 1847 Execute("\\b\\w+\\b", false, true, true); | 1847 Execute("\\b\\w+\\b", false, true, true); |
| 1848 } | 1848 } |
| OLD | NEW |