Skip to content

Commit a668321

Browse files
committed
Add more tests for mspec parser and code generator.
Signed-off-by: Łukasz Dywicki <[email protected]>
1 parent cd13df2 commit a668321

File tree

1 file changed

+33
-2
lines changed
  • code-generation/protocol-test/src/main/resources/protocols/test

1 file changed

+33
-2
lines changed

code-generation/protocol-test/src/main/resources/protocols/test/test.mspec

+33-2
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,23 @@
212212
]
213213
]
214214

215+
// Check field with arguments
216+
[type Struct(bit signed, bit unsigned)
217+
[typeSwitch signed
218+
['true' SignedType
219+
[simple int 8 data]
220+
]
221+
['false' UnsignedType
222+
[simple uint 8 data]
223+
]
224+
]
225+
]
226+
227+
[type StructContainer
228+
[simple bit signed]
229+
[simple Struct('signed', '!signed') struct]
230+
]
231+
215232
// TODO: So far only trouble in GO, C seems OK.
216233
[type VirtualFieldTest
217234
[simple uint 8 simpleField]
@@ -475,7 +492,7 @@
475492
// TypeSwitch in TypeSwitch
476493
////////////////////////////////////////////////////////////////
477494

478-
/* Needs to be ported to C and GO
495+
/* Needs to be ported to C and GO */
479496
[discriminatedType TypeSwitchInTypeSwitchParentType
480497
[discriminator uint 8 typeNumber]
481498
[simple uint 8 parentFieldHurz]
@@ -535,7 +552,21 @@
535552
]
536553
]
537554
]
538-
]*/
555+
]
556+
557+
[discriminatedType TypeSwitchWithArg(bit arg1, uint 8 arg2)
558+
[abstract bit isItTrue]
559+
[simple uint 8 value]
560+
[typeSwitch arg1
561+
['true' TrustfulTypeSwitch(uint 8 value)
562+
[virtual bit isItTrue 'true']
563+
]
564+
['false' UnTrustfulTypeSwitch(uint 8 value)
565+
[virtual bit isItTrue 'false']
566+
]
567+
]
568+
]
569+
539570

540571
////////////////////////////////////////////////////////////////
541572
// Missing Tests

0 commit comments

Comments
 (0)