-
Notifications
You must be signed in to change notification settings - Fork 540
[C] add test to ensure generated C code properly compiles when versio… #1011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright 2013-2024 Real Logic Limited. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
#include "code_generation_test_version/car.h" | ||
#include "code_generation_test_version/messageHeader.h" | ||
|
||
int main(void) | ||
{ | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
sbe-tool/src/test/resources/code-generation-schema-with-version.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<sbe:messageSchema xmlns:sbe="http://fixprotocol.io/2016/sbe" | ||
package="code.generation.test.version" | ||
id="6" | ||
version="1" | ||
semanticVersion="5.2" | ||
description="Example schema" | ||
byteOrder="littleEndian"> | ||
<types> | ||
<composite name="BoosterT"> | ||
<enum name="BoostType" encodingType="char"> | ||
<validValue name="TURBO">T</validValue> | ||
<validValue name="SUPERCHARGER">S</validValue> | ||
<validValue name="NITROUS">N</validValue> | ||
<validValue name="KERS">K</validValue> | ||
</enum> | ||
<type name="horsePower" primitiveType="uint8"/> | ||
</composite> | ||
<composite name="messageHeader" description="Message identifiers and length of message root"> | ||
<type name="blockLength" primitiveType="uint16"/> | ||
<type name="templateId" primitiveType="uint16"/> | ||
<type name="schemaId" primitiveType="uint16"/> | ||
<type name="version" primitiveType="uint16"/> | ||
</composite> | ||
<composite name="groupSizeEncoding" description="Repeating group dimensions"> | ||
<type name="blockLength" primitiveType="uint16"/> | ||
<type name="numInGroup" primitiveType="uint16"/> | ||
</composite> | ||
<composite name="varStringEncoding"> | ||
<type name="length" primitiveType="uint16"/> | ||
<type name="varData" primitiveType="uint8" length="0" characterEncoding="UTF-8"/> | ||
</composite> | ||
<composite name="varAsciiStringEncoding"> | ||
<type name="length" primitiveType="uint32" maxValue="1073741824"/> | ||
<type name="varData" primitiveType="uint8" length="0" characterEncoding="ASCII"/> | ||
</composite> | ||
</types> | ||
<types> | ||
<type name="ModelYear" primitiveType="uint16"/> | ||
<type name="VehicleCode" primitiveType="char" length="6" characterEncoding="ASCII"/> | ||
<type name="someNumbers" primitiveType="int32" length="5"/> | ||
<type name="Ron" primitiveType="uint8" minValue="90" maxValue="110"/> | ||
<composite name="Engine"> | ||
<type name="capacity" primitiveType="uint16"/> | ||
<type name="numCylinders" primitiveType="uint8"/> | ||
<type name="maxRpm" primitiveType="uint16" presence="constant">9000</type> | ||
<type name="manufacturerCode" primitiveType="char" length="3"/> | ||
<type name="fuel" primitiveType="char" presence="constant">Petrol</type> | ||
<ref name="booster" type="BoosterT"/> | ||
</composite> | ||
<enum name="BooleanType" encodingType="uint8"> | ||
<validValue name="F">0</validValue> | ||
<validValue name="T">1</validValue> | ||
</enum> | ||
<enum name="Model" encodingType="char"> | ||
<validValue name="A">A</validValue> | ||
<validValue name="B">B</validValue> | ||
<validValue name="C">C</validValue> | ||
</enum> | ||
<set name="OptionalExtras" encodingType="uint8"> | ||
<choice name="sunRoof">0</choice> | ||
<choice name="sportsPack">1</choice> | ||
<choice name="cruiseControl">2</choice> | ||
</set> | ||
</types> | ||
<sbe:message name="Car" id="1" description="Description of a basic Car"> | ||
<field name="serialNumber" id="1" type="uint64" sinceVersion="1"/> | ||
<field name="modelYear" id="2" type="ModelYear" sinceVersion="1"/> | ||
<field name="available" id="3" type="BooleanType" sinceVersion="1"/> | ||
<field name="code" id="4" type="Model" sinceVersion="1"/> | ||
<field name="someNumbers" id="5" type="someNumbers" sinceVersion="1"/> | ||
<field name="vehicleCode" id="6" type="VehicleCode" sinceVersion="1"/> | ||
<field name="extras" id="7" type="OptionalExtras" sinceVersion="1"/> | ||
<field name="discountedModel" id="8" type="Model" presence="constant" valueRef="Model.C" sinceVersion="1"/> | ||
<field name="engine" id="9" type="Engine" sinceVersion="1"/> | ||
<group name="fuelFigures" id="10" dimensionType="groupSizeEncoding" sinceVersion="1"> | ||
<field name="speed" id="11" type="uint16" sinceVersion="1"/> | ||
<field name="mpg" id="12" type="float" sinceVersion="1"/> | ||
<data name="usageDescription" id="200" type="varStringEncoding" sinceVersion="1"/> | ||
</group> | ||
<group name="performanceFigures" id="13" dimensionType="groupSizeEncoding" sinceVersion="1"> | ||
<field name="octaneRating" id="14" type="Ron" sinceVersion="1"/> | ||
<group name="acceleration" id="15" dimensionType="groupSizeEncoding" sinceVersion="1"> | ||
<field name="mph" id="16" type="uint16" sinceVersion="1"/> | ||
<field name="seconds" id="17" type="float" sinceVersion="1"/> | ||
</group> | ||
</group> | ||
<data name="manufacturer" id="18" type="varStringEncoding" sinceVersion="1"/> | ||
<data name="model" id="19" type="varStringEncoding" sinceVersion="1"/> | ||
<data name="activationCode" id="20" type="varStringEncoding" sinceVersion="1"/> | ||
<data name="color" id="21" type="varAsciiStringEncoding" sinceVersion="1"/> | ||
</sbe:message> | ||
</sbe:messageSchema> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this test access anything from
car.h
ormessageHeader.h
, i.e. what kind of compilation check will it be doing?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's validating that the code in the header files actually compiles. Without the fix that you merged earlier, this file would fail to compile. We'd see a bunch of this when running cppbuild: