| 840 | } // namespace |
| 841 | |
| 842 | int |
| 843 | main(int const argc, char const* const* const argv) |
| 844 | { |
| 845 | if(argc < 2) |
| 846 | { |
| 847 | std::cerr << |
| 848 | "Usage: bench-direct [options...] <file>...\n" |
| 849 | "\n" |
| 850 | "Options: -t:[p][s] Test parsing, serialization or both\n" |
| 851 | " (default both)\n" |
| 852 | " -i:[b][u][s][o][d][r][n] Test the specified implementations\n" |
| 853 | " (b: Boost.JSON)\n" |
| 854 | " (s: Boost.JSON, convenient functions)\n" |
| 855 | " (o: Boost.JSON, stream operators)\n" |
| 856 | " (d: Boost.JSON, direct conversion)\n" |
| 857 | " (default all)\n" |
| 858 | " -a:[p][d] Memory allocation strategy\n" |
| 859 | " (p: memory pool)\n" |
| 860 | " (d: default strategy)\n" |
| 861 | " (default memory pool)\n" |
| 862 | " -n:<number> Number of trials (default 6)\n" |
| 863 | " -b:<branch> Branch label for boost implementations\n" |
| 864 | " -m:[i][p][n] Number parsing mode\n" |
| 865 | " (i: imprecise)\n" |
| 866 | " (p: precise)\n" |
| 867 | " (n: none)\n" |
| 868 | " (default imprecise)\n" |
| 869 | ; |
| 870 | |
| 871 | return 4; |
| 872 | } |
| 873 | |
| 874 | file_list vf; |
| 875 | |
| 876 | for(int i = 1; i < argc; ++i) |
| 877 | { |
| 878 | char const* s = argv[i]; |
| 879 | |
| 880 | if(*s == '-') |
| 881 | { |
| 882 | if( !parse_option(s + 1) ) |
| 883 | std::cerr |
| 884 | << "Unrecognized or incorrect option: '" << s << "'\n"; |
| 885 | } |
| 886 | else |
| 887 | { |
| 888 | string_view file_name = argv[i]; |
| 889 | vf.emplace_back( |
| 890 | file_item{ |
| 891 | file_name, load_file(s), find_supported_file(file_name)}); |
| 892 | } |
| 893 | } |
| 894 | |
| 895 | try |
| 896 | { |
| 897 | impl_list vi; |
| 898 | for( char impl: s_impls ) |
| 899 | for( char alloc: s_alloc ) |
nothing calls this directly
no test coverage detected