MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / test_convert

Function test_convert

tests/greaseweazle.cc:12–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10 (1 | ((val) >> 13) & 0xff), (1 | ((val) >> 20) & 0xff)
11
12static void test_convert(const Bytes& gwbytes, const Bytes& flbytes)
13{
14 Bytes gwtoflbytes = greaseweazleToFluxEngine(gwbytes, 2 * NS_PER_TICK);
15 Bytes fltogwbytes = fluxEngineToGreaseweazle(flbytes, 2 * NS_PER_TICK);
16
17 if (gwtoflbytes != flbytes)
18 {
19 std::cout << "Greaseweazle to FluxEngine conversion failed.\n";
20 std::cout << "Greaseweazle bytes:" << std::endl;
21 hexdump(std::cout, gwbytes);
22 std::cout << std::endl << "Produced this:" << std::endl;
23 hexdump(std::cout, gwtoflbytes);
24 std::cout << std::endl << "Expected this:" << std::endl;
25 hexdump(std::cout, flbytes);
26 abort();
27 }
28
29 if (fltogwbytes != gwbytes)
30 {
31 std::cout << "FluxEngine to Greaseweazle conversion failed.\n";
32 std::cout << "FluxEngine bytes:" << std::endl;
33 hexdump(std::cout, flbytes);
34 std::cout << std::endl << "Produced this:" << std::endl;
35 hexdump(std::cout, fltogwbytes);
36 std::cout << std::endl << "Expected this:" << std::endl;
37 hexdump(std::cout, gwbytes);
38 abort();
39 }
40}
41
42static void test_conversions()
43{

Callers 1

test_conversionsFunction · 0.70

Calls 3

greaseweazleToFluxEngineFunction · 0.85
fluxEngineToGreaseweazleFunction · 0.85
hexdumpFunction · 0.85

Tested by

no test coverage detected