Skip to content

Commit 692a1e9

Browse files
authored
fix:amaZon -> amazon (#324)
1 parent 5e377d0 commit 692a1e9

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

src/ada_idna.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2635,7 +2635,7 @@ bool ascii_has_upper_case(char* input, size_t length) {
26352635
auto broadcast = [](uint8_t v) -> uint64_t { return 0x101010101010101 * v; };
26362636
uint64_t broadcast_80 = broadcast(0x80);
26372637
uint64_t broadcast_Ap = broadcast(128 - 'A');
2638-
uint64_t broadcast_Zp = broadcast(128 - 'Z');
2638+
uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
26392639
size_t i = 0;
26402640

26412641
uint64_t runner{0};
@@ -2657,7 +2657,7 @@ void ascii_map(char* input, size_t length) {
26572657
auto broadcast = [](uint8_t v) -> uint64_t { return 0x101010101010101 * v; };
26582658
uint64_t broadcast_80 = broadcast(0x80);
26592659
uint64_t broadcast_Ap = broadcast(128 - 'A');
2660-
uint64_t broadcast_Zp = broadcast(128 - 'Z');
2660+
uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
26612661
size_t i = 0;
26622662

26632663
for (; i + 7 < length; i += 8) {

src/unicode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ constexpr bool to_lower_ascii(char* input, size_t length) noexcept {
1515
auto broadcast = [](uint8_t v) -> uint64_t { return 0x101010101010101 * v; };
1616
uint64_t broadcast_80 = broadcast(0x80);
1717
uint64_t broadcast_Ap = broadcast(128 - 'A');
18-
uint64_t broadcast_Zp = broadcast(128 - 'Z');
18+
uint64_t broadcast_Zp = broadcast(128 - 'Z' - 1);
1919
uint64_t non_ascii = 0;
2020
size_t i = 0;
2121

tests/basic_tests.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,20 @@ bool default_port_should_be_removed() {
287287
TEST_SUCCEED()
288288
}
289289

290+
template <class result>
291+
bool test_amazon() {
292+
TEST_START()
293+
auto url = ada::parse<result>("HTTP://AMAZON.COM");
294+
if (!url) {
295+
TEST_FAIL("Should succeed");
296+
}
297+
298+
TEST_ASSERT(url->get_href(), "http://amazon.com/",
299+
"should be all lower case");
300+
TEST_SUCCEED()
301+
}
302+
303+
290304
template <class result>
291305
bool remove_username() {
292306
TEST_START()
@@ -424,7 +438,7 @@ bool all_tests() {
424438
readme1<result>() && readme2<result>() && readme3<result>() &&
425439
readme4<result>() && readme5<result>() && readme6<result>() &&
426440
readme7<result>() && nodejs1<result>() && nodejs2<result>() &&
427-
nodejs3<result>() && nodejs4<result>();
441+
nodejs3<result>() && nodejs4<result>() && test_amazon<result>();
428442
}
429443

430444
int main() {

0 commit comments

Comments
 (0)