From d4c1efcb698fce7a2a644bf4085c9a774e9707ac Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Fri, 10 Jun 2016 22:12:18 +0000 Subject: [PATCH] Try again to fix this endianness issue. llvm-svn: 272440 --- .../DebugInfo/PDB/MappedBlockStreamTest.cpp | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/llvm/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp b/llvm/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp index c9bc9986f45b..7ed29005791f 100644 --- a/llvm/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp +++ b/llvm/unittests/DebugInfo/PDB/MappedBlockStreamTest.cpp @@ -316,17 +316,15 @@ TEST(MappedBlockStreamTest, TestWriteThenRead) { StringRef ZStr[] = {"Zero Str", ""}; StringRef FStr[] = {"Fixed Str", ""}; ArrayRef byteArray[] = {{'1', '2'}, {'0', '0'}}; - ArrayRef intArray[] = { - {ulittle32_t(890723408), ulittle32_t(29082234)}, - {ulittle32_t(0), ulittle32_t(0)}}; + ArrayRef 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({0, 0x7A, 0xEC, 0, 0, 0, 0, 0, 0, 0})); + EXPECT_EQ(std::vector({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({0x17, 0x5C, 0x50, 0, 0, 0, 0x35, 0, 0, 0})); + EXPECT_EQ(std::vector({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({0x2C, 0x60, 0x4A, 0, 0, 0, 0, 0, 0, 0})); + EXPECT_EQ(std::vector({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( - {'r', 'e', 'Z', ' ', 'S', 't', 'o', 'r', 0, 0})); + EXPECT_EQ( + std::vector({'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( - {'x', 'i', 'F', 'd', ' ', 'S', 'e', 't', 0, 'r'})); + EXPECT_EQ( + std::vector({'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({0, 0x32, 0x31, 0, 0, 0, 0, 0, 0, 0})); + EXPECT_EQ(std::vector({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({0x17, 0x5C, 0x50, 0x7A, 0xC2, 0xBB, - 0x35, 0x01, 0, 0})); } TEST(MappedBlockStreamTest, TestWriteContiguousStreamRef) {