-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathNBKFlexibleWidth+Text.swift
1206 lines (1094 loc) · 65.9 KB
/
NBKFlexibleWidth+Text.swift
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
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//=----------------------------------------------------------------------------=
// This source file is part of the Numberick open source project.
//
// Copyright (c) 2023 Oscar Byström Ericsson
// Licensed under Apache License, Version 2.0
//
// See http://www.apache.org/licenses/LICENSE-2.0 for license information.
//=----------------------------------------------------------------------------=
import NBKCoreKit
import NBKFlexibleWidthKit
import XCTest
private typealias X = [UInt]
private typealias X64 = [UInt64]
private typealias X32 = [UInt32]
//*============================================================================*
// MARK: * NBK x Flexible Width x Text x UIntXL
//*============================================================================*
//=----------------------------------------------------------------------------=
// NOTE: See the for-each-radix section for more encoding tests.
//=----------------------------------------------------------------------------=
final class NBKFlexibleWidthTestsOnTextAsUIntXL: XCTestCase {
typealias T = UIntXL
//=------------------------------------------------------------------------=
// MARK: Tests
//=------------------------------------------------------------------------=
/// - Note: Its description is not as lenient as its string literal.
func testFromDescription() {
NBKAssertFromDescription(T?( 10), "10")
NBKAssertFromDescription(T?( 10), "+10")
NBKAssertFromDescription(T?(nil), "-10")
NBKAssertFromDescription(T?(nil), " 10")
NBKAssertFromDescription(T?(nil), "0x10")
NBKAssertFromDescription(T?(nil), "+0x10")
NBKAssertFromDescription(T?(nil), "-0x10")
NBKAssertFromDescription(T?(nil), " 0x10")
}
func testInstanceDescriptionUsesRadix10() {
XCTAssertEqual("10", T(10).description)
XCTAssertEqual("10", String(describing: T(10)))
}
func testMetaTypeDescriptionIsSimple() {
XCTAssertEqual("UIntXL", T.description)
}
//=------------------------------------------------------------------------=
// MARK: Tests x Decoding
//=------------------------------------------------------------------------=
func testDecodingUnalignedStringsIsOK() {
NBKAssertDecodingText(T(1), 10, "1")
NBKAssertDecodingText(T(1), 16, "1")
}
func testDecodingRadixLiteralAsNumber() {
NBKAssertDecodingText(T(33), 36, "0x")
NBKAssertDecodingText(T(24), 36, "0o")
NBKAssertDecodingText(T(11), 36, "0b")
NBKAssertDecodingText(T(33), 36, "+0x")
NBKAssertDecodingText(T(24), 36, "+0o")
NBKAssertDecodingText(T(11), 36, "+0b")
}
func testDecodingRadixLiteralAsRadixReturnsNil() {
NBKAssertDecodingText(T?.none, 10, "0x10")
NBKAssertDecodingText(T?.none, 10, "0o10")
NBKAssertDecodingText(T?.none, 10, "0b10")
NBKAssertDecodingText(T?.none, 10, "+0x10")
NBKAssertDecodingText(T?.none, 10, "+0o10")
NBKAssertDecodingText(T?.none, 10, "+0b10")
}
func testDecodingStringsWithAndWithoutSign() {
NBKAssertDecodingText(T(1234567890), 10, "1234567890")
NBKAssertDecodingText(T(1234567890), 10, "+1234567890")
}
func testDecodingStrategyIsCaseInsensitive() {
NBKAssertDecodingText(T(0xabcdef), 16, "abcdef")
NBKAssertDecodingText(T(0xABCDEF), 16, "ABCDEF")
NBKAssertDecodingText(T(0xaBcDeF), 16, "aBcDeF")
NBKAssertDecodingText(T(0xAbCdEf), 16, "AbCdEf")
}
func testDecodingPrefixingZerosHasNoEffect() {
let zero = String(repeating: "0", count: 256) + "0"
let one = String(repeating: "0", count: 256) + "1"
for radix in 02 ... 36 {
NBKAssertDecodingText(T(0), radix, zero)
NBKAssertDecodingText(T(1), radix, one )
}
}
func testDecodingInvalidCharactersReturnsNil() {
NBKAssertDecodingText(T?.none, 16, "/")
NBKAssertDecodingText(T?.none, 16, "G")
NBKAssertDecodingText(T?.none, 10, "/")
NBKAssertDecodingText(T?.none, 10, ":")
NBKAssertDecodingText(T?.none, 10, String(repeating: "1", count: 19) + "/")
NBKAssertDecodingText(T?.none, 10, String(repeating: "1", count: 19) + ":")
}
func testDecodingStringsWithoutDigitsReturnsNil() {
NBKAssertDecodingText(T?.none, 10, "")
NBKAssertDecodingText(T?.none, 10, "+")
NBKAssertDecodingText(T?.none, 10, "-")
NBKAssertDecodingText(T?.none, 10, "~")
NBKAssertDecodingText(T?.none, 16, "")
NBKAssertDecodingText(T?.none, 16, "+")
NBKAssertDecodingText(T?.none, 16, "-")
NBKAssertDecodingText(T?.none, 16, "~")
}
func testDecodingValuesOutsideOfRepresentableRangeReturnsNil() {
for radix in 02 ... 36 {
NBKAssertDecodingText(T?.none, radix, "-1")
}
}
}
//*============================================================================*
// MARK: * NBK x Flexible Width x Text x For Each Radix x UIntXL
//*============================================================================*
final class NBKFlexibleWidthTestsOnTextForEachRadixAsUIntXL: XCTestCase {
typealias T = UIntXL
//=------------------------------------------------------------------------=
// MARK: State
//=------------------------------------------------------------------------=
/// The bit pattern: `0xfffefdfcfbfaf9f8...0706050403020100`.
static let ascending = T(x64:[
0x0706050403020100, 0x0f0e0d0c0b0a0908, 0x1716151413121110, 0x1f1e1d1c1b1a1918,
0x2726252423222120, 0x2f2e2d2c2b2a2928, 0x3736353433323130, 0x3f3e3d3c3b3a3938,
0x4746454443424140, 0x4f4e4d4c4b4a4948, 0x5756555453525150, 0x5f5e5d5c5b5a5958,
0x6766656463626160, 0x6f6e6d6c6b6a6968, 0x7776757473727170, 0x7f7e7d7c7b7a7978,
0x8786858483828180, 0x8f8e8d8c8b8a8988, 0x9796959493929190, 0x9f9e9d9c9b9a9998,
0xa7a6a5a4a3a2a1a0, 0xafaeadacabaaa9a8, 0xb7b6b5b4b3b2b1b0, 0xbfbebdbcbbbab9b8,
0xc7c6c5c4c3c2c1c0, 0xcfcecdcccbcac9c8, 0xd7d6d5d4d3d2d1d0, 0xdfdedddcdbdad9d8,
0xe7e6e5e4e3e2e1e0, 0xefeeedecebeae9e8, 0xf7f6f5f4f3f2f1f0, 0xfffefdfcfbfaf9f8])
/// The bit pattern: `0x0001020304050607...f8f9fafbfcfdfeff`.
static let descending = T(x64:[
0xf8f9fafbfcfdfeff, 0xf0f1f2f3f4f5f6f7, 0xe8e9eaebecedeeef, 0xe0e1e2e3e4e5e6e7,
0xd8d9dadbdcdddedf, 0xd0d1d2d3d4d5d6d7, 0xc8c9cacbcccdcecf, 0xc0c1c2c3c4c5c6c7,
0xb8b9babbbcbdbebf, 0xb0b1b2b3b4b5b6b7, 0xa8a9aaabacadaeaf, 0xa0a1a2a3a4a5a6a7,
0x98999a9b9c9d9e9f, 0x9091929394959697, 0x88898a8b8c8d8e8f, 0x8081828384858687,
0x78797a7b7c7d7e7f, 0x7071727374757677, 0x68696a6b6c6d6e6f, 0x6061626364656667,
0x58595a5b5c5d5e5f, 0x5051525354555657, 0x48494a4b4c4d4e4f, 0x4041424344454647,
0x38393a3b3c3d3e3f, 0x3031323334353637, 0x28292a2b2c2d2e2f, 0x2021222324252627,
0x18191a1b1c1d1e1f, 0x1011121314151617, 0x08090a0b0c0d0e0f, 0x0001020304050607])
//=------------------------------------------------------------------------=
// MARK: Assertions
//=------------------------------------------------------------------------=
func check(_ integer: T, radix: Int, ascii: String, file: StaticString = #file, line: UInt = #line) {
var encoded = String(ascii.drop(while:{ $0 == "0" }))
if encoded.isEmpty {
encoded.append(contentsOf: ascii.suffix(1))
}
NBKAssertDecodingText(integer, radix, ascii, file: file, line: line)
NBKAssertDecodingText(integer, radix, encoded, file: file, line: line)
NBKAssertEncodingText(integer, radix, true, encoded.uppercased(), file: file, line: line)
NBKAssertEncodingText(integer, radix, false, encoded.lowercased(), file: file, line: line)
}
//=------------------------------------------------------------------------=
// MARK: Tests
//=------------------------------------------------------------------------=
func testImportantValues() {
for radix in 2 ... 36 {
self.check(T(0), radix: radix, ascii: "0")
self.check(T(1), radix: radix, ascii: "1")
}
for radix in 02 ... 36 {
NBKAssertDecodingText(T?( 0), radix, "0")
NBKAssertDecodingText(T?( 0), radix, "+0")
NBKAssertDecodingText(T?( 0), radix, "-0")
NBKAssertDecodingText(T?( 1), radix, "1")
NBKAssertDecodingText(T?( 1), radix, "+1")
NBKAssertDecodingText(T?(nil), radix, "-1")
}
}
//=------------------------------------------------------------------------=
// MARK: Tests x Ascending, Descending
//=------------------------------------------------------------------------=
func test02() {
self.check(Self.ascending, radix: 02, ascii: """
1111111111111110111111011111110011111011111110101111100111111000\
1111011111110110111101011111010011110011111100101111000111110000\
1110111111101110111011011110110011101011111010101110100111101000\
1110011111100110111001011110010011100011111000101110000111100000\
1101111111011110110111011101110011011011110110101101100111011000\
1101011111010110110101011101010011010011110100101101000111010000\
1100111111001110110011011100110011001011110010101100100111001000\
1100011111000110110001011100010011000011110000101100000111000000\
1011111110111110101111011011110010111011101110101011100110111000\
1011011110110110101101011011010010110011101100101011000110110000\
1010111110101110101011011010110010101011101010101010100110101000\
1010011110100110101001011010010010100011101000101010000110100000\
1001111110011110100111011001110010011011100110101001100110011000\
1001011110010110100101011001010010010011100100101001000110010000\
1000111110001110100011011000110010001011100010101000100110001000\
1000011110000110100001011000010010000011100000101000000110000000\
0111111101111110011111010111110001111011011110100111100101111000\
0111011101110110011101010111010001110011011100100111000101110000\
0110111101101110011011010110110001101011011010100110100101101000\
0110011101100110011001010110010001100011011000100110000101100000\
0101111101011110010111010101110001011011010110100101100101011000\
0101011101010110010101010101010001010011010100100101000101010000\
0100111101001110010011010100110001001011010010100100100101001000\
0100011101000110010001010100010001000011010000100100000101000000\
0011111100111110001111010011110000111011001110100011100100111000\
0011011100110110001101010011010000110011001100100011000100110000\
0010111100101110001011010010110000101011001010100010100100101000\
0010011100100110001001010010010000100011001000100010000100100000\
0001111100011110000111010001110000011011000110100001100100011000\
0001011100010110000101010001010000010011000100100001000100010000\
0000111100001110000011010000110000001011000010100000100100001000\
0000011100000110000001010000010000000011000000100000000100000000
""")
self.check(Self.descending, radix: 02, ascii: """
0000000000000001000000100000001100000100000001010000011000000111\
0000100000001001000010100000101100001100000011010000111000001111\
0001000000010001000100100001001100010100000101010001011000010111\
0001100000011001000110100001101100011100000111010001111000011111\
0010000000100001001000100010001100100100001001010010011000100111\
0010100000101001001010100010101100101100001011010010111000101111\
0011000000110001001100100011001100110100001101010011011000110111\
0011100000111001001110100011101100111100001111010011111000111111\
0100000001000001010000100100001101000100010001010100011001000111\
0100100001001001010010100100101101001100010011010100111001001111\
0101000001010001010100100101001101010100010101010101011001010111\
0101100001011001010110100101101101011100010111010101111001011111\
0110000001100001011000100110001101100100011001010110011001100111\
0110100001101001011010100110101101101100011011010110111001101111\
0111000001110001011100100111001101110100011101010111011001110111\
0111100001111001011110100111101101111100011111010111111001111111\
1000000010000001100000101000001110000100100001011000011010000111\
1000100010001001100010101000101110001100100011011000111010001111\
1001000010010001100100101001001110010100100101011001011010010111\
1001100010011001100110101001101110011100100111011001111010011111\
1010000010100001101000101010001110100100101001011010011010100111\
1010100010101001101010101010101110101100101011011010111010101111\
1011000010110001101100101011001110110100101101011011011010110111\
1011100010111001101110101011101110111100101111011011111010111111\
1100000011000001110000101100001111000100110001011100011011000111\
1100100011001001110010101100101111001100110011011100111011001111\
1101000011010001110100101101001111010100110101011101011011010111\
1101100011011001110110101101101111011100110111011101111011011111\
1110000011100001111000101110001111100100111001011110011011100111\
1110100011101001111010101110101111101100111011011110111011101111\
1111000011110001111100101111001111110100111101011111011011110111\
1111100011111001111110101111101111111100111111011111111011111111
""")
}
func test03() {
self.check(Self.ascending, radix: 03, ascii: """
0000000000000000000000000000000000000000000000000001011122001202\
0221000010120021121012122122121210201121000021000121212010111102\
0021022202211121121121221212000020201221122210202201001002201010\
0210001212020121021021121001210100100102120102122200201001202102\
2220222111112021200221211122210111211012110122021212001101101012\
0200211111121022021211100122022012211112112221002121112202200001\
1001122202020122210212021001020200222212112100211020020010002221\
0111000010011011101010021210201220102122102122212202102012220100\
0111020201112002211002010001100110020220111111012101100222010221\
0010122122022201020000102121202021200201200211001212202010110021\
2001010202202101112000210220201111022010220200012021000020111021\
2201012002120201120221122221012002222200122120210000120121000201\
2012211022021200001122102120002110221102210110111021200002120202\
2010012002002102202002201200210100102202220110101222010000222022\
0200112200201010002020101100200110010000000002001202111210200020\
0002120001222001110002220220221011110011011012201210101122122001\
2111021020102211121020000002111101220000201210122212002012102220\
1110200122122112012100001022010221010222101020220010000121012012\
0010010122111111120110221020002211102201221020121121212111201100\
0200121221120002212120101220100120101121122112221220012112011121\
0121001121010221102001120121101000020200001000211102020110221110
""")
self.check(Self.descending, radix: 03, ascii: """
0000000000000000000000000000000000000000000000000000000000000100\
1201120210220100110000101022020200210120211212120010111000100200\
1201120210200222221112211112120122111002022121212221220020020021\
1211112200121202200221110201112022200111011002001111211001001210\
2220102000012100211210021120211221200212210011220221221210221212\
2222022220122111000220122201210100221211021220102010112022011111\
0121021201001110200122102112201202022222200221000101120200212101\
1010021021022221120101211200201110000211111122201202020202110221\
0022120111200020110102012011210110000211200010220002101111120101\
1221102201020120002022010122120111111211222012011211212110222012\
1202220212201211110122201021001011010112010211112010202102100001\
1201212220101111022210120202211012001102022221101101221222200111\
0101010020020220000112200212022001021010021100102210101022210211\
1202021010021102110001202120201000202122002011122102011220111101\
1012211121220210021002212210112100210201120111010221022120001212\
1222110100200211122221210100020221110011222001202222000211010100\
1122110212221111011200112012012002220201002201222110102200111201\
0111111101220210011222012010020001021121201122201012021221210210\
2110011012222121222020020212110121100210220002222011101221021021\
0112202220101220011210212011210102200110100021221220200201110011\
0022000111200121201021102000112221002012210222221221112222201100
""")
}
func test04() {
self.check(Self.ascending, radix: 04, ascii: """
3333333233313330332333223321332033133312331133103303330233013300\
3233323232313230322332223221322032133212321132103203320232013200\
3133313231313130312331223121312031133112311131103103310231013100\
3033303230313030302330223021302030133012301130103003300230013000\
2333233223312330232323222321232023132312231123102303230223012300\
2233223222312230222322222221222022132212221122102203220222012200\
2133213221312130212321222121212021132112211121102103210221012100\
2033203220312030202320222021202020132012201120102003200220012000\
1333133213311330132313221321132013131312131113101303130213011300\
1233123212311230122312221221122012131212121112101203120212011200\
1133113211311130112311221121112011131112111111101103110211011100\
1033103210311030102310221021102010131012101110101003100210011000\
0333033203310330032303220321032003130312031103100303030203010300\
0233023202310230022302220221022002130212021102100203020202010200\
0133013201310130012301220121012001130112011101100103010201010100\
0033003200310030002300220021002000130012001100100003000200010000
""")
self.check(Self.descending, radix: 04, ascii: """
0000000100020003001000110012001300200021002200230030003100320033\
0100010101020103011001110112011301200121012201230130013101320133\
0200020102020203021002110212021302200221022202230230023102320233\
0300030103020303031003110312031303200321032203230330033103320333\
1000100110021003101010111012101310201021102210231030103110321033\
1100110111021103111011111112111311201121112211231130113111321133\
1200120112021203121012111212121312201221122212231230123112321233\
1300130113021303131013111312131313201321132213231330133113321333\
2000200120022003201020112012201320202021202220232030203120322033\
2100210121022103211021112112211321202121212221232130213121322133\
2200220122022203221022112212221322202221222222232230223122322233\
2300230123022303231023112312231323202321232223232330233123322333\
3000300130023003301030113012301330203021302230233030303130323033\
3100310131023103311031113112311331203121312231233130313131323133\
3200320132023203321032113212321332203221322232233230323132323233\
3300330133023303331033113312331333203321332233233330333133323333
""")
}
func test05() {
self.check(Self.ascending, radix: 05, ascii: """
0000000000000101011133132112303401331203113040334201212224114333\
1331210120311431302322401423134214144114302234223323124032013102\
2031310012312133044114114101403342401111141021424131121343010430\
1421121331201040013433442113440322214443111221044313323014144300\
0442200211013021440424413104144331034304433134022344442034220120\
0203022440403030041413132134201411232022143440134130244204021202\
4204221131331321003014044044023244032003434441023101312044413410\
1432032422222011101300422133144024022310244143301333333131313132\
1133101212222113330424040311111134211430243400332404421303012024\
3301033334140414340340314003013204313402213301322411212023034201\
2004134224142103031424130211110200431412144004241140022344304021\
2024422012034413242431014044023232132211032301042413413421403001\
0304124320331131120040124432124112202220433320304324003340021343\
1324223134224004424011000321223301220134021034313232023030324130
""")
self.check(Self.descending, radix: 05, ascii: """
0000000000000000000011112220410043202330011120133410031040004330\
4341221403222404433322102144041223114211314323343204434113224023\
4202133231041330002312141443032100300431040042214130113344324022\
0003033132111304421001413014203324242214223404240341232242231142\
3340214011113104001131004242024004221443142132444122344311101242\
1004023141340203330402132300004344144322442200321404111130230232\
3133343130231214411012031114143432214413020420233100440220432423\
2243141404410214044100142011212104313004030243322344322310333323\
3024401130130344314420430011223234330142032224324334134040231223\
3411402203220101304223402340422200404331110030013243131121203033\
4421222201121212122344111102000123003033403313011113442344310321\
0212040323210123133413431243330144102203032410432301243134312231\
0222420103420141120210200140403304423210100101323244203323144103\
2244421302202340120224210321141312243002114134133313000033010430
""")
}
func test06() {
self.check(Self.ascending, radix: 06, ascii: """
0000000000000000000000000000000000000001345131000552333115344121\
1214023443243324324333122442522233415252532225231130540122100214\
0215244235522514322330122325410454305413105211242412413243515420\
4031415411205525200543134520405500520504130422250301225525122255\
5304444554221253253024400132115002405214044033240245530335422552\
3230145401344324044315001345525133204253014235441544150342233311\
3102525333433242251435152053450224205545410400155320525214003341\
0114031334552553523440515235201104055151034451040431352324424022\
3220325011454332550413335135033252231132320134203510232401355331\
2020345410240441033104340125314154522445134135421334244051303551\
0152420450032004440445510515505305150554300514513545121304233402\
1512140511314534242423200345252352143342420322435054213022035002\
4325250215312305241230104233141315022325103343150130404400523320
""")
self.check(Self.descending, radix: 06, ascii: """
0000000000000000000000000000000000000000000001101244524030103050\
5531042315523235333525101305553312125110054220232435524352224142\
2053151321544434335040524214255145034313244420015104114444532130\
5131211403354545331043000404415555115552254524500234324052054544\
0212530234155222352503522355044401441443444123253343143251424324\
4134551510104424455502335515404533114302125220421213020520110411\
1504043310005143320344204330350455513552351141214450322440103324\
3125500135505231115445012513503141220340440111403544321144410454\
4434544550051012214002454222455235433415531502214521123242404320\
4014321430553334134451431214532201142053235043445501013550154325\
3024252321100454253441131350205155431304043512204000014004531004\
2034152112152200254215340255540550522204504133200444140500531431\
2233041532325315013225020141304435140311224252411541420101544143
""")
}
func test07() {
self.check(Self.ascending, radix: 07, ascii: """
0000000000000000000000000000000000000024653320130023336353601340\
0355512020400135330313404163116323361665214341655231546035543041\
3335061463602013225153316300026621432263543366545536433610205024\
3003025201644424044635410411626456311635136110623401315661102442\
0612331166566162241453601510216450625624416556453020643500526255\
4225530231005403046503563131246643640004650324634650424453045323\
3644226261554166110441022133064452150660600363500515360604100635\
1324126506201641562342434011560236352122640326266120664210323233\
2635011020024026201015103132011050236605005335425545336151120104\
5113112534231011226633116051366211215560241650222456652010032225\
3614546631516640255632303266244531025632554125633416523166131412\
3533422165650541466015660324101553116436025240606246521266532034
""")
self.check(Self.descending, radix: 07, ascii: """
0000000000000000000000000000000000000000000046215156341104144413\
6064621423661545444654615066360306060465143246516123400132545065\
2014515155412342351261361320435321015260445542345153424665323461\
0114416030513346553314263163630631425445505265616243343122362104\
2000460423064644315166540105254001105315016506520645232434362254\
4331411646406403010516610221633665334030662154232055411300246353\
0310563254056060056622336540260033560331003320163152232604433135\
4164235460542041401510521102142062156431435343046560332465042201\
6511235106510212216314244536164605241220642565660111156412634233\
6556106632453464235621424215600534606530001631160211606003002230\
1611605222100443162203206534603240202153655435353545022116362124\
6026410120242432506346633405306601261561020623142104244113610216
""")
}
func test08() {
self.check(Self.ascending, radix: 08, ascii: """
0000000000000000000003777757677476775371761737667537236374570760\
7376735573165752723643477156274470761341701577366735633366554730\
6575332565151722643503176354671462745311621437066134230360540700\
5773727557135672563342675553266454731261541276565332625352524650\
5172324551121642503202374751663446715231461136264531222344510620\
4370721543105612423042074150260440701201400775763727617336474570\
3567316535071562342701573346655432665151320635463126214330460540\
2765713527055532262541272545252424651121240475162324611322444510\
2164310521041502202400771743647416635071160334661523206314430460\
1362705513025452122240471142244410621041100174360721603306414430\
0561302505011422042100170340641402605011020034060120200300400400
""")
self.check(Self.descending, radix: 08, ascii: """
0000000000000000000000000020100301002406016040110240541403207017\
0401042204612025054134300621503307016436076200411042144411223047\
1202445212626055134274601423106315032466156340711643547417237077\
2004050220642105214435102224511323046516236501212445152425253127\
2605453226656135274575403026114331062546316641513246555433267157\
3407056234672165354735703627517337076576377002014050160441303207\
4210461242706215435076204431122345112626457142314651563447317237\
5012064250722245515236505232525353126656537302615453166455333267\
5613467256736275575377006034130361142706617443116254571463347317\
6415072264752325655537306635533367156736677603417056174471363347\
7216475272766355735677607437136375172766757743717657577477377377
""")
}
func test09() {
self.check(Self.ascending, radix: 09, ascii: """
0000000000000000000000000000000000000000000000000000000001148052\
2700350753557855364700701776344207282747547855006657583681032633\
2305521723753171031251258063167286874467627748714735418255041335\
2074453825431826574548707748260131582218725231220885470736203087\
1400313433325365637837878236581014221462732101313226444171328127\
0357828120037766762162405566340761122671460726644263820167006437\
8116252152758716288057670051702165738250048376073842713437602522\
6316207266265071038281335810086820480633066340613100002052453606\
0250186140282683440413565334856174236384536002441800653585065386\
4361857517003812712833680301716503118444513836084381836547774640\
2055750277635631634757585617514717047127361517330220030742213843
""")
self.check(Self.descending, radix: 09, ascii: """
0000000000000000000000000000000000000000000000000000000000000010\
5152381040033822071675550343032051523628845745518432277787806207\
5448055262742146861413204473105386360170753246757625704827853855\
8828657402658171085425636346814417251043618375652288627011520771\
3323728751175064302444865222242708514606412164713024603802344511\
5738121606811851445486515477386552825654418637034115124463672301\
5178634428352273504228734185861411106226015625261233240383338724\
5223324240167663067806457215644135747823232783470721514127276055\
5841062458771022740486168802411048425844150465162821081873380451\
1444182315816320124764863525772373135877866225417323802864357237\
1568635615376471261330785662140408014617637360487065728857488640
""")
}
func test10() {
self.check(Self.ascending, radix: 10, ascii: """
0000000000000000000000032316509077753586139510713445660514514047\
1715800934968659014776021432245405574123404729692361840203777454\
0863807743939745614194869975427379141886998502749960224378577364\
6750786158629119897527698459159582903277348091197804306308450975\
2765897157258671077139706248797954495766510537726453385451362891\
2932640350906509210810910107747204614412263847494852734365334510\
5797020149055603954704727773430317796884279167058635246262041734\
9145786264563977273862044757186140910253489061210709169291375411\
8235589361595220880511748744523688475088623430039909767486996242\
6348425792929710270231641017897005896324246640151098893336183040
""")
self.check(Self.descending, radix: 10, ascii: """
0000000000000000000000000000496993557421161204163243009437446396\
9310896219871662288678253814305983104785527242321753388930859433\
0932284445862203797761045073664730366928240142078351838709159365\
4245305591568630492124408336898055480790220185594414336311305186\
5615046227503033628676752271565095933109248377684204700624161099\
9460398201284924128155924134321292864244193101990764869167297695\
2280785510275422238003732540719940795979897949667308357456420122\
4430197246959039185181992218946191962058782195636399032805876159\
1937103770751746973746316925269816124638211869823911785029642701\
0987117809205722959373004300581599055823946915702512166260047615
""")
}
func test11() {
self.check(Self.ascending, radix: 11, ascii: """
0000000000000000000000000000000000000000000000010142aa3554859615\
1a9204496a56113782737a0530594194878213854265484228a2873210376102\
298531554729267773485a52aaa2030350391963a7a0a94819183a184061767a\
a1664196a92a29124a90906677a6159283540713930a23461662230751976003\
75aa406a38a465902249a525645153a635a40a420899916a90a1749213325274\
6766792593268189a459a23695332111336a2574023146139a17034537465a24\
8967a2a50a37a69914126a360951448575372782095382a02084543002870940\
85532153a572629110a97679073778890291691419a246a95a6016478938298a\
358425533763a551898a379424822a252aa411a696485496052a6871743a226a\
8989647385195622111666334615228957638330392039898693611430034583
""")
self.check(Self.descending, radix: 11, ascii: """
0000000000000000000000000000000000000000000000000000256148a85586\
5197664763a413508459939466315799165a6237763aa375593223a736658a62\
6175a059a7751a78641a7a475619616477939520a087332893696097491542a0\
32141834910a431662128201852a11559a110337a57054a296643718815a7a80\
48479962aa316851a2904aa35279872922828167a735214a27215a821861a384\
99815a0961a3737601288254235997668057936329799a941615802815674803\
25786a7644882756447532455a8a3a35981a95a6909a13497286502490619a17\
1a77888724a210a717362256366a598950960902066765804a99481685943069\
59110458713a51298801a11123297018992a5501098a28a26006692109193391\
a16a79092aa045204411a34032199992178aa6827439a86a4a1162545251105a
""")
}
func test12() {
self.check(Self.ascending, radix: 12, ascii: """
00001b9367266a6039066116339183036aaa985742938485bbb3a46470645276\
569234baa5161788742348681a4a5b25ba61622633b09273b03b9aaa7514aa58\
900baa9a74852ab0219481b21a86a3153bab534868478662a6191b1659b54964\
ab9654b6430343071b655848847330017058b16480bb191b0985b8521152b521\
563996041b3a74992b7126029326661485b6632a381a4ab4a820460396996731\
1955a0b949642455a94aa27512b620a30373879b06207879078319104b12b4b9\
b2ba94a962459429a746627b83089334822b767922152b60a66b497450a07244\
b845b1558994981851b953005363a121880435bb95b546ab1558447212026a12\
954b5492aa0367a34a0a961a50ba9a07b6279269932a4957a644a2a3a3920540
""")
self.check(Self.descending, radix: 12, ascii: """
00000000076b918968899b991b3a0b667713391937b3bb902301ab6145a77307\
44a2b60b437594576b487310178a094b5808bb63727175a001311367a6b15b60\
a32b64505a7714b4726537456122412432166973a068b703039439a92559b5b6\
5b0a431247a475b7b73780620429b5646b5980809950201652a5a17013a53004\
9278712658818566b19311073b683072337992902a246221355872288749aa1a\
8b591341aaba72b3b98a0799b919741387205aa722a5a05582862a92506ba89b\
a307a1a27768ba2575796b18278b74a250523680499a1a60492b1910ba644782\
6784970931559000310546aba16a418a4827544331254b700900bb405448b2a4\
4b093020088bb2535b47963b7b44608a93421b127bb07b00246477a7b8115053
""")
}
func test13() {
self.check(Self.ascending, radix: 13, ascii: """
000000000000000000000031cb7486735908c0144bc1018ac182c82a930a12ca\
74aa7825455c0218a1479ca12843cb94baa0938378c1c8384b19b34340a64b01\
4c927b86217b9a059379c40089c4314b035b5c702c8371c7c80104445bc99b56\
057a91abc9acb1bc37950647b72045a5a647587b15c865bb75c2380191829a66\
04a1184400818b29b9513b8c59490494649a18069b449c472c2366c76a2ca852\
5096cc27207409700b2a636668139b428455c9a6ac67131b4589833577743c3a\
7a091a293275c628b8a06625cb2a15734b58b3a57163a48014a7a5c277499614\
79955285c36bc06b629543773288158648aa581166a042608899014254840857\
15273b93212a908443abc9abc7929ba5810113319924a7468970130052605289
""")
self.check(Self.descending, radix: 13, ascii: """
000000000000000000000000001500b062c1244a5ca682353200a96937353c93\
73069a0b203a0697c45513ab9487a7205bb57cc5c425a5c032a2474a01bc3aa7\
7990173264abb8b83613121b5528156c4048b81422ac426709bccc65a508b4cb\
132b977345a9202198a9c32785c770890b69240b96ca5b132b8b9b817411a933\
4b72342699707c6b5c874c92ab31903c758988696cca9690145b772b03085bc3\
169a4bc0c135baab68558c0798367ba3406b38007b90c8885160454934686c89\
4cb56950cba1887a6a20b95b1c99c6b275100512542006c230c4193161a27012\
95b489091b11513a7b6aa93691a756cb65c77ca95668543158b357ca8ab95a44\
a00348774316caaac9b21502a3302702c852a8bb56b24b5400628a24276750bc
""")
}
func test14() {
self.check(Self.ascending, radix: 14, ascii: """
00000000000000000000000000000000000000ad0745312ac38003406c77772a\
c5d337dc56d71b0120a8035c347cd412ba206c7a19b3638983ad6c7dac8866db\
ad3165c94d93a13248c199cda6773520749b9430c797c2bb0d8ca867ba5a063b\
83d226939c0cbd8ab945b687021c84a90d7ba0d68cd37869a55260d1d780666b\
0b6a3a99600cd5b1d80b84cc30bd74702723a1126cbdb5a42c285669194da766\
c63c8d6d1aad3cc15dda115b2445580577049b2b7b818a839a3d0713a25586d3\
109b2a74bb9cb5947074d06003a7d8559a8ab638c511c84c158d5c7033b7385d\
777b7d6c35b83b7c4a497aa9b859dc77b943581b1799d547b62548548666b945\
8d240951c39596c82589a5602b65a7c3b356a46269456953341674c2567b81c4
""")
self.check(Self.descending, radix: 14, ascii: """
000000000000000000000000000000000000000000665b20da8c012072742a9c\
a5cd039c351d1954c650a78d38b82408a4277196aba9762211d09d8cd8b0d860\
6a3a66d5813834054475593121b4b9b0413200c31c0a2b0dba384d9032706145\
d308b314144dacdd01dd8587897b13064dbc82a519ca81a734516c2298c2880a\
78c76978d6386d10859b60bb745899c01badadda1999d5b791193187c567c0a8\
32a2abc1cd43d1c3560bba8d56b67cab62bcd597b554a3d9b2ac51adc018d6cc\
80c0126414d43729179abd98859db7a875258b438c6b3a2a285d3786ddb0ad49\
5ba3add41a36735295c13053243d4a14dd747ac3353a4dd77b9314a9c9a79560\
6101643ad12c8242bac710666c8139696c146dd4da84974da56d48c94dbb007d
""")
}
func test15() {
self.check(Self.ascending, radix: 15, ascii: """
0000000000000000000000000000000000000000000000000001adcc42d77564\
2e8d25576598e679706b39b634284eb4323514682a6a176bc422a0b453010958\
11db137066d571a2b91ec47eb29e5870c08bb8759a29eae1e60de477c04c2c97\
a272774aaa2573b20764ea2a18c62d7c3660ec0387a7b658d71e5d9dc14245d0\
163d05e294dac37d9a00339a9b41ee29b3c604d4350739ee6c2617a77c226325\
8d6ca4cd40eb15b65a6341963a35035c8441616e6c21e1ec9d1bd1e3ed0a7c5b\
349c68802a1365081776371784a3c99b4ab7774eaa850176c7e9d1c8cda75827\
5e4ab4757030038b383714cd32c87c560ab2ecb8d102219ec16d0616544bcb2b\
651732d918a54ee364a155a488725ac7ce563e994b90e86e485ad50d52e0aab0
""")
self.check(Self.descending, radix: 15, ascii: """
0000000000000000000000000000000000000000000000000000000152b2d1a6\
b8a8c0121657243d73087ce18b51dc75b4205004346095046c5560a817deba1c\
d4a5a3105bc83eb096390746c90c20224a8317a34198e7cb73c7e970c60b5c74\
6a7d68177d9dd4e2c75c15d13b1646d63a900d38b4dc5286319dbb87c4a62e54\
bd6d6d4d86509dd7036a27ab6d0bb6807483e90ebc70d57282906edbb53123b3\
9129135e549279d96ae4b2a1c7147cc03e4b73a279854b5d2a009b6de5301ad4\
059d1ae0989433c36c9bbee5a3645c426e40848de409cd82d902da7de45c0bb2\
ab154e42536bca71849298d982c69e34e86a6a8b20990845809947073d753ba4\
370db27a2d22de47e12ab6e298b283e65b3d8b42e273650b315020dc1aa22960
""")
}
func test16() {
self.check(Self.ascending, radix: 16, ascii: """
fffefdfcfbfaf9f8f7f6f5f4f3f2f1f0efeeedecebeae9e8e7e6e5e4e3e2e1e0\
dfdedddcdbdad9d8d7d6d5d4d3d2d1d0cfcecdcccbcac9c8c7c6c5c4c3c2c1c0\
bfbebdbcbbbab9b8b7b6b5b4b3b2b1b0afaeadacabaaa9a8a7a6a5a4a3a2a1a0\
9f9e9d9c9b9a999897969594939291908f8e8d8c8b8a89888786858483828180\
7f7e7d7c7b7a797877767574737271706f6e6d6c6b6a69686766656463626160\
5f5e5d5c5b5a595857565554535251504f4e4d4c4b4a49484746454443424140\
3f3e3d3c3b3a393837363534333231302f2e2d2c2b2a29282726252423222120\
1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
""")
self.check(Self.descending, radix: 16, ascii: """
000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f\
202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f\
404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f\
606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f\
808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9f\
a0a1a2a3a4a5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebf\
c0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedf\
e0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff
""")
}
func test17() {
self.check(Self.ascending, radix: 17, ascii: """
0000000000124b16c3g69bbbag36b77367c8366826a1260aafe896c41e5bebd6\
eff1edf76b5c850269d547g2993fg898a7eg88g8db235g6c407d4898b5a17d05\
9g1d0fc9bgf991cagd36gae0bag2bg730e02b8265dg2e55825g7cdfe2fgedcg1\
ba3dcc62916e6d11ggf6c160e48154efaf86ce618584dba7d1049ge226f62945\
cgde056dffgb718cb2211bg5g72g77d5agd7e6b055e6b4ge71gg2e56be45c585\
e31a98e65adc1c4560b001595gee6a7ec3cdgfb6248a0e351c5fa7gd40bc4afd\
2cddf99e175db6fgf31545e48gfb055b4g39cca53b5a97f743922d73b7afb7d7\
4928154d92b20gg7992e38cb96c1dd4bea7c7728fgb1127e0e47469feag585g0
""")
self.check(Self.descending, radix: 17, ascii: """
0000000000000017ce9c05e067e38a806859ca9f32f4efb5bbc0b1443434a7fe\
11f6g3f2g2a7bd55278c6b700309c5bge3dead4e678ab3f9a664703f66f716cg\
5b0f53e1655cc321011f1bb33625b5d44580930a9687c4b2926aa7c1gcbc4g63\
7c70abfcb0f4bdcfcf7174c446a2417b77512bg9321849db9e8d78e616gd76c8\
bad838eb8085deb36c92839aee7569412499e53b92427c236dce21aga885bd0d\
67ecca7c6dgcdb3bdeb3569gg55a7age3ddb6gf122b89bafce283776af88gd6b\
63c8a6b7ab753cfd54cacgbd6cggf6fc12a29dc712bf067e0c0962d1f0e95abc\
1aa0038be0af74bb752866508e5b7463abfe155ac0e5a17f758733fa2f7c0fg0
""")
}
func test18() {
self.check(Self.ascending, radix: 18, ascii: """
0000000000000000000018bga551hha58097eef06aa64bdbh0172b1dcf80417e\
g30bdd9b1ac2bf53e416fgc92ef713dh5gfc36gcfa8961d4c4eef393d8c95hc4\
0bf67b02ag05e7g833b3g6372d4b45169d4693ee6h64h53h6f9c34105cchd1b7\
85h609326e8b38343d11a48cebcd7gd402h9d1gb4d9g74f33h1b6d5d47bd9bcf\
h477eb91g0dd00f428942a478b32bb0eeddb0ch9822e66dbfd615bg4598h7eca\
87f81ade8268f1c0fed0b0bh607g9dff3800a9ed58c0036d0258393463e561f1\
96ag9g9d2af8495ge2bg3d961a7c04gf931h399da9f8g0d7540b9458fag6d4g1\
85055ae5915ch6e98ab88g522b1cb92872cah62f92aa4c75ddg37ed0e80g746c
""")
self.check(Self.descending, radix: 18, ascii: """
000000000000000000000000270e4hdf6dde52265g40e1282b6aa8168f0963da\
a204h4758c9e66b1gf0d7829ad10gch037cbfh4ba69ce6ac12hbe8hf78gh56ac\
0hbfa1dgca543f87g84hbf49degbe3h24c31bab01fe5b1be1f62c93866gecd28\
4782bgdb95a257g94d5c7a8d8afhgb272aeg5g0gf9153d45b4e26dfa841fe13b\
a8991ead426ffdc8h73089bfc86fc703hf408ah1bg4haed5595fb6b2b80fh5e3\
dc0d9ghf5b82592g56773bef87fc7bhgafdf4208dbf79h84gh3e0bdfa5cdh664\
7a4e6a1cb51c653ae1ad97fg64c170a59120f1a703bb1a0c2g6gf83304c3d0g4\
2af3g30d227eegf3gfb234cdfh59bcgb73ehh1g6hbfeca767501ge43584gfcf9
""")
}
func test19() {
self.check(Self.ascending, radix: 19, ascii: """
0000000000000000000000000000017g2f692gg45a5gdf57gcg2g07g4h04bhfa\
f8c01abeh9d0da94477aa600ddg25953cbh2363a71ghfdehi84ce7782ba4h3i0\
3a3822ff9dg3hfh8h61cf785057g74ea5c4821g6ii4h020eif1992fihdh9hedf\
020e2dfi21cii026d675dh1819abb0h2bd231egc2h34ei7egf3f4fg2dh0c7422\
a26c52hgfe1cih2a6ahadie59ae8082c8e0ib75a3h9gdc10bh4d8969b7h57i38\
2fb4806i8829h9591ch498hhc7b7d4c9f4d0gb28g72419a2298b3fa9731a32dc\
d312cai90h6fi0g8401c1561f97gg2fia9822h6575ab83id41bab5cgbgihdaee\
7aib31f1gah964c8076a4a1c91ghb0bg7hb407f2h52e28c213d98b3156g85i51
""")
self.check(Self.descending, radix: 19, ascii: """
0000000000000000000000000000000002ff85ged5dcd5040bbea5e4dca9f325\
2d50797cg4a534i759233di0e13d9c05ic161ced73c61bf5i1b7eg831g16f2b3\
5b86g899a83fh5g0ac2id610ieidih0f571cf29dc56f8h812aggi0ga4f65hea6\
29ed2c3546e0f0269eh5ihae73d8a56hh3aa38bbf5dh33230cg394hdaa40ga3f\
6ii1baa7ag5acb1af0f2fb9cd681c8dc123ahh93cicii5f48c01558eg8gbf6c4\
771h4cb4fi896h5b28fgb5gh9b06i28dgfea807g01hh3c98dai86bg2aghi4f46\
61d2gc1b6eh2ahhd2dhdd3f0f0eae020hg28ae15bi58c6993f4b1310g9744aef\
101f49g24d393ah000ag8ifecbf05ba1de4977e694c9c90497cf4c70dh8caa34
""")
}
func test20() {
self.check(Self.ascending, radix: 20, ascii: """
00000000000000000000000000000000000000d5050cagd94ghbfad415d73775\
385hih85hd9d80ec925gehjg1j04f2hhiahd169328ai8099750j9jf64g3eg281\
863fi1cihc58jdec239iea6i88ci5640be2eddf81i0fj3005gib3ja486927438\
6b499cdjj20f29d033023fa1f790bd472c7654g8b4eia3caf829di82457dgd8e\
f03ch599i30j2bi0f383j43c59035c93d36g7h833ce0hd7555c378hh728j723b\
71j23d885j99j36eb72703a83a5418h5ha0bcai1f6724dabd294104ieff49f37\
ed043626hj5g7eccjjd76chd29g1a2520a88j370bcgac00a5j4h24dc168jgc16\
431i8ced8d553fa0jg40cd577ich5ce5a93e8i8jdfa192c27390cff0a87b2hc0
""")
self.check(Self.descending, radix: 20, ascii: """
000000000000000000000000000000000000000001cc1j30fcdbj1dgc663fbjb\
546f35de96ii52h53cd61cg1i4efi3e42idj30cebgf2b4j64971agf1a9d3fc58\
9beg7iaf27741i965c2ccbi4bcahf7hf3c6i8j5974a570gi9b4gfci570abd1b1\
ijij319a541dej23a5ce69gea7ge595c15gca2h75j6hc142b0ee47658d4gfe0e\
ej41j5hca7b66iji50ifhchb9aji636ifcig69h9fehce48206a1ae3hbfd52j39\
d9ad795jifief05d1ebf1387cfi2cef9cab12je6hb4g989971j0cjjg3f06eg55\
2f0h1370j335023gie3hd23a81c88ea6h1f7ega4e8373c24jc3fed84ig1d4d8b\
cbee83a9aah41b143dj910b9i1fd1chcf4278j5ic6j8c1dgg4i68d919hg55j0f
""")
}
func test21() {
self.check(Self.ascending, radix: 21, ascii: """
00000000000000000000000000000000000000000000025c52fbheeggjg8507d\
fje9hf92hjbbficeaf8fi1634i6dbc8ccc4bci9a754b580283fibjbkkbdg8080\
26g8e9h734gjj5547ek5hdafj86jab9kf90k9gg6ijiad7415f2eecba9k15891i\
i929h5478643id40cfhfj51737ga9ggh2281a726a517daefbjafa83kegkgc6gg\
e2a12973961j9d6ee925i231ja10046cka7j1ckg1391g5h35bj286a0ia14k0d3\
3b6c7bi2278fffj4674h6bcjhhi4bg0f65h5h36878023282j9jc9c131di2ake8\
ka3geadbckebhk979843g6ki6hbkh3a5h4k262h0g6f89k4896gk6aj93g8gje63\
409g09916bb8e39hi5ci6djciki7hbd192de689hfjcab3ca39ie0fhg21ea33ji
""")
self.check(Self.descending, radix: 21, ascii: """
00000000000000000000000000000000000000000000000006g6de0ai8b68b3i\
c5fjhf6jbg4j4j67h89ffkhead04h99kb290k718afgj8j6jf2f77e57cch210gd\
jf3f5h95kb3gd0f1jb06d307d06ha0ej2dge91ag1h756eahcabkjdfijd2d2a6c\
2144fa9173b69684gkkf8d0c31j3a5k5kab56h975172k04kfhf2h1d0ibb21kc9\
09ca372586ad9fghj3dk931f3bk76ca395ikf6g702631k63ke56hbhji67ib077\
h4883ghb1j6371j6e51e21de93db7ka84ae00d8k9c7a486kehbe572d246d3b1g\
601jjhe1e4e9c056agif5gbd928b9g469956g61d975f65kdbacjb4b360ggchej\
7cjb53cgag999edk1gd63eegh35bj1jk3g266052f70eei1c7h15d5ka51k0k4j6
""")
}
func test22() {
self.check(Self.ascending, radix: 22, ascii: """
000000000000000000000000000000000000000000000000000023icle03ja5d\
3hla1053987fc3i93924f5g21bledal5817e1ld8kd7hkl5ic03k8ji34bh740hf\
jgj2cald12k4b36b2ffd5j09eej95024514ig2db9h3j4i19efbk269k785alk7g\
hkd6fkf5e6804di2ek2gajf4j3db0l7cgi80jc1j68cib7211ada3616de8628ae\
k8g9bka30fbe1ahde1c036ch92bckdg6kgg858b214i8518e404b29682a897hf4\
3ibdi74gi642k7k14d5aj407j3agk5k1h04dfllc976ahdljcf64j18f14460hhd\
4g6ikd7kh496eij9llkeif94kf6g0eg73k6i5226fd2i22ee11hjddj7ah0cij5j\
kjklak3374ei0e8e0h32e55hef6d1e14b7gd05cgg9fii44kkckgd9fedh07h19e
""")
self.check(Self.descending, radix: 22, ascii: """
000000000000000000000000000000000000000000000000000000007i81bj9f\
d3800a8d8khk24l27ebd4eli42akghk19ac6hdg78eka61il30flg9alg1eieib3\
1d3jc7b4h690f22i4c186gh06950f3l50ldche6c6e86je71j81625hbi34jalgk\
6gbf893f216j93cb8cee3778elak46h23g5dcfi09k99cje2icijk1bl5f5gk90f\
792ejgbd93c7342chjlhl3gakh60bcg3i97k56bh6ladld8g4fcb7e96db32bclh\
i59769iaf9f5dg655dh2bcia0i7a7kl10bbh4l4563hkfhh1kkb9if5k9bk8c51g\
95kge1kch27jjfea8d37acg24ei5i0fafia4ga5lh2klibakg5kld8eljd3ciebc\
32i1bhkca7j1i4g5764lj4da091flf43j8ha4ec13j04abghh88cc8egki99f5dl
""")
}
func test23() {
self.check(Self.ascending, radix: 23, ascii: """
00000000000000000000000000000000000000000000000000000000000a4bj8\
bale0d596ej9c12m593176b2m0lj5jdelhj11f35ffkh37ja5c4ff45hcffi725e\
8cll095fbda26h4ab2mif00639jgmk0429bfl60a8j6fih25al8c04m9e9kgk9gf\
j6lhf2h8bk6hel39dh1ebb5ik04f4egcfghihj2idmg2ch783i026fmmgj2e2kf6\
85g0lkakj0ch8j0c2fel0ffg1k5eg0k0deimgfk4llii0i67g3ghd3ghmehkbbm8\
32hael03fh143mk2ebeek17mjk7513c1ff98dmhfg12khmfff1077jl6cgg83085\
7ce5lmh42bjmd10madl9m2m58kme472e3a8j79lj43d65m84be21l06h1h8hhd2f\
7c13423b97i3b63d627ig0hg3mh0406dem3i77jfifj76ade42d66f48i5cmkg4l
""")
self.check(Self.descending, radix: 23, ascii: """
000000000000000000000000000000000000000000000000000000000000001k\
k65fglbgdjki6jld3a8l24hf44hgikie82g6g326eam4g7m05593jg194ell5gl7\
9l9c1imblh904ggjegb50l86kjf86222lk342kac5h1kc2ii351hj8ll726g95fh\
0dckbdjg1mc045iif4gj44llj2l5g1chb7c2lm2m28a28kfci4kme5jmld5ie917\
603f5g8c5fjgd844339c82mjfi1113f71m2f7ebm524d6e35j7c2jbmefkiad36l\
a65ji1lm3le51ia8k5h2am2fi0ahc59g79ek3515be0a7f4788baejfcaf1da535\
3ifdl69b4lkim95fm03b064074aa3669cce3463128920f7lih06e7d0hk9ed3h1\
ma8251l5l6j6lf8557gk2dgh38h2b83ih6b0d594047g0mb9ik48lj602k7350h5
""")
}
func test24() {
self.check(Self.ascending, radix: 24, ascii: """
08ehhcaace58bei72i8ja72f5hjbgi07b6j65idm59bb5ni8eji1f6lc5g4d6h4g\
j19gm0ke7lb5d34abbg45fdahn43hmb9gdmh2bn8g529al6jn540id9cjhle26hl\
i7fm2bmcc1kj35583j173maele2kn5334k1gbm8kcajb2di0ff1hi1ad44adld34\
a0a32n07mgij7k607949577b62d1c0abfina2jck0l8n1m2mh7ih6mh67dmc2ca4\
58ihh733h1mbna818ifeh4b7im6j3gfchhfkj2jkcfd61e1i8inkliigg5f49967\
7c1dd7b2nidi934nc3n0k1gj3dj2gg4g22lhg6nm1720kd1imbmf7ia45039bhn5\
3lhc76memd39mlh4gbcim3a4n6a3fg86hgk1i29091ccj2md7h5gf2m92eg9l180
""")
self.check(Self.descending, radix: 24, ascii: """
00001jmkd0lc7da2k8135ecji7m7k0m7liie7778n9mkj5207l6ma5m1m620jl4c\
dkffmna0cfh56al9e6j5fh123bm7e905c825ndccabdmcj5582iedi5k04kg70a8\
j4i11addmi4m57ag8ke9bnh0b0475fcn1k7g3c684mg1l95i7b07ke3n2i781gj4\
n074501j3dg5ibmad4bii9ab3afjad8f54gb2ccm39ci7mgen0jdgichm0fc94ij\
jb122182hdldk1dgghn3i37fmbkd6je22e67434a2g7dk303hhdhd73gckndk6jf\
9lhnlb2c23gc5fe2ghl1akdn8bghdlaifln67a2aamb76a1gff2l9ljgib5ekf20\
a186gcecc5mf90ha3kfm52847lji8hfgmdbai334ndaflkj89l5g01ifgbmck32f
""")
}
func test25() {
self.check(Self.ascending, radix: 25, ascii: """
0000001116i8b7fj1i736fkim1bce6ni8gb1ag9gfdck9d8m99l9fcjcid7kh1g2\
agg07gbi4l96l1kimk6695bmlg78n14f9b78ga5k1jiob8o3cbon67b4n8hf99n0\
4ma261fbo4elg49ng3n4ngj2dooajc1a232ekkff4988bja96dac9jk8lfem4272\
m4c6gi8b0f94ko2ho3a3nol2g1gaolj59h3ecca6580mbi9ke2d5elnf8iiggggh\
6i577cb8i4e43666jb9fej0ie4m831aei13ij949j3kgk31h4gj2bi1he6bad3m1\
a48me9b339e826620n979k4e6k2dofkbaema73o8eeg1ko2hh8c63d14e8ljbkf1\
347nai6g70k7oh7l7acaniafne0ik28n8ecgjck4mk603bci1c1j25jghh2ffhlf
""")
self.check(Self.descending, radix: 25, ascii: """
000000000066cal0nadf16a8j535k0nfnlc93ce4nic5bo47d6m6gndjh4nl8ckd\
m28hg48f0d799n3b0f4g40mblf6iohkc033gh684m51lf9aieec9cj4e3ldcmd6m\
ikbk66g406g0mm2k4c9n9bholcjn657m542glj23i428d00no9ncoc0h9466fd2h\
gijgfd79l573699jhbo824adg0o2anedcn994l294l09a6bb4gf432nhdohd5iid\
fek6f83ogoan06chji1m3cehnj8kkd7dj6kc3c11fmdkdkmc0kng60f1hn86bafi\
obcc17777do66201d0fiki8168odog3b2743db1d8j8n7ni1o5c33e5nd1egjgcg\
2cm13m1l725a1kki4mh5511hhoaid9l3com82adk72eb3b987ef26lj8i800i14f
""")
}
func test26() {
self.check(Self.ascending, radix: 26, ascii: """
0000000000009ng7mg5k5b246fh6fejejo9g6je8amap102c3k88e96fdk7bbl0d\
l937l2ii3hf448chk6imkjd827pek6j6f3k1gjcb2nbgmeg2639a3ldlgmd14ek2\
ng6eh4194l1hp8dli4gl0k2m2lpna181bo90dfm7fh45jg1d5ijc591a754k6p28\
bkkojapjhi24fj9p3paf7fkle9j67mefn6h47hoec2lpmcdg96po0eenja8b1p8h\
34c36nckbl597ah5g424apke4h56kd2fho6nmph6cc66d32fhkg6944gk0e0i3og\
lhjoo6ncaha3a7b9pdg14b12hl18ap0aga2b9eil7ebbalj1j8hb69g1g1nkb1ln\
h5hgimc7k353o0im2kikcfcpi6m7mi6po47d3o6h868aoef5nb652fm0979373nm
""")
self.check(Self.descending, radix: 26, ascii: """
0000000000000002hge9dae3h4nj1m0oh96867me28a0b3cdd369i3aghejk8ngh\
ih3k7ikdi8bn7m8dgo61mp9363242dnnjk312npkjg86h066mhodcgddhf7mg4kb\
gl8i0o83gkapdl368765eggd64kckmpfoi7e1akc1a05dene3lg901o8g19040e5\
cjm2iokb5di020cgg0f66fh03l401gd1kgj0k7oc20lkf16pdf4514g81i56bd4p\
j488gghi26p6nd9g3fgjl04fj6kagbg55k79k0jlppiefaacb68jh56oiaeh8jhj\
lkm1nf88n6alama7187pg8gbn7iom3da54a1lkonoa08j4bh14gk496bfhf7bea4\
a60n43hp2ifl6m8ib8honnmafchinij6g2l7h4l72f28h0ck226obh7cmc2gid5p
""")
}
func test27() {
self.check(Self.ascending, radix: 27, ascii: """
00000000000000000aeifkl0aimlgppnb4l0l1nfad678kmgggpn06jphlkj12j3\
70gk5bbe9g333n3no69flqkpdfn2ndqaecgaonf443fimdg87m9h85meep2geki1\
9eok5p7k9b68pml7b210qac09cd39nb5j7p7qh76hj0d6je2m2319c6odd5a9q3p\
15nkob03nfkf6f79goj42f3b874f2bk4cobk0fl0jcnj52fjfphp52qihfl0fg0j\
jpbkf0eln0m8cp44bf0n6o9f6786852a188ja5o92ooieij326a9ic30021kdli6\
0n0hid0q88ad1aaog3enigclj8dli07d5i25aqf6g8jcihhe59183p3qa6o30g55\
115mde48b0pcohb5egmfc21nmi8gj5j1j4mphnigfdlg1g3pb1fga06i10mb6cpc
""")
self.check(Self.descending, radix: 27, ascii: """
00000000000000000000354kbj1913ok2akegiac121jfliqpemefhd28gnpo667\
gdo5fo8d6dko4a9idg99g8j60g2e9mken2h9eknnbnhq8ohd0ohjl9pm7ob3e84d\
5bf9d65lmofkqo893e67lc9llqmj5e2492ddq56k7bl8fdi6cb54lc0mi3o2adfa\
hcob50kj5n4dghjjggm8jn8kh5daq3l3cafbdfb7704jnoad8lfkm51b8paapqid\
3a22804o7kiba2c3p3bp7e6l9m7957k327o6dp6ejd45mgol72nle9ljfd3p8f1n\
hm367eqg328d1hifqi7a34pbhmce1fff8k385pa81e3ddaol4q53617gjhj57pll\
m1aqnhk27m5c780qjchbbah8j5iebfea81a0nnk249c80digj7b0ep25lqppeqj9
""")
}
func test28() {
self.check(Self.ascending, radix: 28, ascii: """
00000000000000000000011940hqcnpe5i8ehn6cf9c2f0qdd011eaflded1422e\
75634p2b6b92chjhi5hhj17dg9o0bbn24c2anpjq2fdikdqfgnqp0em6ornlbkm4\
4kajr457ir7f5mnrn5kaoo5o6m34f61gp10ra4g47pk8457hn4m0cpmqe8i6bm5g\
1pprale858hm4bp4j20a1pof3dco6f09dpmo2f56ld770b761k5k3e9min8i2la8\
9h90bi08n24m3pi37oiojg5pphr13mq8kdd4hfcnd8lmccraap804jjrim5m2qb9\
2mnq4r96h4br824079ppojp20nrkmn6jra3gnrrip79ipp2b5d2dd239reenhfib\
il1on3k9nncfhqfm0obdc9o3a1f6ilq96k8d1ikpmb0e3epn148mhjcoe78rnld4
""")
self.check(Self.descending, radix: 28, ascii: """
00000000000000000000000009p61rcc333fehpommgkqa37omq8oirgng1rj56b\
mr6qqjiodrcom1ok5boqe8comk6prpdpj3bcg2j15519ec3oarm25994fj709b6p\
rfbgpkdegi8nkk90fhejri2m6bcp332rnj04ghn6i9r6l1hqrj5do0gkp3r5c6gi\
gchhkhimhcni94m682j26rkgj84356eg2jf66155q0d7nqorn8kpoi6offn1inch\
5b1facgrbe7h1bmm90d1pih2o3i8kjg1mlb1b7h57b2bg4gpl6ppfl5cn8c0bkkr\
nbdg0k144dh8gp5n11een6585k8169b0i7a61p8d7q3f5f2e2dj190ge5f255487\
1hah1c54arhc5nlmngnlnio897p1f9kpd2a076k1kqqp4ld75h78j4qn0448fl3r
""")
}
func test29() {
self.check(Self.ascending, radix: 29, ascii: """
000000000000000000000000006qgf3bdirlm095h66i56k8k9p11hol00og9a39\
3mqh7jjofh6bk49k4pbo044bb7k05ppq1jjo8j2kqe8iagllm50r6cdsafdlh915\
k3iip9mns1o1o0rkaagpab2p8c50gd2cfc2gki5n448pjdsa5i6hsee9s2rp1n01\
fa1grb4914df5l5l6e9ag8g511og0203m9hncndck52s220rb2f2bpng9leg4mbo\