21 result = base_converter::hex_to_dec(input);
30 std::cerr <<
"Input: " << input <<
'\n' 31 <<
"Wanted: " << wanted <<
'\n' 32 <<
"Result: " << result <<
'\n';
42 result = base_converter::dec_to_hex(input);
51 std::cerr <<
"Input: " << input <<
'\n' 52 <<
"Wanted: " << wanted <<
'\n' 53 <<
"Result: " << result <<
'\n';
63 result = base_converter::bin_to_dec(input);
72 std::cerr <<
"Input: " << input <<
'\n' 73 <<
"Wanted: " << wanted <<
'\n' 74 <<
"Result: " << result <<
'\n';
84 result = base_converter::dec_to_bin(input);
93 std::cerr <<
"Input: " << input <<
'\n' 94 <<
"Wanted: " << wanted <<
'\n' 95 <<
"Result: " << result <<
'\n';
109 result = converter.
convert(input);
115 if (result == wanted)
118 std::cerr <<
"SourceBaseSet: " << source_set <<
'\n' 119 <<
"TargetBaseSet: " << target_set <<
'\n' 120 <<
"Input: " << input <<
'\n' 121 <<
"Wanted: " << wanted <<
'\n' 122 <<
"Result: " << result <<
'\n';
134 ensure(6,
hex2dec(
"ABCDEFABCDEFABCD",
"12379814471884843981"));
141 ensure(16,
dec2hex(
"12379814471884843981",
"ABCDEFABCDEFABCD"));
146 ensure(24,
bin2dec(
"100000010000101001011110110011",
"541235123"));
151 ensure(34,
dec2bin(
"541235123",
"100000010000101001011110110011"));
bool dec2hex(std::string const &input, std::string const &wanted)
bool any2any(std::string const &source_set, std::string const &target_set, std::string const &input, std::string const &wanted)
void ensure(int which, bool claim)
std::string convert(std::string value) const
bool dec2bin(std::string const &input, std::string const &wanted)
bool hex2dec(std::string const &input, std::string const &wanted)
bool bin2dec(std::string const &input, std::string const &wanted)