2 #include <gtest/gtest.h> 5 TEST(TCPInterface, testReadBEFloat)
8 uint8_t bytes[4] = { 0x42, 0xF6, 0xE9, 0xD5};
9 ASSERT_EQ(123.45670318603515625, AS::Network::read_be<float>(bytes, 4, 0));
12 TEST(TCPInterface, testReadBEDouble)
15 uint8_t bytes[8] = { 0x40, 0x5E, 0xDD, 0x3A, 0x92, 0xA3, 0x05, 0x53};
16 ASSERT_EQ(123.4567, AS::Network::read_be<double>(bytes, 8, 0));
19 TEST(TCPInterface, testReadBEInt)
22 uint8_t bytes[4] = { 0x34, 0xFB, 0x5E, 0x38};
23 ASSERT_EQ(888888888, AS::Network::read_be<uint32_t>(bytes, 4, 0));
26 TEST(TCPInterface, testReadLEFloat)
29 uint8_t bytes[4] = { 0xD5, 0xE9, 0xF6, 0x42};
30 ASSERT_EQ(123.45670318603515625, AS::Network::read_le<float>(bytes, 4, 0));
33 TEST(TCPInterface, testReadLEDouble)
36 uint8_t bytes[8] = { 0x53, 0x05, 0xA3, 0x92, 0x3A, 0xDD, 0x5E, 0x40};
37 ASSERT_EQ(123.4567, AS::Network::read_le<double>(bytes, 8, 0));
40 TEST(TCPInterface, testReadLEInt)
43 uint8_t bytes[4] = { 0xD3, 0x02, 0x96, 0x49};
44 ASSERT_EQ(1234567891, AS::Network::read_le<uint32_t>(bytes, 4, 0));
47 int main(
int argc,
char **argv)
49 testing::InitGoogleTest(&argc, argv);
50 return RUN_ALL_TESTS();
int main(int argc, char **argv)
TEST(TCPInterface, testReadBEFloat)