struct init test
This commit is contained in:
parent
9564915e08
commit
9866fa0533
1
.gitignore
vendored
1
.gitignore
vendored
@ -5,3 +5,4 @@ hkd*
|
||||
tests/parse
|
||||
tests/ioctl
|
||||
tests/evtest
|
||||
tests/struct_init
|
||||
|
@ -9,5 +9,7 @@ evtest: evtest.c
|
||||
|
||||
inotify: inotify.c
|
||||
|
||||
struct_init: struct_init.c
|
||||
|
||||
clean:
|
||||
rm *.o parse ioctl inotify 2> /dev/null
|
||||
rm *.o parse ioctl inotify struct_init 2> /dev/null
|
||||
|
18
tests/struct_init.c
Normal file
18
tests/struct_init.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#define HELL 10
|
||||
#define IDE 220
|
||||
#define MAKE_ENTRY(value) {"value", value}
|
||||
const struct {
|
||||
const char * const name;
|
||||
const unsigned short value;
|
||||
} init[] = {
|
||||
{"lol", 1},
|
||||
{"hello", HELL},
|
||||
MAKE_ENTRY(IDE)
|
||||
};
|
||||
|
||||
int main (void) {
|
||||
printf("%s\t%d\n", init[2].name, init[2].value);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user