Skip to content

Commit ee58b26

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

File tree

1 file changed

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

1 file changed

+32
-2
lines changed

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

+32-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@
121121
[simple string 8 abstractStringField]
122122
]
123123
]
124-
//[abstract bit oneMoreBit] // TODO: apparently this breaks java
124+
[abstract bit oneMoreBit] // TODO: apparently this breaks java
125125
]
126126

127127
[type ArrayTypeTest
@@ -213,6 +213,23 @@
213213
]
214214
]
215215

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

479-
/* Needs to be ported to C and GO
480496
[discriminatedType TTGranddad
481497
[discriminator uint 8 dadNumber]
482498
[simple uint 8 warStories]
@@ -499,6 +515,7 @@
499515
]
500516
]
501517

518+
/* Needs to be ported to C and GO
502519
[discriminatedType TypeSwitchInTypeSwitchParentType
503520
[discriminator uint 8 typeNumber]
504521
[simple uint 8 parentFieldHurz]
@@ -560,6 +577,19 @@
560577
]
561578
]*/
562579
580+
[discriminatedType TypeSwitchWithArg(bit arg1, uint 8 arg2)
581+
[abstract bit isItTrue]
582+
[simple uint 8 value]
583+
[typeSwitch arg1
584+
['true' TrustfulTypeSwitch(uint 8 value)
585+
[virtual bit isItTrue 'true']
586+
]
587+
['false' UnTrustfulTypeSwitch(uint 8 value)
588+
[virtual bit isItTrue 'false']
589+
]
590+
]
591+
]
592+
563593
////////////////////////////////////////////////////////////////
564594
// Missing Tests
565595
////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)