Lines Matching refs:ReadInOrder

165 TEST(ReadInOrder, 8Bit_Big) {
166 EXPECT_EQ(ReadInOrder<uint8_t>(std::endian::big, "\0"), 0u);
167 EXPECT_EQ(ReadInOrder<uint8_t>(std::endian::big, "\x80"), 0x80u);
168 EXPECT_EQ(ReadInOrder<uint8_t>(std::endian::big, kNumber), 0x11u);
170 EXPECT_EQ(ReadInOrder<int8_t>(std::endian::big, "\0"), 0);
171 EXPECT_EQ(ReadInOrder<int8_t>(std::endian::big, "\x80"), -128);
172 EXPECT_EQ(ReadInOrder<int8_t>(std::endian::big, kNumber), 0x11);
175 TEST(ReadInOrder, 8Bit_Little) {
176 EXPECT_EQ(ReadInOrder<uint8_t>(std::endian::little, "\0"), 0u);
177 EXPECT_EQ(ReadInOrder<uint8_t>(std::endian::little, "\x80"), 0x80u);
178 EXPECT_EQ(ReadInOrder<uint8_t>(std::endian::little, kNumber), 0x11u);
180 EXPECT_EQ(ReadInOrder<int8_t>(std::endian::little, "\0"), 0);
181 EXPECT_EQ(ReadInOrder<int8_t>(std::endian::little, "\x80"), -128);
182 EXPECT_EQ(ReadInOrder<int8_t>(std::endian::little, kNumber), 0x11);
185 TEST(ReadInOrder, 16Bit_Big) {
186 EXPECT_EQ(ReadInOrder<uint16_t>(std::endian::big, "\0\0"), 0u);
187 EXPECT_EQ(ReadInOrder<uint16_t>(std::endian::big, "\x80\0"), 0x8000u);
188 EXPECT_EQ(ReadInOrder<uint16_t>(std::endian::big, kNumber), 0x1122u);
190 EXPECT_EQ(ReadInOrder<int16_t>(std::endian::big, "\0\0"), 0);
191 EXPECT_EQ(ReadInOrder<int16_t>(std::endian::big, "\x80\0"), -32768);
192 EXPECT_EQ(ReadInOrder<int16_t>(std::endian::big, kNumber), 0x1122);
195 TEST(ReadInOrder, 16Bit_Little) {
196 EXPECT_EQ(ReadInOrder<uint16_t>(std::endian::little, "\0\0"), 0u);
197 EXPECT_EQ(ReadInOrder<uint16_t>(std::endian::little, "\x80\0"), 0x80u);
198 EXPECT_EQ(ReadInOrder<uint16_t>(std::endian::little, kNumber), 0x2211u);
200 EXPECT_EQ(ReadInOrder<int16_t>(std::endian::little, "\0\0"), 0);
201 EXPECT_EQ(ReadInOrder<int16_t>(std::endian::little, "\x80\0"), 0x80);
202 EXPECT_EQ(ReadInOrder<int16_t>(std::endian::little, kNumber), 0x2211);
205 TEST(ReadInOrder, 32Bit_Big) {
206 EXPECT_EQ(ReadInOrder<uint32_t>(std::endian::big, "\0\0\0\0"), 0u);
207 EXPECT_EQ(ReadInOrder<uint32_t>(std::endian::big, "\x80\0\0\0"), 0x80000000u);
208 EXPECT_EQ(ReadInOrder<uint32_t>(std::endian::big, kNumber), 0x11223344u);
210 EXPECT_EQ(ReadInOrder<int32_t>(std::endian::big, "\0\0\0\0"), 0);
211 EXPECT_EQ(ReadInOrder<int32_t>(std::endian::big, "\x80\0\0\0"), -2147483648);
212 EXPECT_EQ(ReadInOrder<int32_t>(std::endian::big, kNumber), 0x11223344);
215 TEST(ReadInOrder, 32Bit_Little) {
216 EXPECT_EQ(ReadInOrder<uint32_t>(std::endian::little, "\0\0\0\0"), 0u);
217 EXPECT_EQ(ReadInOrder<uint32_t>(std::endian::little, "\x80\0\0\0"), 0x80u);
218 EXPECT_EQ(ReadInOrder<uint32_t>(std::endian::little, kNumber), 0x44332211u);
220 EXPECT_EQ(ReadInOrder<int32_t>(std::endian::little, "\0\0\0\0"), 0);
221 EXPECT_EQ(ReadInOrder<int32_t>(std::endian::little, "\x80\0\0\0"), 0x80);
222 EXPECT_EQ(ReadInOrder<int32_t>(std::endian::little, kNumber), 0x44332211);
225 TEST(ReadInOrder, 64Bit_Big) {
226 EXPECT_EQ(ReadInOrder<uint64_t>(std::endian::big, "\0\0\0\0\0\0\0\0"), 0u);
227 EXPECT_EQ(ReadInOrder<uint64_t>(std::endian::big, "\x80\0\0\0\0\0\0\0"),
229 EXPECT_EQ(ReadInOrder<uint64_t>(std::endian::big, kNumber),
232 EXPECT_EQ(ReadInOrder<int64_t>(std::endian::big, "\0\0\0\0\0\0\0\0"), 0);
233 EXPECT_EQ(ReadInOrder<int64_t>(std::endian::big, "\x80\0\0\0\0\0\0\0"),
235 EXPECT_EQ(ReadInOrder<int64_t>(std::endian::big, kNumber),
239 TEST(ReadInOrder, 64Bit_Little) {
240 EXPECT_EQ(ReadInOrder<uint64_t>(std::endian::little, "\0\0\0\0\0\0\0\0"), 0u);
241 EXPECT_EQ(ReadInOrder<uint64_t>(std::endian::little, "\x80\0\0\0\0\0\0\0"),
243 EXPECT_EQ(ReadInOrder<uint64_t>(std::endian::little, kNumber),
246 EXPECT_EQ(ReadInOrder<int64_t>(std::endian::little, "\0\0\0\0\0\0\0\0"), 0);
247 EXPECT_EQ(ReadInOrder<int64_t>(std::endian::little, "\x80\0\0\0\0\0\0\0"),
249 EXPECT_EQ(ReadInOrder<int64_t>(std::endian::little, kNumber),
253 TEST(ReadInOrder, StdArray) { in TEST() argument
255 EXPECT_EQ(0x04030201, ReadInOrder<int32_t>(std::endian::little, buffer)); in TEST()
256 EXPECT_EQ(0x01020304, ReadInOrder<int32_t>(std::endian::big, buffer)); in TEST()
259 TEST(ReadInOrder, CArray) { in TEST() argument
261 EXPECT_EQ(0x04030201, ReadInOrder<int32_t>(std::endian::little, buffer)); in TEST()
262 EXPECT_EQ(0x01020304, ReadInOrder<int32_t>(std::endian::big, buffer)); in TEST()
265 TEST(ReadInOrder, BoundsChecking_Ok) { in TEST() argument
268 EXPECT_TRUE(ReadInOrder(std::endian::little, buffer, value)); in TEST()
272 TEST(ReadInOrder, BoundsChecking_TooSmall) { in TEST() argument
275 EXPECT_FALSE(ReadInOrder(std::endian::little, buffer, value)); in TEST()