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:
parent
6d91acc75f
commit
c19193c390
7 changed files with 54 additions and 23 deletions
28
examples/macro_static_test.c
Normal file
28
examples/macro_static_test.c
Normal 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() {}
|
Loading…
Add table
Add a link
Reference in a new issue