1
0
Fork 0
mirror of https://github.com/tailix/libkernaux.git synced 2025-07-07 18:51:58 -04:00

Add macro KERNAUX_STATIC_TEST (#138)

This commit is contained in:
Alex Kotov 2022-12-11 17:40:49 +04:00 committed by GitHub
parent 6d91acc75f
commit c19193c390
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 54 additions and 23 deletions

View file

@ -0,0 +1,28 @@
#include <kernaux/macro.h>
#include <stdint.h>
KERNAUX_STATIC_TEST(uint8_t_size, sizeof(uint8_t) == 1);
KERNAUX_STATIC_TEST(uint16_t_size, sizeof(uint16_t) == 2);
KERNAUX_STATIC_TEST(uint32_t_size, sizeof(uint32_t) == 4);
KERNAUX_STATIC_TEST(uint64_t_size, sizeof(uint64_t) == 8);
#include <kernaux/macro/packing_start.run>
struct Foo {
uint8_t a;
uint32_t b;
} KERNAUX_PACKED;
KERNAUX_STATIC_TEST_STRUCT_SIZE(Foo, 5);
union Bar {
uint8_t a;
uint16_t b;
} KERNAUX_PACKED;
KERNAUX_STATIC_TEST_UNION_SIZE(Bar, 2);
#include <kernaux/macro/packing_end.run>
void example_main() {}