2011-06-21 23:36:51 +10:00
|
|
|
|
2015-04-13 16:45:56 +10:00
|
|
|
#include "endian.hpp"
|
2011-06-21 23:36:51 +10:00
|
|
|
|
2015-04-13 16:45:56 +10:00
|
|
|
#include "tap.hpp"
|
|
|
|
#include "platform.hpp"
|
2011-06-21 23:36:51 +10:00
|
|
|
|
|
|
|
#include <cstdlib>
|
2013-08-05 16:43:52 +10:00
|
|
|
#if defined(PLATFORM_WIN32)
|
|
|
|
#include <winsock2.h>
|
|
|
|
#else
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#endif
|
2011-06-21 23:36:51 +10:00
|
|
|
|
|
|
|
|
2015-04-13 18:06:08 +10:00
|
|
|
int
|
2015-07-13 16:29:01 +10:00
|
|
|
main (void)
|
|
|
|
{
|
|
|
|
util::TAP::logger tap;
|
2011-06-21 23:36:51 +10:00
|
|
|
|
|
|
|
uint16_t u16 = 0x1358;
|
|
|
|
uint32_t u32 = 0x12345678;
|
|
|
|
|
2016-10-11 23:47:57 +11:00
|
|
|
tap.expect_eq (htons (u16), util::hton (u16), "htons");
|
|
|
|
tap.expect_eq (htonl (u32), util::hton (u32), "htonl");
|
2011-06-21 23:36:51 +10:00
|
|
|
|
2016-10-11 23:47:57 +11:00
|
|
|
tap.expect_eq (ntohs (u16), util::hton (u16), "ntohs");
|
|
|
|
tap.expect_eq (ntohl (u32), util::hton (u32), "ntohl");
|
2011-06-21 23:36:51 +10:00
|
|
|
|
2015-07-13 16:29:01 +10:00
|
|
|
return tap.status ();
|
2011-06-21 23:36:51 +10:00
|
|
|
}
|