summaryrefslogtreecommitdiff
path: root/tests/headers/endian.c
blob: db18c5fc5d5e1c3107d1d0aa34d11053e771d01f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/endian.h.html

#include "core.h"

#include <endian.h>

TEST(endian_h)
{
	MACRO(BYTE_ORDER);
	MACRO(LITTLE_ENDIAN);
	MACRO(BIG_ENDIAN);

	FUNCTION(be16toh, FN(uint16_t, uint16_t));
	FUNCTION(be32toh, FN(uint32_t, uint32_t));
	FUNCTION(be64toh, FN(uint64_t, uint64_t));

	FUNCTION(htobe16, FN(uint16_t, uint16_t));
	FUNCTION(htobe32, FN(uint32_t, uint32_t));
	FUNCTION(htobe64, FN(uint64_t, uint64_t));

	FUNCTION(htole16, FN(uint16_t, uint16_t));
	FUNCTION(htole32, FN(uint32_t, uint32_t));
	FUNCTION(htole64, FN(uint64_t, uint64_t));

	FUNCTION(le16toh, FN(uint16_t, uint16_t));
	FUNCTION(le32toh, FN(uint32_t, uint32_t));
	FUNCTION(le64toh, FN(uint64_t, uint64_t));

	TYPE(uint16_t);
	TYPE(uint32_t);
	TYPE(uint64_t);
}