103 {
106 r.first_failure = nullptr;
107
109
110 for (fl::size i = 0; i <
sizeof(
state.parse_cases) /
sizeof(
state.parse_cases[0]); ++i) {
111 const ParseCase& c =
state.parse_cases[i];
112 fl::size consumed = 0;
113 const fl::u32 actual =
115 const bool value_ok = c.exact
116 ? actual == c.expected_bits
119 c.expected_bits, actual);
120 }
121
122 for (fl::size i = 0; i <
sizeof(
state.format_cases) /
sizeof(
state.format_cases[0]); ++i) {
123 const FormatCase& c =
state.format_cases[i];
125 recordCheck(r, c.expected_text, actual == c.expected_text,
126 c.bits, c.bits);
127 }
128
129 for (fl::size i = 0; i <
sizeof(
state.round_trip_bits) /
sizeof(
state.round_trip_bits[0]); ++i) {
130 const fl::u32 expected =
state.round_trip_bits[i];
132 const fl::u32 actual =
135 expected, actual);
136 }
137
138 fl::size consumed = 123u;
140 recordCheck(r,
"nan-reject", consumed == 0u, 0u,
static_cast<fl::u32
>(consumed));
141
142 r.success = r.tests_failed == 0u;
143 return r;
144}
const char * c_str() const FL_NO_EXCEPT
fl::size size() const FL_NO_EXCEPT
Ieee754CaseState & ieee754CaseState()
void recordCheck(Result &r, const char *name, bool passed, fl::u32 expected=0, fl::u32 actual=0) FL_NO_EXCEPT
bool withinOneUlp(fl::u32 actual, fl::u32 expected) FL_NO_EXCEPT
u32 ieee754_parse_decimal(const char *s, fl::size len, fl::size *consumed) FL_NO_EXCEPT
Parse a decimal floating-point number into IEEE 754 single-precision bits.
size_t strlen(const char *s) FL_NO_EXCEPT
fl::string ieee754_format_decimal(u32 bits, int precision) FL_NO_EXCEPT
Format IEEE 754 single-precision bits as decimal text.