Try again to fix this endianness issue.

llvm-svn: 272440
This commit is contained in:
Zachary Turner 2016-06-10 22:12:18 +00:00
parent b98294d006
commit d4c1efcb69
1 changed files with 15 additions and 17 deletions

View File

@ -316,17 +316,15 @@ TEST(MappedBlockStreamTest, TestWriteThenRead) {
StringRef ZStr[] = {"Zero Str", ""};
StringRef FStr[] = {"Fixed Str", ""};
ArrayRef<uint8_t> byteArray[] = {{'1', '2'}, {'0', '0'}};
ArrayRef<support::ulittle32_t> intArray[] = {
{ulittle32_t(890723408), ulittle32_t(29082234)},
{ulittle32_t(0), ulittle32_t(0)}};
ArrayRef<uint32_t> intArray[] = {{890723408, 29082234}, {0, 0}};
StreamReader Reader(S);
StreamWriter Writer(S);
EXPECT_NO_ERROR(Writer.writeInteger(u16[0]));
EXPECT_NO_ERROR(Reader.readInteger(u16[1]));
EXPECT_EQ(u16[0], u16[1]);
EXPECT_EQ(DataBytes,
std::vector<uint8_t>({0, 0x7A, 0xEC, 0, 0, 0, 0, 0, 0, 0}));
EXPECT_EQ(std::vector<uint8_t>({0, 0x7A, 0xEC, 0, 0, 0, 0, 0, 0, 0}),
DataBytes);
Reader.setOffset(0);
Writer.setOffset(0);
@ -334,8 +332,8 @@ TEST(MappedBlockStreamTest, TestWriteThenRead) {
EXPECT_NO_ERROR(Writer.writeInteger(u32[0]));
EXPECT_NO_ERROR(Reader.readInteger(u32[1]));
EXPECT_EQ(u32[0], u32[1]);
EXPECT_EQ(DataBytes,
std::vector<uint8_t>({0x17, 0x5C, 0x50, 0, 0, 0, 0x35, 0, 0, 0}));
EXPECT_EQ(std::vector<uint8_t>({0x17, 0x5C, 0x50, 0, 0, 0, 0x35, 0, 0, 0}),
DataBytes);
Reader.setOffset(0);
Writer.setOffset(0);
@ -343,8 +341,8 @@ TEST(MappedBlockStreamTest, TestWriteThenRead) {
EXPECT_NO_ERROR(Writer.writeEnum(Enum[0]));
EXPECT_NO_ERROR(Reader.readEnum(Enum[1]));
EXPECT_EQ(Enum[0], Enum[1]);
EXPECT_EQ(DataBytes,
std::vector<uint8_t>({0x2C, 0x60, 0x4A, 0, 0, 0, 0, 0, 0, 0}));
EXPECT_EQ(std::vector<uint8_t>({0x2C, 0x60, 0x4A, 0, 0, 0, 0, 0, 0, 0}),
DataBytes);
Reader.setOffset(0);
Writer.setOffset(0);
@ -352,8 +350,9 @@ TEST(MappedBlockStreamTest, TestWriteThenRead) {
EXPECT_NO_ERROR(Writer.writeZeroString(ZStr[0]));
EXPECT_NO_ERROR(Reader.readZeroString(ZStr[1]));
EXPECT_EQ(ZStr[0], ZStr[1]);
EXPECT_EQ(DataBytes, std::vector<uint8_t>(
{'r', 'e', 'Z', ' ', 'S', 't', 'o', 'r', 0, 0}));
EXPECT_EQ(
std::vector<uint8_t>({'r', 'e', 'Z', ' ', 'S', 't', 'o', 'r', 0, 0}),
DataBytes);
Reader.setOffset(0);
Writer.setOffset(0);
@ -361,8 +360,9 @@ TEST(MappedBlockStreamTest, TestWriteThenRead) {
EXPECT_NO_ERROR(Writer.writeFixedString(FStr[0]));
EXPECT_NO_ERROR(Reader.readFixedString(FStr[1], FStr[0].size()));
EXPECT_EQ(FStr[0], FStr[1]);
EXPECT_EQ(DataBytes, std::vector<uint8_t>(
{'x', 'i', 'F', 'd', ' ', 'S', 'e', 't', 0, 'r'}));
EXPECT_EQ(
std::vector<uint8_t>({'x', 'i', 'F', 'd', ' ', 'S', 'e', 't', 0, 'r'}),
DataBytes);
Reader.setOffset(0);
Writer.setOffset(0);
@ -370,8 +370,8 @@ TEST(MappedBlockStreamTest, TestWriteThenRead) {
EXPECT_NO_ERROR(Writer.writeArray(byteArray[0]));
EXPECT_NO_ERROR(Reader.readArray(byteArray[1], byteArray[0].size()));
EXPECT_EQ(byteArray[0], byteArray[1]);
EXPECT_EQ(DataBytes,
std::vector<uint8_t>({0, 0x32, 0x31, 0, 0, 0, 0, 0, 0, 0}));
EXPECT_EQ(std::vector<uint8_t>({0, 0x32, 0x31, 0, 0, 0, 0, 0, 0, 0}),
DataBytes);
Reader.setOffset(0);
Writer.setOffset(0);
@ -379,8 +379,6 @@ TEST(MappedBlockStreamTest, TestWriteThenRead) {
EXPECT_NO_ERROR(Writer.writeArray(intArray[0]));
EXPECT_NO_ERROR(Reader.readArray(intArray[1], intArray[0].size()));
EXPECT_EQ(intArray[0], intArray[1]);
EXPECT_EQ(DataBytes, std::vector<uint8_t>({0x17, 0x5C, 0x50, 0x7A, 0xC2, 0xBB,
0x35, 0x01, 0, 0}));
}
TEST(MappedBlockStreamTest, TestWriteContiguousStreamRef) {