From a6683210bc0699147e91b80f060edfab67ec4cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Dywicki?= Date: Fri, 23 Aug 2024 15:01:39 +0200 Subject: [PATCH] Add more tests for mspec parser and code generator. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ɓukasz Dywicki --- .../main/resources/protocols/test/test.mspec | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/code-generation/protocol-test/src/main/resources/protocols/test/test.mspec b/code-generation/protocol-test/src/main/resources/protocols/test/test.mspec index d07acc5cc7a..899c0d59732 100644 --- a/code-generation/protocol-test/src/main/resources/protocols/test/test.mspec +++ b/code-generation/protocol-test/src/main/resources/protocols/test/test.mspec @@ -212,6 +212,23 @@ ] ] +// Check field with arguments +[type Struct(bit signed, bit unsigned) + [typeSwitch signed + ['true' SignedType + [simple int 8 data] + ] + ['false' UnsignedType + [simple uint 8 data] + ] + ] +] + +[type StructContainer + [simple bit signed] + [simple Struct('signed', '!signed') struct] +] + // TODO: So far only trouble in GO, C seems OK. [type VirtualFieldTest [simple uint 8 simpleField] @@ -475,7 +492,7 @@ // TypeSwitch in TypeSwitch //////////////////////////////////////////////////////////////// -/* Needs to be ported to C and GO +/* Needs to be ported to C and GO */ [discriminatedType TypeSwitchInTypeSwitchParentType [discriminator uint 8 typeNumber] [simple uint 8 parentFieldHurz] @@ -535,7 +552,21 @@ ] ] ] -]*/ +] + +[discriminatedType TypeSwitchWithArg(bit arg1, uint 8 arg2) + [abstract bit isItTrue] + [simple uint 8 value] + [typeSwitch arg1 + ['true' TrustfulTypeSwitch(uint 8 value) + [virtual bit isItTrue 'true'] + ] + ['false' UnTrustfulTypeSwitch(uint 8 value) + [virtual bit isItTrue 'false'] + ] + ] +] + //////////////////////////////////////////////////////////////// // Missing Tests