| 9 | |
| 10 | template <typename T> |
| 11 | static void check(const char* input, T expected) { |
| 12 | T actual; |
| 13 | uint8_t* f = reinterpret_cast<uint8_t*>(&actual); |
| 14 | const uint8_t* d = reinterpret_cast<const uint8_t*>(input); |
| 15 | doubleToFloat(d, f); |
| 16 | fixEndianness(actual); |
| 17 | CHECK(actual == expected); |
| 18 | } |
| 19 | |
| 20 | TEST_CASE("doubleToFloat()") { |
| 21 | check("\x40\x09\x21\xCA\xC0\x83\x12\x6F", 3.1415f); |
no test coverage detected