Lines Matching +full:native +full:- +full:test
7 // https://www.apache.org/licenses/LICENSE-2.0
25 constexpr std::endian kNonNative = (std::endian::native == std::endian::little)
34 // clang-format off
36 // Native endianess conversions (should do nothing)
38 // Convert unsigned to native endianness
39 static_assert(ConvertOrderTo(std::endian::native, uint8_t{0x12}) == uint8_t{0x12});
40 static_assert(ConvertOrderTo(std::endian::native, uint16_t{0x0011}) == uint16_t{0x0011});
41 static_assert(ConvertOrderTo(std::endian::native, uint32_t{0x33221100}) == uint32_t{0x33221100});
42 static_assert(ConvertOrderTo(std::endian::native, uint64_t{0x0011223344556677}) == uint64_t{0x00112…
44 // Convert signed to native endianness
45 static_assert(ConvertOrderTo(std::endian::native, int8_t{0x12}) == int8_t{0x12});
46 static_assert(ConvertOrderTo(std::endian::native, int16_t{0x0011}) == int16_t{0x0011});
47 static_assert(ConvertOrderTo(std::endian::native, int32_t{0x33221100}) == int32_t{0x33221100});
48 static_assert(ConvertOrderTo(std::endian::native, int64_t{0x0011223344556677}) == int64_t{0x0011223…
50 // Convert unsigned from native endianness
51 static_assert(ConvertOrderFrom(std::endian::native, uint8_t{0x12}) == uint8_t{0x12});
52 static_assert(ConvertOrderFrom(std::endian::native, uint16_t{0x0011}) == uint16_t{0x0011});
53 static_assert(ConvertOrderFrom(std::endian::native, uint32_t{0x33221100}) == uint32_t{0x33221100});
54 static_assert(ConvertOrderFrom(std::endian::native, uint64_t{0x0011223344556677}) == uint64_t{0x001…
56 // Convert signed from native endianness
57 static_assert(ConvertOrderFrom(std::endian::native, int8_t{0x12}) == int8_t{0x12});
58 static_assert(ConvertOrderFrom(std::endian::native, int16_t{0x0011}) == int16_t{0x0011});
59 static_assert(ConvertOrderFrom(std::endian::native, int32_t{0x33221100}) == int32_t{0x33221100});
60 static_assert(ConvertOrderFrom(std::endian::native, int64_t{0x0011223344556677}) == int64_t{0x00112…
62 // Non-native endianess conversions (should reverse byte order)
64 // Convert unsigned to non-native endianness
70 // Convert signed to non-native endianness
76 // Convert unsigned from non-native endianness
82 // Convert signed from non-native endianness
88 // clang-format on
107 // clang-format off
109 // 8-bit little
117 // 8-bit big
125 // 16-bit little
131 // 16-bit big
137 // 32-bit little
143 // 32-bit big
149 // 64-bit little
155 // 64-bit big
161 // clang-format on
165 TEST(ReadInOrder, 8Bit_Big) {
171 EXPECT_EQ(ReadInOrder<int8_t>(std::endian::big, "\x80"), -128);
175 TEST(ReadInOrder, 8Bit_Little) {
181 EXPECT_EQ(ReadInOrder<int8_t>(std::endian::little, "\x80"), -128);
185 TEST(ReadInOrder, 16Bit_Big) {
191 EXPECT_EQ(ReadInOrder<int16_t>(std::endian::big, "\x80\0"), -32768);
195 TEST(ReadInOrder, 16Bit_Little) {
205 TEST(ReadInOrder, 32Bit_Big) {
211 EXPECT_EQ(ReadInOrder<int32_t>(std::endian::big, "\x80\0\0\0"), -2147483648);
215 TEST(ReadInOrder, 32Bit_Little) {
225 TEST(ReadInOrder, 64Bit_Big) {
239 TEST(ReadInOrder, 64Bit_Little) {
253 TEST(ReadInOrder, StdArray) { in TEST() function
259 TEST(ReadInOrder, CArray) { in TEST() function
265 TEST(ReadInOrder, BoundsChecking_Ok) { in TEST() function
272 TEST(ReadInOrder, BoundsChecking_TooSmall) { in TEST() function