From ebbe7a1672c5a8750a57019c4df6d259dda12a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Thu, 29 Sep 2022 21:06:46 +0200 Subject: Import protocol code generator from xK, add tests Also add a VIM syntax highlighting file. This also fixes some previously untriggered bugs. --- tests/lxdrgen.lxdr | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/lxdrgen.lxdr (limited to 'tests/lxdrgen.lxdr') diff --git a/tests/lxdrgen.lxdr b/tests/lxdrgen.lxdr new file mode 100644 index 0000000..6c53de5 --- /dev/null +++ b/tests/lxdrgen.lxdr @@ -0,0 +1,23 @@ +/* + * tests/lxdrgen.lxdr: a test protocol for the generator + */ +const VERSION = 1; +const NOISREV = -1; + +// TODO: Test failure paths, and in general go for full coverage. +struct Struct { + union Union switch (enum Enum { + NUMBERS = VERSION, + OTHERS = 2, + NOTHING, + } tag) { + case NUMBERS: + i8 a; i16 b; i32 c; i64 d; + u8 e; u16 f; u32 g; u64 h; + case OTHERS: + bool foo; + string bar; + case NOTHING: + void; + } u<>; +}; -- cgit v1.2.3