| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 CHECK_EQ(canonicalize(lower), canonicalize(upper)); | 727 CHECK_EQ(canonicalize(lower), canonicalize(upper)); |
| 728 unibrow::uchar uncanon[unibrow::kMaxMappingSize]; | 728 unibrow::uchar uncanon[unibrow::kMaxMappingSize]; |
| 729 int length = un_canonicalize.get(lower, '\0', uncanon); | 729 int length = un_canonicalize.get(lower, '\0', uncanon); |
| 730 CHECK_EQ(2, length); | 730 CHECK_EQ(2, length); |
| 731 CHECK_EQ(upper, uncanon[0]); | 731 CHECK_EQ(upper, uncanon[0]); |
| 732 CHECK_EQ(lower, uncanon[1]); | 732 CHECK_EQ(lower, uncanon[1]); |
| 733 } | 733 } |
| 734 for (uc32 c = 128; c < (1 << 21); c++) { | 734 for (uc32 c = 128; c < (1 << 21); c++) { |
| 735 // These exceptions are caused by a known bug in the implementation. | 735 // These exceptions are caused by a known bug in the implementation. |
| 736 if (c != 0x026B && c != 0x027D) | 736 if (c != 0x026B && c != 0x027D) |
| 737 CHECK(canonicalize(c) >= 128); | 737 CHECK_GE(canonicalize(c), 128); |
| 738 } | 738 } |
| 739 unibrow::Mapping<unibrow::ToUppercase> to_upper; | 739 unibrow::Mapping<unibrow::ToUppercase> to_upper; |
| 740 for (uc32 c = 0; c < (1 << 21); c++) { | 740 for (uc32 c = 0; c < (1 << 21); c++) { |
| 741 if (c == 0x026B || c == 0x027D) continue; | 741 if (c == 0x026B || c == 0x027D) continue; |
| 742 unibrow::uchar upper[unibrow::kMaxMappingSize]; | 742 unibrow::uchar upper[unibrow::kMaxMappingSize]; |
| 743 int length = to_upper.get(c, '\0', upper); | 743 int length = to_upper.get(c, '\0', upper); |
| 744 if (length == 0) { | 744 if (length == 0) { |
| 745 length = 1; | 745 length = 1; |
| 746 upper[0] = c; | 746 upper[0] = c; |
| 747 } | 747 } |
| 748 uc32 u = upper[0]; | 748 uc32 u = upper[0]; |
| 749 if (length > 1 || (c >= 128 && u < 128)) | 749 if (length > 1 || (c >= 128 && u < 128)) |
| 750 u = c; | 750 u = c; |
| 751 if (u != canonicalize(c)) | 751 if (u != canonicalize(c)) |
| 752 printf("%x\n", c); | 752 printf("%x\n", c); |
| 753 CHECK_EQ(u, canonicalize(c)); | 753 CHECK_EQ(u, canonicalize(c)); |
| 754 } | 754 } |
| 755 } | 755 } |
| 756 | 756 |
| 757 | 757 |
| 758 TEST(Graph) { | 758 TEST(Graph) { |
| 759 Execute("fo[ob]ar|[ba]z|x[yz]*", "", true); | 759 Execute("fo[ob]ar|[ba]z|x[yz]*", "", true); |
| 760 } | 760 } |
| OLD | NEW |