Skip to content

Commit

Permalink
Add more tests for mspec parser and code generator.
Browse files Browse the repository at this point in the history
Signed-off-by: Łukasz Dywicki <[email protected]>
  • Loading branch information
splatch committed Sep 16, 2024
1 parent c1a7135 commit 6580046
Showing 1 changed file with 35 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
//[manualArray uint 8 manualArrayField count '1' ] // TODO: Implement ...
//[manualArray uint 8 manualArrayField length '1' ] // TODO: Implement ...
//[manualArray uint 8 manualArrayField terminated '1' ] // TODO: Implement ...
[manual uint 8 manualField 'STATIC_CALL("readAManualField", readBuffer, simpleField)'
'STATIC_CALL("writeAManualField", writeBuffer, simpleField)'
[manual uint 8 manualField 'STATIC_CALL("readManualField", readBuffer, simpleField)'
'STATIC_CALL("writeManualField", writeBuffer, simpleField)'
'simpleField*8' ]
[optional uint 8 optionalField 'simpleField == 5' ]
[padding uint 8 paddingField '0x00' 'simpleField']
Expand Down Expand Up @@ -121,7 +121,6 @@
[simple string 8 abstractStringField]
]
]
//[abstract bit oneMoreBit] // TODO: apparently this breaks java
]
[type ArrayTypeTest
Expand Down Expand Up @@ -213,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]
Expand Down Expand Up @@ -477,28 +493,6 @@
////////////////////////////////////////////////////////////////
/* Needs to be ported to C and GO
[discriminatedType TTGranddad
[discriminator uint 8 dadNumber]
[simple uint 8 warStories]
[typeSwitch dadNumber
['0x00' TTDad
[discriminator uint 8 sonNumber]
[simple uint 8 beerBottles]
[typeSwitch sonNumber
['0x01' TTSon
[simple uint 8 gameConsoles]
[discriminator uint 8 babyNumber]
[typeSwitch babyNumber
['0x02' TTBaby
[simple uint 8 lalalala]
]
]
]
]
]
]
]

[discriminatedType TypeSwitchInTypeSwitchParentType
[discriminator uint 8 typeNumber]
[simple uint 8 parentFieldHurz]
Expand Down Expand Up @@ -558,10 +552,24 @@
]
]
]
]*/
]

[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
////////////////////////////////////////////////////////////////
// TODO: Test case where a dataIo type is used as type of a simple field (Linking normal model and dataIo)
// TODO: Test case where a dataIo type is used as type of a simple field (Linking normal model and dataIo)

0 comments on commit 6580046

Please sign in to comment.