#include "catch2/catch.hpp"
#include "cetlib/canonical_number.h"
#include <string>
Go to the source code of this file.
|
| TEST_CASE ("Conversion of string representations of numbers to canonical ""representations.") |
|
TEST_CASE |
( |
"Conversion of string representations of numbers to canonical ""representations." |
| ) |
|
Definition at line 18 of file canonical_number_test.cc.
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)