test: Fix narrowing errors in arary initialization

This commit is contained in:
Joshua Scott 2018-04-16 21:03:47 +01:00
parent d7f5196a36
commit 2632ef563c
1 changed files with 29 additions and 29 deletions

View File

@ -20,16 +20,16 @@ TEST_CASE("Control Message Serialization", "[control]")
const char expected_bytes[] = { const char expected_bytes[] = {
// Session ID // Session ID
0xCD, 0xAB, '\xCD', '\xAB',
// Unknown // Unknown
0x00, 0x00, 0x00, 0x00, '\x00', '\x00', '\x00', '\x00',
// Timestamp // Timestamp
0xDD, 0xCC, 0xBB, 0xAA, '\xDD', '\xCC', '\xBB', '\xAA',
// Milliseconds // Milliseconds
0xDD, 0xCC, 0xBB, 0xAA '\xDD', '\xCC', '\xBB', '\xAA'
}; };
REQUIRE(oss.str() == std::string(expected_bytes, sizeof(expected_bytes))); REQUIRE(oss.str() == std::string(expected_bytes, sizeof(expected_bytes)));
} }
@ -41,19 +41,19 @@ TEST_CASE("Control Message Serialization", "[control]")
const char expected_bytes[] = { const char expected_bytes[] = {
// Unknown // Unknown
0x00, 0x00, '\x00', '\x00',
// Unknown // Unknown
0x00, 0x00, 0x00, 0x00, '\x00', '\x00', '\x00', '\x00',
// Timestamp // Timestamp
0xDD, 0xCC, 0xBB, 0xAA, '\xDD', '\xCC', '\xBB', '\xAA',
// Milliseconds // Milliseconds
0xDD, 0xCC, 0xBB, 0xAA, '\xDD', '\xCC', '\xBB', '\xAA',
// Session ID // Session ID
0xCD, 0xAB '\xCD', '\xAB'
}; };
REQUIRE(oss.str() == std::string(expected_bytes, sizeof(expected_bytes))); REQUIRE(oss.str() == std::string(expected_bytes, sizeof(expected_bytes)));
} }
@ -65,13 +65,13 @@ TEST_CASE("Control Message Serialization", "[control]")
const char expected_bytes[] = { const char expected_bytes[] = {
// Session ID // Session ID
0xCD, 0xAB, '\xCD', '\xAB',
// Milliseconds // Milliseconds
0xCD, 0xAB, '\xCD', '\xAB',
// Minutes // Minutes
0xCD, 0xAB '\xCD', '\xAB'
}; };
REQUIRE(oss.str() == std::string(expected_bytes, sizeof(expected_bytes))); REQUIRE(oss.str() == std::string(expected_bytes, sizeof(expected_bytes)));
} }
@ -83,10 +83,10 @@ TEST_CASE("Control Message Serialization", "[control]")
const char expected_bytes[] = { const char expected_bytes[] = {
// Unknown // Unknown
0x00, 0x00, '\x00', '\x00',
// Timestamp // Timestamp
0xDD, 0xCC, 0xBB, 0xAA '\xDD', '\xCC', '\xBB', '\xAA'
}; };
REQUIRE(oss.str() == std::string(expected_bytes, sizeof(expected_bytes))); REQUIRE(oss.str() == std::string(expected_bytes, sizeof(expected_bytes)));
} }
@ -98,16 +98,16 @@ TEST_CASE("Control Message Deserialization", "[control]")
{ {
const char bytes[] = { const char bytes[] = {
// Session ID // Session ID
0xCD, 0xAB, '\xCD', '\xAB',
// Unknown // Unknown
0x00, 0x00, 0x00, 0x00, '\x00', '\x00', '\x00', '\x00',
// Timestamp // Timestamp
0xDD, 0xCC, 0xBB, 0xAA, '\xDD', '\xCC', '\xBB', '\xAA',
// Milliseconds // Milliseconds
0xDD, 0xCC, 0xBB, 0xAA '\xDD', '\xCC', '\xBB', '\xAA'
}; };
std::istringstream iss(std::string(bytes, sizeof(bytes))); std::istringstream iss(std::string(bytes, sizeof(bytes)));
@ -123,19 +123,19 @@ TEST_CASE("Control Message Deserialization", "[control]")
{ {
const char bytes[] = { const char bytes[] = {
// Unknown // Unknown
0x00, 0x00, '\x00', '\x00',
// Unknown // Unknown
0x00, 0x00, 0x00, 0x00, '\x00', '\x00', '\x00', '\x00',
// Timestamp // Timestamp
0xDD, 0xCC, 0xBB, 0xAA, '\xDD', '\xCC', '\xBB', '\xAA',
// Milliseconds // Milliseconds
0xDD, 0xCC, 0xBB, 0xAA, '\xDD', '\xCC', '\xBB', '\xAA',
// Session ID // Session ID
0xCD, 0xAB '\xCD', '\xAB'
}; };
std::istringstream iss(std::string(bytes, sizeof(bytes))); std::istringstream iss(std::string(bytes, sizeof(bytes)));
@ -151,13 +151,13 @@ TEST_CASE("Control Message Deserialization", "[control]")
{ {
const char bytes[] = { const char bytes[] = {
// Session ID // Session ID
0xCD, 0xAB, '\xCD', '\xAB',
// Milliseconds // Milliseconds
0xCD, 0xAB, '\xCD', '\xAB',
// Minutes // Minutes
0xCD, 0xAB '\xCD', '\xAB'
}; };
std::istringstream iss(std::string(bytes, sizeof(bytes))); std::istringstream iss(std::string(bytes, sizeof(bytes)));
@ -173,10 +173,10 @@ TEST_CASE("Control Message Deserialization", "[control]")
{ {
const char bytes[] = { const char bytes[] = {
// Unknown // Unknown
0x00, 0x00, '\x00', '\x00',
// Timestamp // Timestamp
0xDD, 0xCC, 0xBB, 0xAA '\xDD', '\xCC', '\xBB', '\xAA'
}; };
std::istringstream iss(std::string(bytes, sizeof(bytes))); std::istringstream iss(std::string(bytes, sizeof(bytes)));