#include #include namespace libk { #include "little.c" } // namespace libk TEST(endian_little, htole16) { EXPECT_EQ(static_cast(0xabcd), libk::htole16(0xabcd)); EXPECT_EQ(libk::htole16(0xabcd), htole16(0xabcd)); } TEST(endian_little, htole32) { EXPECT_EQ(static_cast(0xabcd0123), libk::htole32(0xabcd0123)); EXPECT_EQ(libk::htole32(0xabcd0123), htole32(0xabcd0123)); } TEST(endian_little, htole64) { EXPECT_EQ(static_cast(0x0123456789abcdef), libk::htole64(0x0123456789abcdef)); EXPECT_EQ(libk::htole64(0xabcdef0123456789), htole64(0xabcdef0123456789)); } TEST(endian_little, htobe16) { EXPECT_EQ(static_cast(0xabcd), libk::htobe16(0xcdab)); EXPECT_EQ(libk::htobe16(0xabcd), htobe16(0xabcd)); } TEST(endian_little, htobe32) { EXPECT_EQ(static_cast(0xabcd0123), libk::htobe32(0x2301cdab)); EXPECT_EQ(libk::htobe32(0xabcd0123), htobe32(0xabcd0123)); } TEST(endian_little, htobe64) { EXPECT_EQ(static_cast(0x0123456789abcdef), libk::htobe64(0xefcdab8967452301)); EXPECT_EQ(libk::htobe64(0xabcdef0123456789), htobe64(0xabcdef0123456789)); }