forked from twitter/twitter-text
-
Notifications
You must be signed in to change notification settings - Fork 1
/
validate.yml
696 lines (599 loc) ยท 56.8 KB
/
validate.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
tests:
tweets:
- description: "Valid Tweet: < 20 characters"
text: "I am a Tweet"
expected: true
- description: "Valid Tweet: 140 characters"
text: "A lie gets halfway around the world before the truth has a chance to get its pants on. Winston Churchill (1874-1965) http://bit.ly/dJpywL"
expected: true
- description: "Valid Tweet: 140 characters (with accents)"
text: "A liรฉ gรฉts halfway arรธรผnd thรฉ wรธrld bรฉfรธrรฉ thรฉ truth has a chance tรธ get its pants รธn. Winston Churchill (1874-1965) http://bit.ly/dJpywL"
expected: true
- description: "Valid Tweet: 140 characters (double byte characters)"
text: "ใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎใฎ"
expected: true
- description: "Valid Tweet: 140 characters (double word characters)"
text: "\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431\U0001f431"
expected: true
- description: "Invalid Tweet: no characters (empty)"
text: ""
expected: false
- description: "Invalid Tweet: 141 characters"
text: "A lie gets halfway around the world before the truth has a chance to get its pants on. -- Winston Churchill (1874-1965) http://bit.ly/dJpywL"
expected: false
- description: "Invalid Tweet: 141 characters (due to newline)"
text: "A lie gets halfway around the world before the truth has a chance to get its pants on. \n- Winston Churchill (1874-1965) http://bit.ly/dJpywL"
expected: false
usernames:
- description: "Valid username: a-z < 20 characters"
text: "@username"
expected: true
- description: "All numeric username are allowed"
text: "@12345"
expected: true
- description: "Usernames should allow the _ character"
text: "@example_name"
expected: true
- description: "Usernames SHOULD NOT allow the - character"
text: "@example-name"
expected: false
lists:
- description: "Valid list: a-z < 20 characters"
text: "@username/list"
expected: true
- description: "A username alone SHOULD NOT be considered a valid list"
text: "@username"
expected: false
- description: "A username followed by a slash SHOULD NOT be considered a valid list"
text: "@username/"
expected: false
- description: "Validation SHOULD NOT allow leading spaces"
text: " @username/list"
expected: false
- description: "Validation SHOULD NOT allow trailing spaces"
text: "@username/list "
expected: false
hashtags:
- description: "Valid hashtag: a-z < 20 characters"
text: "#hashtag"
expected: true
- description: "Valid hashtag: number followed by letters"
text: "#1st"
expected: true
- description: "Valid hashtag: letters and numbers mixed"
text: "#that1time"
expected: true
- description: "Valid hashtag: letter followed by numbers"
text: "#easyas123"
expected: true
- description: "Invalid hashtag: all numbers"
text: "#12345"
expected: false
- description: "Valid hashtag: Russian text"
text: "#ะฐัะพะบ"
expected: true
- description: "Valid hashtag: Korean text"
text: "#ํธ์ํฐ"
expected: true
urls:
- description: "Valid url: protocol + domain"
text: "http://example.com"
expected: true
- description: "Valid url: ssl + domain + path + query"
text: "https://example.com/path/to/resource?search=foo&lang=en"
expected: true
- description: "Valid url: protocol + domain + path + fragment"
text: "http://twitter.com/#!/twitter"
expected: true
- description: "Valid url: cased protocol and domain"
text: "HTTPS://www.ExaMPLE.COM/index.html"
expected: true
- description: "Valid url: port and userinfo"
text: "http://user:[email protected]:8080/login.php"
expected: true
- description: "Valid url: matrix path parameters"
text: "http://sports.yahoo.com/nfl/news;_ylt=Aom0;ylu=XyZ?slug=ap-superbowlnotebook"
expected: true
- description: "Valid url: ipv4"
text: "http://192.168.0.1/index.html?src=asdf"
expected: true
- description: "Valid url: ipv6"
text: "http://[3ffe:1900:4545:3:200:f8ff:fe21:67cf]:80/index.html"
expected: true
- description: "Valid url: underscore in subdomain"
text: "http://test_underscore.twitter.com"
expected: true
- description: "Valid url: sub delims and question marks"
text: "http://example.com?foo=$bar.;baz?BAZ&c=d-#top/?stories+"
expected: true
- description: "Valid unicode url: unicode domain"
text: "http://โ.net/"
expected: true
- description: "Valid url: Cyrillic characters in path"
text: "http://example.com/ะ ัััะบะธะต_ัะปะพะฒะฐ"
expected: true
- description: "Valid url: trailing hyphen"
text: "https://www.youtube.com/playlist?list=PL0ZPu8XSRTB7wZzn0mLHMvyzVFeRxbWn-"
expected: true
- description: "Invalid url: invalid scheme"
text: "ftp://www.example.com/"
expected: false
- description: "Invalid url: invalid userinfo characters"
text: "https://user:pass[word]@www.example.com/"
expected: false
- description: "Invalid url: underscore in domain"
text: "http://domain-dash_2314352345_dfasd.foo-cow_4352.com"
expected: false
- description: "Invalid url: domain beginning dash"
text: "http://www.-domain4352.com/"
expected: false
- description: "Invalid url: domain trailing dash"
text: "http://www.domain4352-.com/"
expected: false
- description: "Invalid url: unicode domain trailing dash"
text: "http://โ-.net/"
expected: false
- description: "Invalid url: improperly encoded unicode domain"
text: "http://%e2%98%83.net/"
expected: false
- description: "Invalid url: invalid IP"
text: "http://256.1.2.3/"
expected: false
- description: "Invalid url: invalid char in path"
text: "http://en.wikipedia.org/wiki/\"#Punctuation"
expected: false
- description: "Invalid url: trailing space"
text: "http://example.com/#anchor "
expected: false
- description: "Invalid url: domain has leading hyphen"
text: "http://test.-twitter.com"
expected: false
urls_without_protocol:
- description: "Valid url without protocol: domain + gTLD"
text: "example.com"
expected: true
- description: "Valid url without protocol: subdomain + domain + gTLD"
text: "www.example.com"
expected: true
- description: "Valid url without protocol: domain + ccTLD"
text: "t.co"
expected: true
- description: "Valid url without protocol: subdomain + domain + ccTLD"
text: "foo.co.jp"
expected: true
- description: "Valid url without protocol: domain + path + query"
text: "example.com/path/to/resource?search=foo&lang=en"
expected: true
WeightedTweetsCounterTest:
- description: "Regular Tweet with url"
text: "Hi http://test.co"
expected:
weightedLength: 26
valid: true
permillage: 92
displayRangeStart: 0
displayRangeEnd: 16
validRangeStart: 0
validRangeEnd: 16
- description: "Just url"
text: "http://test.co"
expected:
weightedLength: 23
valid: true
permillage: 82
displayRangeStart: 0
displayRangeEnd: 13
validRangeStart: 0
validRangeEnd: 13
- description: "Long tweet, overflow at char index 280"
text: "285 chars-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-"
expected:
weightedLength: 285
valid: false
permillage: 1017
displayRangeStart: 0
displayRangeEnd: 284
validRangeStart: 0
validRangeEnd: 279
- description: "Long tweet with url in the middle, overflow at char index 284"
text: "285 chars- http://www.twitter.com/jack xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-"
expected:
weightedLength: 299
valid: false
permillage: 1067
displayRangeStart: 0
displayRangeEnd: 302
validRangeStart: 0
validRangeEnd: 283
- description: "Long tweet with url at the end, overflow at char index 265"
text: "xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx- http://www.twitter.com/jack "
expected:
weightedLength: 289
valid: false
permillage: 1032
displayRangeStart: 0
displayRangeEnd: 292
validRangeStart: 0
validRangeEnd: 264
- description: "10 url string, no overflow"
text: "https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha "
expected:
weightedLength: 240
valid: true
permillage: 857
displayRangeStart: 0
displayRangeEnd: 299
validRangeStart: 0
validRangeEnd: 299
- description: "160 CJK char, overflow at char index 140"
text: "ๆ
ไบบ่ฅฟ่พ้ป้นคๆฅผ๏ผ็่ฑไธๆไธๆฌๅทใๅญคๅธ่ฟๅฝฑ็ขง็ฉบๅฐฝ๏ผๅฏ่ง้ฟๆฑๅคฉ้
ๆตใๆฑ้ๆกฅ่พน้่่ฑ๏ผไน่กฃๅททๅฃๅค้ณๆใๆงๆถ็่ฐขๅ ๅ็๏ผ้ฃๅ
ฅๅฏปๅธธ็พๅงๅฎถใๆ่พ็ฝๅธๅฝฉไบ้ด๏ผๅ้ๆฑ้ตไธๆฅ่ฟใไธคๅฒธ็ฟๅฃฐๅผไธไฝ๏ผ่ฝป่ๅทฒ่ฟไธ้ๅฑฑใๆณชๆนฟ็ฝๅทพๆขฆไธๆ๏ผๅคๆทฑๅๆฎฟๆๆญๅฃฐใ็บข้ขๆช่ๆฉๅ
ๆญ๏ผๆๅ่ฐ็ฌผๅๅฐๆใ็ฌๅจๅผไนกไธบๅผๅฎข๏ผๆฏ้ขไฝณ่ๅๆไบฒใ้ฅ็ฅๅ
ๅผ็ป้ซๅค๏ผ้ๆ่ฑ่ธๅฐไธไบบใ"
expected:
weightedLength: 320
valid: false
permillage: 1142
displayRangeStart: 0
displayRangeEnd: 159
validRangeStart: 0
validRangeEnd: 139
- description: "160 emoji char, overflow at char index 140"
text: "๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท"
expected:
weightedLength: 320
valid: false
permillage: 1142
displayRangeStart: 0
displayRangeEnd: 319
validRangeStart: 0
validRangeEnd: 279
- description: "3 latin char + 160 CJK char, overflow at char index 141"
text: "theๆ
ไบบ่ฅฟ่พ้ป้นคๆฅผ๏ผ็่ฑไธๆไธๆฌๅทใๅญคๅธ่ฟๅฝฑ็ขง็ฉบๅฐฝ๏ผๅฏ่ง้ฟๆฑๅคฉ้
ๆตใๆฑ้ๆกฅ่พน้่่ฑ๏ผไน่กฃๅททๅฃๅค้ณๆใๆงๆถ็่ฐขๅ ๅ็๏ผ้ฃๅ
ฅๅฏปๅธธ็พๅงๅฎถใๆ่พ็ฝๅธๅฝฉไบ้ด๏ผๅ้ๆฑ้ตไธๆฅ่ฟใไธคๅฒธ็ฟๅฃฐๅผไธไฝ๏ผ่ฝป่ๅทฒ่ฟไธ้ๅฑฑใๆณชๆนฟ็ฝๅทพๆขฆไธๆ๏ผๅคๆทฑๅๆฎฟๆๆญๅฃฐใ็บข้ขๆช่ๆฉๅ
ๆญ๏ผๆๅ่ฐ็ฌผๅๅฐๆใ็ฌๅจๅผไนกไธบๅผๅฎข๏ผๆฏ้ขไฝณ่ๅๆไบฒใ้ฅ็ฅๅ
ๅผ็ป้ซๅค๏ผ้ๆ่ฑ่ธๅฐไธไบบใ"
expected:
weightedLength: 323
valid: false
permillage: 1153
displayRangeStart: 0
displayRangeEnd: 162
validRangeStart: 0
validRangeEnd: 140
- description: "'Aฬ' is normalized into 1 char"
text: "AฬB"
expected:
weightedLength: 2
valid: true
permillage: 7
displayRangeStart: 0
displayRangeEnd: 2
validRangeStart: 0
validRangeEnd: 2
- description: "๏ฌฌ is normalized into 3 chars"
text: "A๏ฌฌ"
expected:
weightedLength: 4
valid: true
permillage: 14
displayRangeStart: 0
displayRangeEnd: 1
validRangeStart: 0
validRangeEnd: 1
- description: "282 chars with a normalized character within valid range but outside 280"
text: "282 chars-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxAฬx"
expected:
weightedLength: 281
valid: false
permillage: 1003
displayRangeStart: 0
displayRangeEnd: 281
validRangeStart: 0
validRangeEnd: 280
- description: "Count a mix of single byte single word, and double word unicode characters"
text: "H๐ฑโบ๐จโ๐ฉโ๐งโ๐ฆ"
expected:
weightedLength: 16
valid: true
permillage: 57
displayRangeStart: 0
displayRangeEnd: 14
validRangeStart: 0
validRangeEnd: 14
- description: "Count unicode emoji chars inside the basic multilingual plane"
text: "๐ท๐พ๐ก๐ฅ๐ฉ"
expected:
weightedLength: 10
valid: true
permillage: 35
displayRangeStart: 0
displayRangeEnd: 9
validRangeStart: 0
validRangeEnd: 9
- description: "Count unicode emoji chars outside the basic multilingual plane with skin tone modifiers"
text: "๐๐ฝ๐จโ๐ค"
expected:
weightedLength: 9
valid: true
permillage: 32
displayRangeStart: 0
displayRangeEnd: 8
validRangeStart: 0
validRangeEnd: 8
- description: "Handle General Punctuation Characters with visible spaces(u2000-200A)"
text: "This is a tweet with general punctuation characters: \u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B\u200C\u200D โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โฒ โณ โด โต โถ โท"
expected:
weightedLength: 112
valid: true
permillage: 400
displayRangeStart: 0
displayRangeEnd: 111
validRangeStart: 0
validRangeEnd: 111
- description: "Handle long url with invalid domain labels and short url"
text: "Long url with invalid domain labels and a short url: https://somesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurl.com/foo https://somesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurl.com/foo https://somesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurl.com/foo https://validurl.com"
expected:
weightedLength: 12079
valid: false
permillage: 43139
displayRangeStart: 0
displayRangeEnd: 12075
validRangeStart: 0
validRangeEnd: 279
- description: "Handle a 64 character domain without protocol"
text: "randomurlrandomurlrandomurlrandomurlrandomurlrandomurlrandomurls.com"
expected:
weightedLength: 68
valid: true
permillage: 242
displayRangeStart: 0
displayRangeEnd: 67
validRangeStart: 0
validRangeEnd: 67
- description: "Do not allow > 140 CJK characters by virtue of CJK chars greater than 63 punycode encoded chars in the host"
text: "ใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใ http://ใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใ.com"
expected:
weightedLength: 358
valid: false
permillage: 1278
displayRangeStart: 0
displayRangeEnd: 184
validRangeStart: 0
validRangeEnd: 143
- description: "Allow > 140 CJK characters by virtue of CJK chars less than 63 punycode encoded chars in the host"
text: "ใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใ http://ใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใ.com"
expected:
weightedLength: 264
valid: true
permillage: 942
displayRangeStart: 0
displayRangeEnd: 183
validRangeStart: 0
validRangeEnd: 183
WeightedTweetsWithDiscountedEmojiCounterTest:
- description: "Regular Tweet with url"
text: "Hi http://test.co"
expected:
weightedLength: 26
valid: true
permillage: 92
displayRangeStart: 0
displayRangeEnd: 16
validRangeStart: 0
validRangeEnd: 16
- description: "Just url"
text: "http://test.co"
expected:
weightedLength: 23
valid: true
permillage: 82
displayRangeStart: 0
displayRangeEnd: 13
validRangeStart: 0
validRangeEnd: 13
- description: "Long tweet, overflow at char index 280"
text: "285 chars-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-"
expected:
weightedLength: 285
valid: false
permillage: 1017
displayRangeStart: 0
displayRangeEnd: 284
validRangeStart: 0
validRangeEnd: 279
- description: "Long tweet with url in the middle, overflow at char index 284"
text: "285 chars- http://www.twitter.com/jack xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-"
expected:
weightedLength: 299
valid: false
permillage: 1067
displayRangeStart: 0
displayRangeEnd: 302
validRangeStart: 0
validRangeEnd: 283
- description: "Long tweet with url at the end, overflow at char index 265"
text: "xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx- http://www.twitter.com/jack "
expected:
weightedLength: 289
valid: false
permillage: 1032
displayRangeStart: 0
displayRangeEnd: 292
validRangeStart: 0
validRangeEnd: 264
- description: "10 url string, no overflow"
text: "https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha https://www.twitter.com/aloha "
expected:
weightedLength: 240
valid: true
permillage: 857
displayRangeStart: 0
displayRangeEnd: 299
validRangeStart: 0
validRangeEnd: 299
- description: "160 CJK char, overflow at char index 140"
text: "ๆ
ไบบ่ฅฟ่พ้ป้นคๆฅผ๏ผ็่ฑไธๆไธๆฌๅทใๅญคๅธ่ฟๅฝฑ็ขง็ฉบๅฐฝ๏ผๅฏ่ง้ฟๆฑๅคฉ้
ๆตใๆฑ้ๆกฅ่พน้่่ฑ๏ผไน่กฃๅททๅฃๅค้ณๆใๆงๆถ็่ฐขๅ ๅ็๏ผ้ฃๅ
ฅๅฏปๅธธ็พๅงๅฎถใๆ่พ็ฝๅธๅฝฉไบ้ด๏ผๅ้ๆฑ้ตไธๆฅ่ฟใไธคๅฒธ็ฟๅฃฐๅผไธไฝ๏ผ่ฝป่ๅทฒ่ฟไธ้ๅฑฑใๆณชๆนฟ็ฝๅทพๆขฆไธๆ๏ผๅคๆทฑๅๆฎฟๆๆญๅฃฐใ็บข้ขๆช่ๆฉๅ
ๆญ๏ผๆๅ่ฐ็ฌผๅๅฐๆใ็ฌๅจๅผไนกไธบๅผๅฎข๏ผๆฏ้ขไฝณ่ๅๆไบฒใ้ฅ็ฅๅ
ๅผ็ป้ซๅค๏ผ้ๆ่ฑ่ธๅฐไธไบบใ"
expected:
weightedLength: 320
valid: false
permillage: 1142
displayRangeStart: 0
displayRangeEnd: 159
validRangeStart: 0
validRangeEnd: 139
- description: "160 emoji char, overflow at char index 140"
text: "๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท๐ท"
expected:
weightedLength: 320
valid: false
permillage: 1142
displayRangeStart: 0
displayRangeEnd: 319
validRangeStart: 0
validRangeEnd: 279
- description: "3 latin char + 160 CJK char, overflow at char index 141"
text: "theๆ
ไบบ่ฅฟ่พ้ป้นคๆฅผ๏ผ็่ฑไธๆไธๆฌๅทใๅญคๅธ่ฟๅฝฑ็ขง็ฉบๅฐฝ๏ผๅฏ่ง้ฟๆฑๅคฉ้
ๆตใๆฑ้ๆกฅ่พน้่่ฑ๏ผไน่กฃๅททๅฃๅค้ณๆใๆงๆถ็่ฐขๅ ๅ็๏ผ้ฃๅ
ฅๅฏปๅธธ็พๅงๅฎถใๆ่พ็ฝๅธๅฝฉไบ้ด๏ผๅ้ๆฑ้ตไธๆฅ่ฟใไธคๅฒธ็ฟๅฃฐๅผไธไฝ๏ผ่ฝป่ๅทฒ่ฟไธ้ๅฑฑใๆณชๆนฟ็ฝๅทพๆขฆไธๆ๏ผๅคๆทฑๅๆฎฟๆๆญๅฃฐใ็บข้ขๆช่ๆฉๅ
ๆญ๏ผๆๅ่ฐ็ฌผๅๅฐๆใ็ฌๅจๅผไนกไธบๅผๅฎข๏ผๆฏ้ขไฝณ่ๅๆไบฒใ้ฅ็ฅๅ
ๅผ็ป้ซๅค๏ผ้ๆ่ฑ่ธๅฐไธไบบใ"
expected:
weightedLength: 323
valid: false
permillage: 1153
displayRangeStart: 0
displayRangeEnd: 162
validRangeStart: 0
validRangeEnd: 140
- description: "282 chars with a normalized character within valid range but outside 280"
text: "282 chars-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxxxxxx-xxxxxAฬx"
expected:
weightedLength: 281
valid: false
permillage: 1003
displayRangeStart: 0
displayRangeEnd: 281
validRangeStart: 0
validRangeEnd: 280
- description: "Count a mix of single byte single word, and double word unicode characters"
text: "H๐ฑโบ๐จโ๐ฉโ๐งโ๐ฆ"
expected:
weightedLength: 7
valid: true
permillage: 25
displayRangeStart: 0
displayRangeEnd: 14
validRangeStart: 0
validRangeEnd: 14
- description: "Count unicode emoji chars inside the basic multilingual plane"
text: "๐ท๐พ๐ก๐ฅ๐ฉ"
expected:
weightedLength: 10
valid: true
permillage: 35
displayRangeStart: 0
displayRangeEnd: 9
validRangeStart: 0
validRangeEnd: 9
- description: "Count unicode emoji chars outside the basic multilingual plane with skin tone modifiers"
text: "๐๐ฝ๐จโ๐ค"
expected:
weightedLength: 4
valid: true
permillage: 14
displayRangeStart: 0
displayRangeEnd: 8
validRangeStart: 0
validRangeEnd: 8
- description: "Handle General Punctuation Characters with visible spaces(u2000-200A), no ZWJ/ZWNJ"
text: "This is a tweet with general punctuation characters: \u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u200B โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โฒ โณ โด โต โถ โท"
expected:
weightedLength: 110
valid: true
permillage: 392
displayRangeStart: 0
displayRangeEnd: 109
validRangeStart: 0
validRangeEnd: 109
- description: "Handle long url with invalid domain labels and short url"
text: "Long url with invalid domain labels and a short url: https://somesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurl.com/foo https://somesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurl.com/foo https://somesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurlsomesuperlongurl.com/foo https://validurl.com"
expected:
weightedLength: 12079
valid: false
permillage: 43139
displayRangeStart: 0
displayRangeEnd: 12075
validRangeStart: 0
validRangeEnd: 279
- description: "Handle a 64 character domain without protocol"
text: "randomurlrandomurlrandomurlrandomurlrandomurlrandomurlrandomurls.com"
expected:
weightedLength: 68
valid: true
permillage: 242
displayRangeStart: 0
displayRangeEnd: 67
validRangeStart: 0
validRangeEnd: 67
- description: "Do not allow > 140 CJK characters by virtue of CJK chars greater than 63 punycode encoded chars in the host"
text: "ใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใ http://ใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใ.com"
expected:
weightedLength: 358
valid: false
permillage: 1278
displayRangeStart: 0
displayRangeEnd: 184
validRangeStart: 0
validRangeEnd: 143
- description: "Allow > 140 CJK characters by virtue of CJK chars less than 63 punycode encoded chars in the host"
text: "ใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใ http://ใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใใ.com"
expected:
weightedLength: 264
valid: true
permillage: 942
displayRangeStart: 0
displayRangeEnd: 183
validRangeStart: 0
validRangeEnd: 183
- description: "140 family emoji"
text: "๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ๐จโ๐ฉโ๐งโ๐ฆ"
expected:
weightedLength: 280
valid: true
permillage: 1000
displayRangeStart: 0
displayRangeEnd: 1539
validRangeStart: 0
validRangeEnd: 1539
- description: "Unicode 10.0 emoji"
text: "Unicode 10.0 emoji: ๐คช; ๐ง; ๐ง๐พ; ๐ด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ"
expected:
weightedLength: 34
valid: true
permillage: 121
displayRangeStart: 0
displayRangeEnd: 47
validRangeStart: 0
validRangeEnd: 47
- description: "Unicode 9.0 emoji"
text: "Unicode 9.0 emoji: ๐ค ; ๐; ๐๐พ"
expected:
weightedLength: 29
valid: true
permillage: 103
displayRangeStart: 0
displayRangeEnd: 30
validRangeStart: 0
validRangeEnd: 30
UnicodeDirectionalMarkerCounterTest:
- description: "Handle invalid characters"
text: "ABC\u202A\uFFFFABC\uFFFE"
expected:
weightedLength: 12
valid: false
permillage: 42
displayRangeStart: 0
displayRangeEnd: 8
validRangeStart: 0
validRangeEnd: 3
- description: "Tweet text containing directional characters should be considered valid"
text: "\U00002066\U0000202Ahttp://foobar.ูพุงฺฉุณุชุงู/\U0000202C\U00002069"
expected:
weightedLength: 31
valid: true
permillage: 110
displayRangeStart: 0
displayRangeEnd: 25
validRangeStart: 0
validRangeEnd: 25