1 #include "catch2/catch.hpp" 18 TEST_CASE(
"Conversion of string representations of numbers to canonical " 31 CHECK(
becomes(
"123456",
"123456"));
32 CHECK(
becomes(
"12345678",
"1.2345678e7"));
34 CHECK(
becomes(
".12",
"1.2e-1"));
35 CHECK(
becomes(
"12E4",
"120000"));
36 CHECK(
becomes(
"12E5",
"1.2e6"));
37 CHECK(
becomes(
"12.000E5",
"1.2e6"));
38 CHECK(
becomes(
"12E-4",
"1.2e-3"));
49 CHECK(!
becomes(
"0x123abx",
""));
50 CHECK(!
becomes(
"+0x123ab",
""));
57 CHECK(
becomes(
"0x123ab",
"74667"));
58 CHECK(
becomes(
"0x123DE",
"74718"));
59 CHECK(
becomes(
"0X123ab",
"74667"));
60 CHECK(
becomes(
"0X00123De",
"74718"));
61 CHECK(
becomes(
"0x1234567890",
"7.818749352e10"));
65 CHECK(
becomes(
"0b01101",
"13"));
66 CHECK(
becomes(
"0b1000110100101100011001",
"2.312985e6"));
void becomes(std::string const &input, std::string const &wanted)
bool canonical_number(std::string const &value, std::string &result)
TEST_CASE("Conversion of string representations of numbers to canonical ""representations.")