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)
|
|
|
|
{
|
2018-08-05 14:42:02 +10:00
|
|
|
cruft::TAP::logger tap;
|
2011-06-21 23:36:51 +10:00
|
|
|
|
2018-12-15 15:37:42 +11:00
|
|
|
uint16_t val16 = 0x1358;
|
|
|
|
uint32_t val32 = 0x12345678;
|
2011-06-21 23:36:51 +10:00
|
|
|
|
2018-12-15 15:37:42 +11:00
|
|
|
tap.expect_eq (htons (val16), cruft::hton (val16), "htons");
|
|
|
|
tap.expect_eq (htonl (val32), cruft::hton (val32), "htonl");
|
2011-06-21 23:36:51 +10:00
|
|
|
|
2018-12-15 15:37:42 +11:00
|
|
|
tap.expect_eq (ntohs (val16), cruft::hton (val16), "ntohs");
|
|
|
|
tap.expect_eq (ntohl (val32), cruft::hton (val32), "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
|
|
|
}
|