aboutsummaryrefslogtreecommitdiff
path: root/unittests/Support/EndianTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/Support/EndianTest.cpp')
-rw-r--r--unittests/Support/EndianTest.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/unittests/Support/EndianTest.cpp b/unittests/Support/EndianTest.cpp
index 00ea2ae5d9..8f93553063 100644
--- a/unittests/Support/EndianTest.cpp
+++ b/unittests/Support/EndianTest.cpp
@@ -21,36 +21,36 @@ namespace {
TEST(Endian, Read) {
// These are 5 bytes so we can be sure at least one of the reads is unaligned.
- unsigned char big[] = {0x00, 0x01, 0x02, 0x03, 0x04};
- unsigned char little[] = {0x00, 0x04, 0x03, 0x02, 0x01};
+ unsigned char bigval[] = {0x00, 0x01, 0x02, 0x03, 0x04};
+ unsigned char littleval[] = {0x00, 0x04, 0x03, 0x02, 0x01};
int32_t BigAsHost = 0x00010203;
- EXPECT_EQ(BigAsHost, (endian::read_be<int32_t, unaligned>(big)));
+ EXPECT_EQ(BigAsHost, (endian::read<int32_t, big, unaligned>(bigval)));
int32_t LittleAsHost = 0x02030400;
- EXPECT_EQ(LittleAsHost, (endian::read_le<int32_t, unaligned>(little)));
+ EXPECT_EQ(LittleAsHost,(endian::read<int32_t, little, unaligned>(littleval)));
- EXPECT_EQ((endian::read_be<int32_t, unaligned>(big + 1)),
- (endian::read_le<int32_t, unaligned>(little + 1)));
+ EXPECT_EQ((endian::read<int32_t, big, unaligned>(bigval + 1)),
+ (endian::read<int32_t, little, unaligned>(littleval + 1)));
}
TEST(Endian, Write) {
unsigned char data[5];
- endian::write_be<int32_t, unaligned>(data, -1362446643);
+ endian::write<int32_t, big, unaligned>(data, -1362446643);
EXPECT_EQ(data[0], 0xAE);
EXPECT_EQ(data[1], 0xCA);
EXPECT_EQ(data[2], 0xB6);
EXPECT_EQ(data[3], 0xCD);
- endian::write_be<int32_t, unaligned>(data + 1, -1362446643);
+ endian::write<int32_t, big, unaligned>(data + 1, -1362446643);
EXPECT_EQ(data[1], 0xAE);
EXPECT_EQ(data[2], 0xCA);
EXPECT_EQ(data[3], 0xB6);
EXPECT_EQ(data[4], 0xCD);
- endian::write_le<int32_t, unaligned>(data, -1362446643);
+ endian::write<int32_t, little, unaligned>(data, -1362446643);
EXPECT_EQ(data[0], 0xCD);
EXPECT_EQ(data[1], 0xB6);
EXPECT_EQ(data[2], 0xCA);
EXPECT_EQ(data[3], 0xAE);
- endian::write_le<int32_t, unaligned>(data + 1, -1362446643);
+ endian::write<int32_t, little, unaligned>(data + 1, -1362446643);
EXPECT_EQ(data[1], 0xCD);
EXPECT_EQ(data[2], 0xB6);
EXPECT_EQ(data[3], 0xCA);
@@ -69,4 +69,4 @@ TEST(Endian, PackedEndianSpecificIntegral) {
EXPECT_EQ(*big_val, *little_val);
}
-}
+} // end anon namespace