MCPcopy Create free account
hub / github.com/bblanchon/ArduinoJson / check

Function check

extras/tests/MsgPackDeserializer/doubleToFloat.cpp:11–18  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9
10template <typename T>
11static 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
20TEST_CASE("doubleToFloat()") {
21 check("\x40\x09\x21\xCA\xC0\x83\x12\x6F", 3.1415f);

Callers 1

doubleToFloat.cppFile · 0.70

Calls 2

doubleToFloatFunction · 0.85
fixEndiannessFunction · 0.85

Tested by

no test coverage detected