-
Notifications
You must be signed in to change notification settings - Fork 36
/
strtk_tokenizer_test.cpp
2905 lines (2518 loc) · 128 KB
/
strtk_tokenizer_test.cpp
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
/*
*****************************************************************
* String Toolkit Library *
* *
* String Tokenizer Test *
* Author: Arash Partow (2002-2020) *
* URL: http://www.partow.net/programming/strtk/index.html *
* *
* Copyright notice: *
* Free use of the String Toolkit Library is permitted under the *
* guidelines and in accordance with the most current version of *
* the MIT License. *
* http://www.opensource.org/licenses/MIT *
* *
*****************************************************************
*/
/*
Description: The String Tokenizer Test performs some very basic "unit test"-like
testing and code coverage upon the String Toolkit library's various
tokenization, splitting and parsing routines.
A silent/blank return indicates a positive test sweep, otherwise
any output indicates test failures.
*/
#include <cstddef>
#include <cstdlib>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <limits>
#include <cmath>
#include <cassert>
#include "strtk.hpp"
template <typename T>
inline bool not_equal(const T& t1,
const T& t2,
const T& epsilon = 0.0000000000001/*std::numeric_limits<T>::epsilon()*/)
{
if (t1 != t1) return true;
if (t2 != t2) return true;
return std::abs(t1 - t2) > (std::max(T(1.0),std::max(std::abs(t1),std::abs(t2))) * epsilon);
}
template<typename Predicate>
bool test_tokenizer_split(const Predicate& p,
const std::string& s,
const std::string& expected_result,
const bool compressed_delimiters = false)
{
std::string result;
strtk::std_string::token_vector_type tok_list;
strtk::split(p,
s,
std::back_inserter(tok_list),
(compressed_delimiters) ? strtk::split_options::compress_delimiters : strtk::split_options::default_mode);
for (std::size_t i = 0; i < tok_list.size(); ++i)
{
if (tok_list[i].first == tok_list[i].second)
result += "<>";
else
result += std::string(tok_list[i].first,tok_list[i].second);
if (i != (tok_list.size() - 1))
{
result += ",";
}
}
if (result != expected_result)
{
std::cout << "ERROR: result: " << result << "\t expected: " << expected_result << "\t";
}
return result == expected_result;
}
template<typename Tokenizer,typename Predicate>
bool test_tokenizer_itr(const Predicate& p,
const std::string& s,
const std::string& expected_result,
const bool compressed_delimiters = false)
{
std::string result;
Tokenizer stk(s,p,compressed_delimiters);
typename Tokenizer::iterator it = stk.begin();
while (stk.end() != it)
{
if ((*it).first == (*it).second)
result += "<>";
else
result += std::string((*it).first,(*it).second);
++it;
if (it != stk.end()) result += ",";
}
if (result != expected_result)
{
std::cout << "ERROR: result: " << result << "\t expected: " << expected_result << "\t";
}
return result == expected_result;
}
bool test_split_and_tokenizer()
{
struct test_pairs
{
std::string input;
std::string output;
};
/*
Test IO 1 and 2 : Single and Multi predicate tokenizing
Test IO 3 and 4 : Single and Multi predicate compressed delimiter tokenizing
*/
const std::size_t test_count = 40;
const test_pairs test_input_output1[test_count]
= {
{"d", "d"},
{"d|x", "d,x"},
{"d||x", "d,<>,x"},
{"|d||x", "<>,d,<>,x"},
{"d||x|", "d,<>,x,<>"},
{"|d||x|", "<>,d,<>,x,<>"},
{"||d||x||", "<>,<>,d,<>,x,<>,<>"},
{"||", "<>,<>,<>"},
{"|", "<>,<>"},
{"|||", "<>,<>,<>,<>"},
{"", ""},
{"dxd", "dxd"},
{"dx|xd", "dx,xd"},
{"dxd||xdx", "dxd,<>,xdx"},
{"|dx||x", "<>,dx,<>,x"},
{"d||xd|", "d,<>,xd,<>"},
{"|xd||dx|", "<>,xd,<>,dx,<>"},
{"||dd||xx||", "<>,<>,dd,<>,xx,<>,<>"},
{"abc", "abc"},
{"abc|xyz", "abc,xyz"},
{"abc||xyz", "abc,<>,xyz"},
{"|abc||xyz", "<>,abc,<>,xyz"},
{"abc||xyz|", "abc,<>,xyz,<>"},
{"|abc||xyz|", "<>,abc,<>,xyz,<>"},
{"||abc||xyz||", "<>,<>,abc,<>,xyz,<>,<>"},
{"||", "<>,<>,<>"},
{"|", "<>,<>"},
{"|||", "<>,<>,<>,<>"},
{"", ""},
{"abcxyzabc", "abcxyzabc"},
{"abcxyz|xyzabc", "abcxyz,xyzabc"},
{"abcxyzabc||xyzabcxyz", "abcxyzabc,<>,xyzabcxyz"},
{"|abcxyz||xyz", "<>,abcxyz,<>,xyz"},
{"abc||xyzabc|", "abc,<>,xyzabc,<>"},
{"|xyzabc||abcxyz|", "<>,xyzabc,<>,abcxyz,<>"},
{"||abcabc||xyzxyz||", "<>,<>,abcabc,<>,xyzxyz,<>,<>"},
{"a|ij|xyz", "a,ij,xyz"},
{"a||ij||xyz", "a,<>,ij,<>,xyz"},
{"|a||ij|||xyz", "<>,a,<>,ij,<>,<>,xyz"},
{"|a||ij|||xyz|", "<>,a,<>,ij,<>,<>,xyz,<>"}
};
const test_pairs test_input_output2[test_count]
= {
{"d", "d"},
{"d|x", "d,x"},
{"d?|x", "d,<>,x"},
{",d?-x", "<>,d,<>,x"},
{"d;?x|", "d,<>,x,<>"},
{"|d;;x-", "<>,d,<>,x,<>"},
{"_|d?|x;-", "<>,<>,d,<>,x,<>,<>"},
{"|_", "<>,<>,<>"},
{";", "<>,<>"},
{"?_,", "<>,<>,<>,<>"},
{"", ""},
{"dxd", "dxd"},
{"dx,xd", "dx,xd"},
{"dxd|,xdx", "dxd,<>,xdx"},
{";dx||x", "<>,dx,<>,x"},
{"d|;xd?", "d,<>,xd,<>"},
{"_xd,,dx;", "<>,xd,<>,dx,<>"},
{"__dd|_xx,;", "<>,<>,dd,<>,xx,<>,<>"},
{"abc", "abc"},
{"abc|xyz", "abc,xyz"},
{"abc?|xyz", "abc,<>,xyz"},
{",abc?-xyz", "<>,abc,<>,xyz"},
{"abc;?xyz|", "abc,<>,xyz,<>"},
{"|abc;;xyz-", "<>,abc,<>,xyz,<>"},
{"_|abc?|xyz;-", "<>,<>,abc,<>,xyz,<>,<>"},
{"|_", "<>,<>,<>"},
{";", "<>,<>"},
{"?_,", "<>,<>,<>,<>"},
{"", ""},
{"abcxyzabc", "abcxyzabc"},
{"abcxyz,xyzabc", "abcxyz,xyzabc"},
{"abcxyzabc|,xyzabcxyz", "abcxyzabc,<>,xyzabcxyz"},
{";abcxyz||xyz", "<>,abcxyz,<>,xyz"},
{"abc|;xyzabc?", "abc,<>,xyzabc,<>"},
{"_xyzabc,,abcxyz;", "<>,xyzabc,<>,abcxyz,<>"},
{"__abcabc|_xyzxyz,;", "<>,<>,abcabc,<>,xyzxyz,<>,<>"},
{"a|ij?xyz", "a,ij,xyz"},
{"a|_ij,;xyz", "a,<>,ij,<>,xyz"},
{"_a??ij;,|xyz", "<>,a,<>,ij,<>,<>,xyz"},
{"_a||ij,,?xyz_", "<>,a,<>,ij,<>,<>,xyz,<>"}
};
const test_pairs test_input_output3[test_count]
= {
{"d", "d"},
{"d|x", "d,x"},
{"d||x", "d,x"},
{"|d||x", "<>,d,x"},
{"d||x|", "d,x,<>"},
{"|d||x|", "<>,d,x,<>"},
{"||d||x||", "<>,d,x,<>"},
{"||", "<>,<>"},
{"|", "<>,<>"},
{"|||", "<>,<>"},
{"", ""},
{"dxd", "dxd"},
{"dx|xd", "dx,xd"},
{"dxd||xdx", "dxd,xdx"},
{"|dx||x", "<>,dx,x"},
{"d||xd|", "d,xd,<>"},
{"|xd||dx|", "<>,xd,dx,<>"},
{"||dd||xx||", "<>,dd,xx,<>"},
{"abc", "abc"},
{"abc|xyz", "abc,xyz"},
{"abc||xyz", "abc,xyz"},
{"|abc||xyz", "<>,abc,xyz"},
{"abc||xyz|", "abc,xyz,<>"},
{"|abc||xyz|", "<>,abc,xyz,<>"},
{"||abc||xyz||", "<>,abc,xyz,<>"},
{"||", "<>,<>"},
{"|", "<>,<>"},
{"|||", "<>,<>"},
{"", ""},
{"abcxyzabc", "abcxyzabc"},
{"abcxyz|xyzabc", "abcxyz,xyzabc"},
{"abcxyzabc||xyzabcxyz", "abcxyzabc,xyzabcxyz"},
{"|abcxyz||xyz", "<>,abcxyz,xyz"},
{"abc||xyzabc|", "abc,xyzabc,<>"},
{"|xyzabc||abcxyz|", "<>,xyzabc,abcxyz,<>"},
{"||abcabc||xyzxyz||", "<>,abcabc,xyzxyz,<>"},
{"a|ij|xyz", "a,ij,xyz"},
{"a||ij||xyz", "a,ij,xyz"},
{"|a||ij|||xyz", "<>,a,ij,xyz"},
{"|a||ij|||xyz|", "<>,a,ij,xyz,<>"}
};
const test_pairs test_input_output4[test_count]
= {
{"d", "d"},
{"d;x", "d,x"},
{"d|?x", "d,x"},
{",d_|x", "<>,d,x"},
{"d|;x|", "d,x,<>"},
{";d||x|", "<>,d,x,<>"},
{"|,d?|x;;", "<>,d,x,<>"},
{"|?", "<>,<>"},
{"|", "<>,<>"},
{"?,|", "<>,<>"},
{"", ""},
{"dxd", "dxd"},
{"dx,xd", "dx,xd"},
{"dxd?,xdx", "dxd,xdx"},
{"|dx;|x", "<>,dx,x"},
{"d|,xd_", "d,xd,<>"},
{";xd||dx|", "<>,xd,dx,<>"},
{"|?dd|,xx?_", "<>,dd,xx,<>"},
{"abc", "abc"},
{"abc;xyz", "abc,xyz"},
{"abc,,xyz", "abc,xyz"},
{"|abc;|xyz", "<>,abc,xyz"},
{"abc?|xyz,", "abc,xyz,<>"},
{"|abc||xyz|", "<>,abc,xyz,<>"},
{"||abc?|xyz_|", "<>,abc,xyz,<>"},
{"|,", "<>,<>"},
{"|", "<>,<>"},
{";,|", "<>,<>"},
{"", ""},
{"abcxyzabc", "abcxyzabc"},
{"abcxyz;xyzabc", "abcxyz,xyzabc"},
{"abcxyzabc|,xyzabcxyz", "abcxyzabc,xyzabcxyz"},
{"_abcxyz;?xyz", "<>,abcxyz,xyz"},
{"abc,|xyzabc|", "abc,xyzabc,<>"},
{"|xyzabc|?abcxyz,", "<>,xyzabc,abcxyz,<>"},
{"?|abcabc_|xyzxyz|_", "<>,abcabc,xyzxyz,<>"},
{"a,ij|xyz", "a,ij,xyz"},
{"a?|ij|,xyz", "a,ij,xyz"},
{"|a||ij|,?xyz", "<>,a,ij,xyz"},
{"?a|,ij|;_xyz|", "<>,a,ij,xyz,<>"}
};
typedef strtk::single_delimiter_predicate<std::string::value_type> single_predicate_type;
typedef strtk::multiple_char_delimiter_predicate multiple_predicate_type;
typedef strtk::std_string::tokenizer<single_predicate_type>::type tokenizer_type1;
typedef strtk::std_string::tokenizer<multiple_predicate_type>::type tokenizer_type2;
single_predicate_type single_predicate('|');
multiple_predicate_type multi_predicate("|?-,;_");
for (std::size_t i = 0; i < test_count; ++i)
{
std::string in = test_input_output1[i].input;
std::string out = test_input_output1[i].output;
if (!test_tokenizer_split(single_predicate, in, out))
{
std::cout << "Failed Split Test01 " << i << std::endl;
return false;
}
if (!test_tokenizer_itr<tokenizer_type1>(single_predicate, in, out))
{
std::cout << "Failed Iterator Test01 " << i << std::endl;
return false;
}
in = test_input_output2[i].input;
out = test_input_output2[i].output;
if (!test_tokenizer_split(multi_predicate, in, out))
{
std::cout << "Failed Split Test02 " << i << std::endl;
return false;
}
if (!test_tokenizer_itr<tokenizer_type2>(multi_predicate, in, out))
{
std::cout << "Failed Iterator Test02 " << i << std::endl;
return false;
}
in = test_input_output3[i].input;
out = test_input_output3[i].output;
if (!test_tokenizer_split(single_predicate, in, out, true))
{
std::cout << "Failed Compressed Delimiter Split Test01 " << i << std::endl;
return false;
}
if (!test_tokenizer_itr<tokenizer_type1>(single_predicate, in, out, true))
{
std::cout << "Failed Compressed Delimiter Iterator Test01 " << i << std::endl;
return false;
}
in = test_input_output4[i].input;
out = test_input_output4[i].output;
if (!test_tokenizer_split(multi_predicate, in, out, true))
{
std::cout << "Failed Compressed Delimiter Split Test02 " << i << std::endl;
return false;
}
if (!test_tokenizer_itr<tokenizer_type2>(multi_predicate, in, out, true))
{
std::cout << "Failed Compressed Delimiter Iterator Test02 " << i << std::endl;
return false;
}
}
return true;
}
bool test_tokenizer_options()
{
{
std::string s = "1xyz23ijk456abc";
std::string expected_token[] = { "1x", "23i", "456a", "" };
std::size_t expected_token_size = sizeof(expected_token) / sizeof(std::string);
std::deque<std::string> token_list;
strtk::tokenize_options::type tokenize_options = strtk::tokenize_options::include_1st_delimiter +
strtk::tokenize_options::compress_delimiters;
typedef strtk::std_string::tokenizer<strtk::multiple_char_delimiter_predicate>::type tokenizer_type;
const strtk::multiple_char_delimiter_predicate mcdp("abcijkxyz");
tokenizer_type tokenizer(s, mcdp, tokenize_options);
tokenizer_type::iterator itr = tokenizer.begin();
tokenizer_type::iterator end = tokenizer.end();
while (end != itr)
{
token_list.push_back(std::string((*itr).first,(*itr).second));
++itr;
}
if (token_list.size() != expected_token_size)
{
std::cout << "test_tokenizer_options() - I1stD expected number of tokens does not match parsed amount!" << std::endl;
return false;
}
for (std::size_t i = 0; i < expected_token_size; ++i)
{
if (expected_token[i] != token_list[i])
{
std::cout << "test_tokenizer_options() - I1stD Failed match @ " << i << std::endl;
return false;
}
}
}
{
std::string s = "1xyz23ijk456abc";
std::string expected_token[] = { "1xyz", "23ijk", "456abc", "" };
std::size_t expected_token_size = sizeof(expected_token) / sizeof(std::string);
std::deque<std::string> token_list;
strtk::tokenize_options::type tokenize_options = strtk::tokenize_options::include_all_delimiters;
typedef strtk::std_string::tokenizer<strtk::multiple_char_delimiter_predicate>::type tokenizer_type;
tokenizer_type tokenizer(s,strtk::multiple_char_delimiter_predicate("abcijkxyz"),tokenize_options);
tokenizer_type::iterator itr = tokenizer.begin();
tokenizer_type::iterator end = tokenizer.end();
while (end != itr)
{
token_list.push_back(std::string((*itr).first,(*itr).second));
++itr;
}
if (token_list.size() != expected_token_size)
{
std::cout << "test_tokenizer_options() - IAD expected number of tokens does not match parsed amount!" << std::endl;
return false;
}
for (std::size_t i = 0; i < expected_token_size; ++i)
{
if (expected_token[i] != token_list[i])
{
std::cout << "test_tokenizer_options() - IAD Failed match @ " << i << std::endl;
return false;
}
}
}
{
std::string data = "abc def";
strtk::single_delimiter_predicate<char> delimiter(' ');
typedef strtk::std_string::tokenizer<strtk::single_delimiter_predicate<char> >::type tokenizer_type;
tokenizer_type tokenizer(data,delimiter);
tokenizer_type::iterator itr = tokenizer.begin();
++itr;
itr = tokenizer.begin();
unsigned int count = 0;
while (tokenizer.end() != itr)
{
if (++count > 2)
{
std::cout << "test_tokenizer_options() - Failed iterator test." << std::endl;
return false;
}
++itr;
}
}
return true;
}
bool test_split_options()
{
{
std::string s = "1xyz23ijk456abc";
std::string expected_token[] = { "1x", "23i", "456a", "" };
std::size_t expected_token_size = sizeof(expected_token) / sizeof(std::string);
std::deque<std::string> token_list;
strtk::split_options::type split_options = strtk::split_options::include_1st_delimiter +
strtk::split_options::compress_delimiters;
strtk::split(strtk::multiple_char_delimiter_predicate("abcijkxyz"),
s,
strtk::range_to_type_back_inserter(token_list),
split_options);
if (token_list.size() != expected_token_size)
{
std::cout << "test_split_options() - I1stD expected number of tokens does not match parsed amount!" << std::endl;
return false;
}
for (std::size_t i = 0; i < expected_token_size; ++i)
{
if (expected_token[i] != token_list[i])
{
std::cout << "test_split_options() - I1stD Failed match @ " << i << std::endl;
return false;
}
}
}
{
std::string s = "1xyz23ijk456abc";
std::string expected_token[] = { "1xyz", "23ijk", "456abc", "" };
std::size_t expected_token_size = sizeof(expected_token) / sizeof(std::string);
std::deque<std::string> token_list;
strtk::split_options::type split_options = strtk::split_options::include_all_delimiters;
strtk::split(strtk::multiple_char_delimiter_predicate("abcijkxyz"),
s,
strtk::range_to_type_back_inserter(token_list),
split_options);
if (token_list.size() != expected_token_size)
{
std::cout << "test_split_options() - IAD expected number of tokens does not match parsed amount!" << std::endl;
return false;
}
for (std::size_t i = 0; i < expected_token_size; ++i)
{
if (expected_token[i] != token_list[i])
{
std::cout << "test_split_options() - IAD Failed match @ " << i << std::endl;
return false;
}
}
}
return true;
}
bool test_split_n()
{
std::string delimiters = " ,|\t_:!";
std::string data1 = "1234567890abcdefghijklmnopqrstuvwxyz";
std::string data2 = strtk::join(delimiters,data1.begin(),data1.end());
strtk::multiple_char_delimiter_predicate predicate(delimiters);
std::vector<std::string> strlist;
strlist.reserve(data1.size());
for (std::size_t i = 0; i < data1.size(); ++i)
{
if (i != strtk::split_n(predicate, data2, i, strtk::range_to_type_back_inserter(strlist)))
{
std::cout << "test_split_n() - Failed Test: " << i << std::endl;
return false;
}
}
return true;
}
bool test_empty_filter_itr()
{
std::string s = "a||c";
typedef strtk::std_string::token_vector_type str_list;
str_list sl;
strtk::single_delimiter_predicate<std::string::value_type> p('|');
strtk::std_string::tokenizer<>::type tok(s,p,true);
if (2 == for_each_token(s, tok, strtk::filter_non_empty_range< std::back_insert_iterator<str_list> >(std::back_inserter(sl))))
return true;
else
{
std::cout << "test_empty_filter_itr() - Failed Compressed Delimiter Test" << std::endl;
return false;
}
}
struct data_block
{
std::string d1;
char d2;
int d3;
unsigned int d4;
double d5;
float d6;
short d7;
unsigned short d8;
bool d9;
unsigned char d10;
void clear(const std::size_t& i)
{
if (i >= 1) d1 = "";
if (i >= 2) d2 = 0x00;
if (i >= 3) d3 = 0;
if (i >= 4) d4 = 0;
if (i >= 5) d5 = 0;
if (i >= 6) d6 = 0;
if (i >= 7) d7 = 7;
if (i >= 8) d8 = 0;
if (i >= 9) d9 = false;
if (i >= 10) d10 = 0x00;
}
bool operator==(const data_block& db)
{
return d1 == db.d1 &&
d2 == db.d2 &&
d3 == db.d3 &&
d4 == db.d4 &&
!not_equal(d5,db.d5) &&
!not_equal(d6,db.d6) &&
d7 == db.d7 &&
d8 == db.d8 &&
d9 == db.d9 &&
d10 == db.d10;
}
bool operator!=(const data_block& db)
{
return !this->operator ==(db);
}
};
inline void std_double_to_string(const double& d, std::string& s)
{
char buffer[128];
std::size_t sz = sprintf(buffer,"%20.19e",d);
buffer[sz] = 0;
s.assign(buffer);
}
inline bool strtk_isnan(const double& v)
{
volatile double d = v;
return d != d;
}
bool test_fast_convert()
{
{
int v = 0;
for (int i = -100000000; i < +100000000; ++i)
{
if (!strtk::fast::signed_numeric_convert(strtk::type_to_string(i), v, true))
{
std::cout << "test_fast_convert() - Failed Fast convert 1 i = " << i << std::endl;
}
if (i != v)
{
std::cout << "test_fast_convert() - Failed Fast convert 2 "
<< " i = " << i
<< " v = " << v << std::endl;
return false;
}
}
}
{
unsigned int v = 0;
for (unsigned int i = 0; i < 1000000000; ++i)
{
if (!strtk::fast::numeric_convert(strtk::type_to_string(i), v, true))
{
std::cout << "test_fast_convert() - Failed Fast convert 1 i = " << i << std::endl;
}
if (i != v)
{
std::cout << "test_fast_convert() - Failed Fast convert 2 "
<< "i = " << i
<< "v = " << v << std::endl;
return false;
}
}
}
{
std::string s[] = {
"0000000000000000", "1111111111111111", "2222222222222222", "3333333333333333", "4444444444444444",
"5555555555555555", "6666666666666666", "1234567890123456", "9876543210987654", "1919191919191919",
"00000000000000000", "11111111111111111", "22222222222222222", "33333333333333333", "44444444444444444",
"55555555555555555", "66666666666666666", "12345678901234567", "98765432109876543", "19191919191919191",
"000000000000000000", "111111111111111111", "222222222222222222", "333333333333333333", "444444444444444444",
"555555555555555555", "666666666666666666", "123456789012345677", "987654321098765432", "191919191919191919"
};
unsigned long long v[] = {
0000000000000000LL, 1111111111111111LL, 2222222222222222LL, 3333333333333333LL, 4444444444444444LL,
5555555555555555LL, 6666666666666666LL, 1234567890123456LL, 9876543210987654LL, 1919191919191919LL,
00000000000000000LL, 11111111111111111LL, 22222222222222222LL, 33333333333333333LL, 44444444444444444LL,
55555555555555555LL, 66666666666666666LL, 12345678901234567LL, 98765432109876543LL, 19191919191919191LL,
000000000000000000LL, 111111111111111111LL, 222222222222222222LL, 333333333333333333LL, 444444444444444444LL,
555555555555555555LL, 666666666666666666LL, 123456789012345677LL, 987654321098765432LL, 191919191919191919LL
};
for (std::size_t i = 0 ; i < (sizeof(s) / sizeof(std::string)); ++i)
{
unsigned long long t = 0;
strtk::fast::numeric_convert(s[i],t);
if (t != v[i])
{
strtk::fast::numeric_convert(s[i],t);
std::cout << "test_fast_convert() - Failed Fast convert Special Test unsigned long long "
<< " index = " << i
<< " t = " << t
<< " v[index] = " << v[i] << std::endl;
return false;
}
}
}
return true;
}
bool test_double_convert()
{
{
static const std::string fract10_str[] =
{
"0.0",
"1.0E+001", "1.0E+002", "1.0E+003", "1.0E+004", "1.0E+005", "1.0E+006", "1.0E+007", "1.0E+008", "1.0E+009", "1.0E+010",
"1.0E+011", "1.0E+012", "1.0E+013", "1.0E+014", "1.0E+015", "1.0E+016", "1.0E+017", "1.0E+018", "1.0E+019", "1.0E+020",
"1.0E+021", "1.0E+022", "1.0E+023", "1.0E+024", "1.0E+025", "1.0E+026", "1.0E+027", "1.0E+028", "1.0E+029", "1.0E+030",
"1.0E+031", "1.0E+032", "1.0E+033", "1.0E+034", "1.0E+035", "1.0E+036", "1.0E+037", "1.0E+038", "1.0E+039", "1.0E+040",
"1.0E+041", "1.0E+042", "1.0E+043", "1.0E+044", "1.0E+045", "1.0E+046", "1.0E+047", "1.0E+048", "1.0E+049", "1.0E+050",
"1.0E+051", "1.0E+052", "1.0E+053", "1.0E+054", "1.0E+055", "1.0E+056", "1.0E+057", "1.0E+058", "1.0E+059", "1.0E+060",
"1.0E+061", "1.0E+062", "1.0E+063", "1.0E+064", "1.0E+065", "1.0E+066", "1.0E+067", "1.0E+068", "1.0E+069", "1.0E+070",
"1.0E+071", "1.0E+072", "1.0E+073", "1.0E+074", "1.0E+075", "1.0E+076", "1.0E+077", "1.0E+078", "1.0E+079", "1.0E+080",
"1.0E+081", "1.0E+082", "1.0E+083", "1.0E+084", "1.0E+085", "1.0E+086", "1.0E+087", "1.0E+088", "1.0E+089", "1.0E+090",
"1.0E+091", "1.0E+092", "1.0E+093", "1.0E+094", "1.0E+095", "1.0E+096", "1.0E+097", "1.0E+098", "1.0E+099", "1.0E+100",
"1.0E+101", "1.0E+102", "1.0E+103", "1.0E+104", "1.0E+105", "1.0E+106", "1.0E+107", "1.0E+108", "1.0E+109", "1.0E+110",
"1.0E+111", "1.0E+112", "1.0E+113", "1.0E+114", "1.0E+115", "1.0E+116", "1.0E+117", "1.0E+118", "1.0E+119", "1.0E+120",
"1.0E+121", "1.0E+122", "1.0E+123", "1.0E+124", "1.0E+125", "1.0E+126", "1.0E+127", "1.0E+128", "1.0E+129", "1.0E+130",
"1.0E+131", "1.0E+132", "1.0E+133", "1.0E+134", "1.0E+135", "1.0E+136", "1.0E+137", "1.0E+138", "1.0E+139", "1.0E+140",
"1.0E+141", "1.0E+142", "1.0E+143", "1.0E+144", "1.0E+145", "1.0E+146", "1.0E+147", "1.0E+148", "1.0E+149", "1.0E+150",
"1.0E+151", "1.0E+152", "1.0E+153", "1.0E+154", "1.0E+155", "1.0E+156", "1.0E+157", "1.0E+158", "1.0E+159", "1.0E+160",
"1.0E+161", "1.0E+162", "1.0E+163", "1.0E+164", "1.0E+165", "1.0E+166", "1.0E+167", "1.0E+168", "1.0E+169", "1.0E+170",
"1.0E+171", "1.0E+172", "1.0E+173", "1.0E+174", "1.0E+175", "1.0E+176", "1.0E+177", "1.0E+178", "1.0E+179", "1.0E+180",
"1.0E+181", "1.0E+182", "1.0E+183", "1.0E+184", "1.0E+185", "1.0E+186", "1.0E+187", "1.0E+188", "1.0E+189", "1.0E+190",
"1.0E+191", "1.0E+192", "1.0E+193", "1.0E+194", "1.0E+195", "1.0E+196", "1.0E+197", "1.0E+198", "1.0E+199", "1.0E+200",
"1.0E+201", "1.0E+202", "1.0E+203", "1.0E+204", "1.0E+205", "1.0E+206", "1.0E+207", "1.0E+208", "1.0E+209", "1.0E+210",
"1.0E+211", "1.0E+212", "1.0E+213", "1.0E+214", "1.0E+215", "1.0E+216", "1.0E+217", "1.0E+218", "1.0E+219", "1.0E+220",
"1.0E+221", "1.0E+222", "1.0E+223", "1.0E+224", "1.0E+225", "1.0E+226", "1.0E+227", "1.0E+228", "1.0E+229", "1.0E+230",
"1.0E+231", "1.0E+232", "1.0E+233", "1.0E+234", "1.0E+235", "1.0E+236", "1.0E+237", "1.0E+238", "1.0E+239", "1.0E+240",
"1.0E+241", "1.0E+242", "1.0E+243", "1.0E+244", "1.0E+245", "1.0E+246", "1.0E+247", "1.0E+248", "1.0E+249", "1.0E+250",
"1.0E+251", "1.0E+252", "1.0E+253", "1.0E+254", "1.0E+255", "1.0E+256", "1.0E+257", "1.0E+258", "1.0E+259", "1.0E+260",
"1.0E+261", "1.0E+262", "1.0E+263", "1.0E+264", "1.0E+265", "1.0E+266", "1.0E+267", "1.0E+268", "1.0E+269", "1.0E+270",
"1.0E+271", "1.0E+272", "1.0E+273", "1.0E+274", "1.0E+275", "1.0E+276", "1.0E+277", "1.0E+278", "1.0E+279", "1.0E+280",
"1.0E+281", "1.0E+282", "1.0E+283", "1.0E+284", "1.0E+285", "1.0E+286", "1.0E+287", "1.0E+288", "1.0E+289", "1.0E+290",
"1.0E+291", "1.0E+292", "1.0E+293", "1.0E+294", "1.0E+295", "1.0E+296", "1.0E+297", "1.0E+298", "1.0E+299", "1.0E+300",
"1.0E+301", "1.0E+302", "1.0E+303", "1.0E+304", "1.0E+305", "1.0E+306", "1.0E+307", "1.0E+308"
};
const std::size_t dbl_size = sizeof(fract10_str) / sizeof(std::string);
bool result = true;
for (std::size_t i = 1; i < dbl_size; ++i)
{
double d = std::numeric_limits<double>::quiet_NaN();
if (!strtk::string_to_type_converter(fract10_str[i],d))
{
std::cout << "test_double_convert() exp10 test convert failure [" << i << "] "
<< "str: ["<< fract10_str[i] << "]" << std::endl;
result = false;
}
if (not_equal(d,std::pow(10.0,1.0 * i)))
{
std::cout << "test_double_convert() exp10 test value check failure [" << i << "] "
<< "str: [" << fract10_str[i] << "] "
<< "value: " << d << " "
<< "cmpv : " << std::pow(10.0,1.0 * i) << std::endl;
result= false;
}
}
if (!result)
return false;
}
{
static const std::string double_str[] =
{
"7379973.6624700", "+2187496.9290991", "384281.3720002",
"06603499.49182570", "-80173.0014819", "+00693.000285",
"-0.6366299", "+0.2335175000", "-00.6366299",
"+00.2335175000", "-000.6366299", "+000.2335175000",
"123.456e3", "123.456E3", "123.456e+3",
"123.456E+3", "123.456e03", "123.456E03",
"123.456e+03", "123.456E+03", "123.456e0003",
"123.456E0003", "123.456e+0003", "123.456E+0003",
"123.4560e3", "123.45600E3", "123.456000e+3",
"123.456000E+3", "123.4560000e03", "123.45600000E03",
"123.456000000e+03", "123.4560000000E+03", "123.45600000000e0003",
"123.456000000000E0003", "123.4560000000000e+0003", "123.45600000000000E+0003",
"+0123.456e+003", "-00123.456E+003", "+000123.45600E3",
"-123.456e3", "+123.456E3", "-123.456e+3",
"+123.456E+3", "-123.456e03", "+123.456E03",
"-123.456e123", "+123.456E123", "-123.456e+123",
"+123.456E+123", "-123.456e0123", "+123.456E0123",
"-123.456e+03", "+123.456E+03", "-123.456e0003",
"+123.456E0003", "-123.456e+0003", "+123.456E+0003",
"-123.4560e3", "+123.45600E3", "-123.456000e+3",
"+123.456000E+3", "-123.4560000e03", "+123.45600000E03",
"-123.456000000e+03", "+123.4560000000E+03", "-123.45600000000e0003",
"+123.456000000000E0003", "-123.4560000000000e+0003", "+123.45600000000000E+0003",
"-0123.456e+003", "+00123.456E+003", "-000123.45600E3",
"000000123.456e+0003", "0.0", "00.00",
"0.0e10", "0e+10", "0e-10",
"-0.0e10", "+0e10", "00e010",
"000.000", "0000.0000", "1234.",
"01.2", "0012.340", "00012.34500",
"0", "123", "0123",
"00123", "-123", "+123",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"+0", "+1", "+2", "+3", "+4", "+5", "+6", "+7", "+8", "+9",
"-0", "-1", "-2", "-3", "-4", "-5", "-6", "-7", "-8", "-9",
"0.0", "1.0", "2.0", "3.0", "4.0", "5.0", "6.0", "7.0", "8.0", "9.0",
"+0.0", "+1.0", "+2.0", "+3.0", "+4.0", "+5.0", "+6.0", "+7.0", "+8.0", "+9.0",
"-0.0", "-1.0", "-2.0", "-3.0", "-4.0", "-5.0", "-6.0", "-7.0", "-8.0", "-9.0",
".0e+0", ".1e+1", ".2e+2", ".3e+3", ".4e+4", ".5e+5", ".6e+6", ".7e+7", ".8e+8", ".9e+9",
".00e+0", ".01e+1", ".02e+2", ".03e+3", ".04e+4", ".05e+5", ".06e+6", ".07e+7", ".08e+8", ".09e+9",
".0e+00", ".1e+01", ".2e+02", ".3e+03", ".4e+04", ".5e+05", ".6e+06", ".7e+07", ".8e+08", ".9e+09",
".0E+0", ".1E+1", ".2E+2", ".3E+3", ".4E+4", ".5E+5", ".6E+6", ".7E+7", ".8E+8", ".9E+9",
".00E+0", ".01E+1", ".02E+2", ".03E+3", ".04E+4", ".05E+5", ".06E+6", ".07E+7", ".08E+8", ".09E+9",
".0E+00", ".1E+01", ".2E+02", ".3E+03", ".4E+04", ".5E+05", ".6E+06", ".7E+07", ".8E+08", ".9E+09",
"+.0e+0", "+.1e+1", "+.2e+2", "+.3e+3", "+.4e+4", "+.5e+5", "+.6e+6", "+.7e+7", "+.8e+8", "+.9e+9",
"-.0e+0", "-.1e+1", "-.2e+2", "-.3e+3", "-.4e+4", "-.5e+5", "-.6e+6", "-.7e+7", "-.8e+8", "-.9e+9",
"0.", "1.", "2.", "3.", "4.", "5.", "6.", "7.", "8.", "9.",
"+0.", "+1.", "+2.", "+3.", "+4.", "+5.", "+6.", "+7.", "+8.", "+9.",
"-0.", "-1.", "-2.", "-3.", "-4.", "-5.", "-6.", "-7.", "-8.", "-9.",
".0", ".1", ".2", ".3", ".4", ".5", ".6", ".7", ".8", ".9",
"-.0", "-.1", "-.2", "-.3", "-.4", "-.5", "-.6", "-.7", "-.8", "-.9",
"+.0", "+.1", "+.2", "+.3", "+.4", "+.5", "+.6", "+.7", "+.8", "+.9",
"+0.0f", "+1.0f", "+2.0f", "+3.0f", "+4.0f", "+5.0f", "+6.0f", "+7.0f", "+8.0f", "+9.0f",
"+0.0F", "+1.0F", "+2.0F", "+3.0F", "+4.0F", "+5.0F", "+6.0F", "+7.0F", "+8.0F", "+9.0F",
"+0.0l", "+1.0l", "+2.0l", "+3.0l", "+4.0l", "+5.0l", "+6.0l", "+7.0l", "+8.0l", "+9.0l",
"+0.0L", "+1.0L", "+2.0L", "+3.0L", "+4.0L", "+5.0L", "+6.0L", "+7.0L", "+8.0L", "+9.0L",
"-0.0f", "-1.0f", "-2.0f", "-3.0f", "-4.0f", "-5.0f", "-6.0f", "-7.0f", "-8.0f", "-9.0f",
"-0.0F", "-1.0F", "-2.0F", "-3.0F", "-4.0F", "-5.0F", "-6.0F", "-7.0F", "-8.0F", "-9.0F",
"-0.0l", "-1.0l", "-2.0l", "-3.0l", "-4.0l", "-5.0l", "-6.0l", "-7.0l", "-8.0l", "-9.0l",
"-0.0L", "-1.0L", "-2.0L", "-3.0L", "-4.0L", "-5.0L", "-6.0L", "-7.0L", "-8.0L", "-9.0L",
"+0.0e+1f", "+1.0e+1f", "+2.0e+1f", "+3.0e+1f", "+4.0e+1f", "+5.0e+1f", "+6.0e+1f", "+7.0e+1f", "+8.0e+1f", "+9.0e+1f",
"+0.0E-2F", "+1.0E-2F", "+2.0E-2F", "+3.0E-2F", "+4.0E-2F", "+5.0E-2F", "+6.0E-2F", "+7.0E-2F", "+8.0E-2F", "+9.0E-2F",
"+0.0e+3l", "+1.0e+3l", "+2.0e+3l", "+3.0e+3l", "+4.0e+3l", "+5.0e+3l", "+6.0e+3l", "+7.0e+3l", "+8.0e+3l", "+9.0e+3l",
"+0.0E-4L", "+1.0E-4L", "+2.0E-4L", "+3.0E-4L", "+4.0E-4L", "+5.0E-4L", "+6.0E-4L", "+7.0E-4L", "+8.0E-4L", "+9.0E-4L",
"-0.0e+5f", "-1.0e+5f", "-2.0e+5f", "-3.0e+5f", "-4.0e+5f", "-5.0e+5f", "-6.0e+5f", "-7.0e+5f", "-8.0e+5f", "-9.0e+5f",
"-0.0E-6F", "-1.0E-6F", "-2.0E-6F", "-3.0E-6F", "-4.0E-6F", "-5.0E-6F", "-6.0E-6F", "-7.0E-6F", "-8.0E-6F", "-9.0E-6F",
"-0.0e+7l", "-1.0e+7l", "-2.0e+7l", "-3.0e+7l", "-4.0e+7l", "-5.0e+7l", "-6.0e+7l", "-7.0e+7l", "-8.0e+7l", "-9.0e+7l",
"-0.0E-8L", "-1.0E-8L", "-2.0E-8L", "-3.0E-8L", "-4.0E-8L", "-5.0E-8L", "-6.0E-8L", "-7.0E-8L", "-8.0E-8L", "-9.0E-8L",
"0.1", "0.01", "0.001", "0.0001", "0.00001", "0.000001", "0.0000001", "0.00000001", "0.000000001",
"0.2", "0.02", "0.002", "0.0002", "0.00002", "0.000002", "0.0000002", "0.00000002", "0.000000002",
"0.3", "0.03", "0.003", "0.0003", "0.00003", "0.000003", "0.0000003", "0.00000003", "0.000000003",
"0.4", "0.04", "0.004", "0.0004", "0.00004", "0.000004", "0.0000004", "0.00000004", "0.000000004",
"0.5", "0.05", "0.005", "0.0005", "0.00005", "0.000005", "0.0000005", "0.00000005", "0.000000005",
"0.6", "0.06", "0.006", "0.0006", "0.00006", "0.000006", "0.0000006", "0.00000006", "0.000000006",
"0.7", "0.07", "0.007", "0.0007", "0.00007", "0.000007", "0.0000007", "0.00000007", "0.000000007",
"0.8", "0.08", "0.008", "0.0008", "0.00008", "0.000008", "0.0000008", "0.00000008", "0.000000008",
"0.9", "0.09", "0.009", "0.0009", "0.00009", "0.000009", "0.0000009", "0.00000009", "0.000000009",
"+0.1", "+0.01", "+0.001", "+0.0001", "+0.00001", "+0.000001", "+0.0000001", "+0.00000001", "+0.000000001",
"+0.2", "+0.02", "+0.002", "+0.0002", "+0.00002", "+0.000002", "+0.0000002", "+0.00000002", "+0.000000002",
"+0.3", "+0.03", "+0.003", "+0.0003", "+0.00003", "+0.000003", "+0.0000003", "+0.00000003", "+0.000000003",
"+0.4", "+0.04", "+0.004", "+0.0004", "+0.00004", "+0.000004", "+0.0000004", "+0.00000004", "+0.000000004",
"+0.5", "+0.05", "+0.005", "+0.0005", "+0.00005", "+0.000005", "+0.0000005", "+0.00000005", "+0.000000005",
"+0.6", "+0.06", "+0.006", "+0.0006", "+0.00006", "+0.000006", "+0.0000006", "+0.00000006", "+0.000000006",
"+0.7", "+0.07", "+0.007", "+0.0007", "+0.00007", "+0.000007", "+0.0000007", "+0.00000007", "+0.000000007",
"+0.8", "+0.08", "+0.008", "+0.0008", "+0.00008", "+0.000008", "+0.0000008", "+0.00000008", "+0.000000008",
"+0.9", "+0.09", "+0.009", "+0.0009", "+0.00009", "+0.000009", "+0.0000009", "+0.00000009", "+0.000000009",
"-0.1", "-0.01", "-0.001", "-0.0001", "-0.00001", "-0.000001", "-0.0000001", "-0.00000001", "-0.000000001",
"-0.2", "-0.02", "-0.002", "-0.0002", "-0.00002", "-0.000002", "-0.0000002", "-0.00000002", "-0.000000002",
"-0.3", "-0.03", "-0.003", "-0.0003", "-0.00003", "-0.000003", "-0.0000003", "-0.00000003", "-0.000000003",
"-0.4", "-0.04", "-0.004", "-0.0004", "-0.00004", "-0.000004", "-0.0000004", "-0.00000004", "-0.000000004",
"-0.5", "-0.05", "-0.005", "-0.0005", "-0.00005", "-0.000005", "-0.0000005", "-0.00000005", "-0.000000005",
"-0.6", "-0.06", "-0.006", "-0.0006", "-0.00006", "-0.000006", "-0.0000006", "-0.00000006", "-0.000000006",
"-0.7", "-0.07", "-0.007", "-0.0007", "-0.00007", "-0.000007", "-0.0000007", "-0.00000007", "-0.000000007",
"-0.8", "-0.08", "-0.008", "-0.0008", "-0.00008", "-0.000008", "-0.0000008", "-0.00000008", "-0.000000008",
"-0.9", "-0.09", "-0.009", "-0.0009", "-0.00009", "-0.000009", "-0.0000009", "-0.00000009", "-0.000000009",
"1.01", "0.101", "1.0101", "0.10101", "1.010101", "0.1010101", "1.01010101", "1.101010101",
"2.02", "0.202", "2.0202", "0.20202", "2.020202", "0.2020202", "2.02020202", "2.202020202",
"3.03", "0.303", "3.0303", "0.30303", "3.030303", "0.3030303", "3.03030303", "3.303030303",
"4.04", "0.404", "4.0404", "0.40404", "4.040404", "0.4040404", "4.04040404", "4.404040404",
"5.05", "0.505", "5.0505", "0.50505", "5.050505", "0.5050505", "5.05050505", "5.505050505",
"6.06", "0.606", "6.0606", "0.60606", "6.060606", "0.6060606", "6.06060606", "6.606060606",
"7.07", "0.707", "7.0707", "0.70707", "7.070707", "0.7070707", "7.07070707", "7.707070707",
"8.08", "0.808", "8.0808", "0.80808", "8.080808", "0.8080808", "8.08080808", "8.808080808",
"9.09", "0.909", "9.0909", "0.90909", "9.090909", "0.9090909", "9.09090909", "9.909090909",
"+1.01", "+0.101", "+1.0101", "+0.10101", "+1.010101", "+0.1010101", "+1.01010101", "+1.101010101",
"+2.02", "+0.202", "+2.0202", "+0.20202", "+2.020202", "+0.2020202", "+2.02020202", "+2.202020202",
"+3.03", "+0.303", "+3.0303", "+0.30303", "+3.030303", "+0.3030303", "+3.03030303", "+3.303030303",
"+4.04", "+0.404", "+4.0404", "+0.40404", "+4.040404", "+0.4040404", "+4.04040404", "+4.404040404",
"+5.05", "+0.505", "+5.0505", "+0.50505", "+5.050505", "+0.5050505", "+5.05050505", "+5.505050505",
"+6.06", "+0.606", "+6.0606", "+0.60606", "+6.060606", "+0.6060606", "+6.06060606", "+6.606060606",
"+7.07", "+0.707", "+7.0707", "+0.70707", "+7.070707", "+0.7070707", "+7.07070707", "+7.707070707",
"+8.08", "+0.808", "+8.0808", "+0.80808", "+8.080808", "+0.8080808", "+8.08080808", "+8.808080808",
"+9.09", "+0.909", "+9.0909", "+0.90909", "+9.090909", "+0.9090909", "+9.09090909", "+9.909090909",
"-1.01", "-0.101", "-1.0101", "-0.10101", "-1.010101", "-0.1010101", "-1.01010101", "-1.101010101",
"-2.02", "-0.202", "-2.0202", "-0.20202", "-2.020202", "-0.2020202", "-2.02020202", "-2.202020202",
"-3.03", "-0.303", "-3.0303", "-0.30303", "-3.030303", "-0.3030303", "-3.03030303", "-3.303030303",
"-4.04", "-0.404", "-4.0404", "-0.40404", "-4.040404", "-0.4040404", "-4.04040404", "-4.404040404",
"-5.05", "-0.505", "-5.0505", "-0.50505", "-5.050505", "-0.5050505", "-5.05050505", "-5.505050505",
"-6.06", "-0.606", "-6.0606", "-0.60606", "-6.060606", "-0.6060606", "-6.06060606", "-6.606060606",
"-7.07", "-0.707", "-7.0707", "-0.70707", "-7.070707", "-0.7070707", "-7.07070707", "-7.707070707",
"-8.08", "-0.808", "-8.0808", "-0.80808", "-8.080808", "-0.8080808", "-8.08080808", "-8.808080808",
"-9.09", "-0.909", "-9.0909", "-0.90909", "-9.090909", "-0.9090909", "-9.09090909", "-9.909090909",
"+inf", "-inf",
"+INF", "-INF",
"+1.0#inf", "-1.0#inf",
"+1.0#INF", "-1.0#INF",
"+infinity", "-infinity",
"+INFINITY", "-INFINITY",
"+1.0#infinity", "-1.0#infinity",
"+1.0#INFINITY", "-1.0#INFINITY",
"NAN", "nan",
"1.0#NAN", "1.0#nan"
};
static const double d[] =
{
7379973.6624700, +2187496.9290991, 384281.3720002,
06603499.49182570, -80173.0014819, +00693.000285,
-0.6366299, +0.2335175000, -00.6366299,
+00.2335175000, -000.6366299, +000.2335175000,
123.456e3, 123.456E3, 123.456e+3,
123.456E+3, 123.456e03, 123.456E03,
123.456e+03, 123.456E+03, 123.456e0003,
123.456E0003, 123.456e+0003, 123.456E+0003,
123.4560e3, 123.45600E3, 123.456000e+3,
123.456000E+3, 123.4560000e03, 123.45600000E03,
123.456000000e+03, 123.4560000000E+03, 123.45600000000e0003,
123.456000000000E0003, 123.4560000000000e+0003, 123.45600000000000E+0003,
+0123.456e+003, -00123.456E+003, +000123.45600E3,
-123.456e3, +123.456E3, -123.456e+3,
+123.456E+3, -123.456e03, +123.456E03,
-123.456e123, +123.456E123, -123.456e+123,
+123.456E+123, -123.456e0123, +123.456E0123,
-123.456e+03, +123.456E+03, -123.456e0003,
+123.456E0003, -123.456e+0003, +123.456E+0003,
-123.4560e3, +123.45600E3, -123.456000e+3,
+123.456000E+3, -123.4560000e03, +123.45600000E03,
-123.456000000e+03, +123.4560000000E+03, -123.45600000000e0003,
+123.456000000000E0003, -123.4560000000000e+0003, +123.45600000000000E+0003,
-123.456e+003, +123.456E+003, -123.45600E3,
123.456e+0003, 0.0, 0.0,
0.0, 0.0, 0.0,
0.0, 0.0, 0.0,
0.0, 0.0, 1234.,
1.2, 12.34, 12.34500,
0, 123, 123,
123, -123, +123,
0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0,
+0.0, +1.0, +2.0, +3.0, +4.0, +5.0, +6.0, +7.0, +8.0, +9.0,
-0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0,
0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0,
+0.0, +1.0, +2.0, +3.0, +4.0, +5.0, +6.0, +7.0, +8.0, +9.0,
-0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0,
.0e+0, .1e+1, .2e+2, .3e+3, .4e+4, .5e+5, .6e+6, .7e+7, .8e+8, .9e+9,
.00e+0, .01e+1, .02e+2, .03e+3, .04e+4, .05e+5, .06e+6, .07e+7, .08e+8, .09e+9,
.0e+00, .1e+01, .2e+02, .3e+03, .4e+04, .5e+05, .6e+06, .7e+07, .8e+08, .9e+09,
.0E+0, .1E+1, .2E+2, .3E+3, .4E+4, .5E+5, .6E+6, .7E+7, .8E+8, .9E+9,
.00E+0, .01E+1, .02E+2, .03E+3, .04E+4, .05E+5, .06E+6, .07E+7, .08E+8, .09E+9,
.0E+00, .1E+01, .2E+02, .3E+03, .4E+04, .5E+05, .6E+06, .7E+07, .8E+08, .9E+09,
+.0e+0, +.1e+1, +.2e+2, +.3e+3, +.4e+4, +.5e+5, +.6e+6, +.7e+7, +.8e+8, +.9e+9,
-.0e+0, -.1e+1, -.2e+2, -.3e+3, -.4e+4, -.5e+5, -.6e+6, -.7e+7, -.8e+8, -.9e+9,
0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0,
+0.0, +1.0, +2.0, +3.0, +4.0, +5.0, +6.0, +7.0, +8.0, +9.0,
-0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0,
0.0, 0.1, 0.2, 0.3, 0.4, 0.5 , 0.6, 0.7, 0.8, 0.9,
-0.0, -0.1, -0.2, -0.3, -0.4, -0.5, -0.6, -0.7, -0.8, -0.9,
+0.0, +0.1, +0.2, +0.3, +0.4, +0.5, +0.6, +0.7, +0.8, +0.9,
+0.0, +1.0, +2.0, +3.0, +4.0, +5.0, +6.0, +7.0, +8.0, +9.0,
+0.0, +1.0, +2.0, +3.0, +4.0, +5.0, +6.0, +7.0, +8.0, +9.0,
+0.0, +1.0, +2.0, +3.0, +4.0, +5.0, +6.0, +7.0, +8.0, +9.0,
+0.0, +1.0, +2.0, +3.0, +4.0, +5.0, +6.0, +7.0, +8.0, +9.0,
-0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0,
-0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0,
-0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0,
-0.0, -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0,
+0.0e+1, +1.0e+1, +2.0e+1, +3.0e+1, +4.0e+1, +5.0e+1, +6.0e+1, +7.0e+1, +8.0e+1, +9.0e+1,
+0.0E-2, +1.0E-2, +2.0E-2, +3.0E-2, +4.0E-2, +5.0E-2, +6.0E-2, +7.0E-2, +8.0E-2, +9.0E-2,
+0.0e+3, +1.0e+3, +2.0e+3, +3.0e+3, +4.0e+3, +5.0e+3, +6.0e+3, +7.0e+3, +8.0e+3, +9.0e+3,
+0.0E-4, +1.0E-4, +2.0E-4, +3.0E-4, +4.0E-4, +5.0E-4, +6.0E-4, +7.0E-4, +8.0E-4, +9.0E-4,
-0.0e+5, -1.0e+5, -2.0e+5, -3.0e+5, -4.0e+5, -5.0e+5, -6.0e+5, -7.0e+5, -8.0e+5, -9.0e+5,
-0.0E-6, -1.0E-6, -2.0E-6, -3.0E-6, -4.0E-6, -5.0E-6, -6.0E-6, -7.0E-6, -8.0E-6, -9.0E-6,
-0.0e+7, -1.0e+7, -2.0e+7, -3.0e+7, -4.0e+7, -5.0e+7, -6.0e+7, -7.0e+7, -8.0e+7, -9.0e+7,
-0.0E-8, -1.0E-8, -2.0E-8, -3.0E-8, -4.0E-8, -5.0E-8, -6.0E-8, -7.0E-8, -8.0E-8, -9.0E-8,