Skip to content

Commit

Permalink
🔨 fixed test case
Browse files Browse the repository at this point in the history
One test case for CBOR and MessagePack assumed little endianess.
  • Loading branch information
nlohmann committed Apr 8, 2017
1 parent d62d48f commit 6f99d5b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
7 changes: 1 addition & 6 deletions test/src/unit-cbor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,14 +727,9 @@ TEST_CASE("CBOR")
const auto result = json::to_cbor(j);
CHECK(result == expected);

// restore value (reverse array for endianess)
double restored;
std::reverse(expected.begin(), expected.end());
memcpy(&restored, expected.data(), sizeof(double));
CHECK(restored == v);

// roundtrip
CHECK(json::from_cbor(result) == j);
CHECK(json::from_cbor(result) == v);
}
}

Expand Down
7 changes: 1 addition & 6 deletions test/src/unit-msgpack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,14 +676,9 @@ TEST_CASE("MessagePack")
const auto result = json::to_msgpack(j);
CHECK(result == expected);

// restore value (reverse array for endianess)
double restored;
std::reverse(expected.begin(), expected.end());
memcpy(&restored, expected.data(), sizeof(double));
CHECK(restored == v);

// roundtrip
CHECK(json::from_msgpack(result) == j);
CHECK(json::from_msgpack(result) == v);
}
}
}
Expand Down

0 comments on commit 6f99d5b

Please sign in to comment.