Skip to content

Commit

Permalink
tests: Add optional field to generator test
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Jul 19, 2024
1 parent ae29953 commit 1a8288b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,6 @@ TEST_F(WithoutWriterCode, checkItemMethods)

ASSERT_METHOD_NOT_PRESENT(PATH, type, " Item()", "Item::Item()");
ASSERT_METHOD_NOT_PRESENT(PATH, type, "void setExtraParam(", "void Item::setExtraParam(");
ASSERT_METHOD_NOT_PRESENT(PATH, type, "bool isExtraParamSet(", "bool Item::isExtraParamSet(");
ASSERT_METHOD_NOT_PRESENT(PATH, type, "void resetExtraParam(", "void Item::resetExtraParam(");
ASSERT_METHOD_NOT_PRESENT(PATH, type, "void setParam(", "void Item::setParam(");
ASSERT_METHOD_NOT_PRESENT(PATH, type, "size_t initializeOffsets(", "size_t Item::initializeOffsets(");
Expand Down Expand Up @@ -519,6 +518,7 @@ TEST_F(WithoutWriterCode, checkItemMethods)
ASSERT_METHOD_PRESENT(PATH, type, "uint16_t getParam(", "uint16_t Item::getParam(");
ASSERT_METHOD_PRESENT(PATH, type, "& getExtraParam(", "& Item::getExtraParam(");
ASSERT_METHOD_PRESENT(PATH, type, "bool isExtraParamUsed(", "bool Item::isExtraParamUsed(");
ASSERT_METHOD_PRESENT(PATH, type, "bool isExtraParamSet(", "bool Item::isExtraParamSet(");
ASSERT_METHOD_PRESENT(PATH, type, "size_t bitSizeOf(", "size_t Item::bitSizeOf(");
ASSERT_METHOD_PRESENT(PATH, type, "bool operator==(", "bool Item::operator==(");
ASSERT_METHOD_PRESENT(PATH, type, "uint32_t hashCode(", "uint32_t Item::hashCode(");
Expand Down Expand Up @@ -612,7 +612,6 @@ TEST_F(WithoutWriterCode, checkTileMethods)
ASSERT_METHOD_NOT_PRESENT(PATH, type, "void resetVersion(", "void Tile::resetVersion(");
ASSERT_METHOD_NOT_PRESENT(PATH, type, "void setNumElementOffset(", "void Tile::setNumElementOffset(");
ASSERT_METHOD_NOT_PRESENT(PATH, type, "void setVersionString(", "void Tile::setVersionString(");
ASSERT_METHOD_NOT_PRESENT(PATH, type, "bool isVersionStringSet(", "bool Tile::isVersionStringSet(");
ASSERT_METHOD_NOT_PRESENT(PATH, type, "void resetVersionString(", "void Tile::resetVersionString(");
ASSERT_METHOD_NOT_PRESENT(PATH, type, "void setNumElements(", "void Tile::setNumElements(");
ASSERT_METHOD_NOT_PRESENT(PATH, type, "void setData(", "void Tile::setData(");
Expand Down Expand Up @@ -644,6 +643,7 @@ TEST_F(WithoutWriterCode, checkTileMethods)
ASSERT_METHOD_PRESENT(PATH, type, MethodNames::GET_VERSION_STRING_DECLARATION,
MethodNames::GET_VERSION_STRING_DEFINITION);
ASSERT_METHOD_PRESENT(PATH, type, "bool isVersionStringUsed(", "bool Tile::isVersionStringUsed(");
ASSERT_METHOD_PRESENT(PATH, type, "bool isVersionStringSet(", "bool Tile::isVersionStringSet(");
ASSERT_METHOD_PRESENT(PATH, type, "uint32_t getNumElementsOffset(", "uint32_t Tile::getNumElementsOffset(");
ASSERT_METHOD_PRESENT(PATH, type, "uint32_t getNumElements(", "uint32_t Tile::getNumElements(");
ASSERT_METHOD_PRESENT(PATH, type, "& getOffsets() const", "& Tile::getOffsets() const");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ public void checkTile()
assertMethodNotPresent(Tile.class, "setVersion(");
assertMethodNotPresent(Tile.class, "setNumElementsOffset(");
assertMethodNotPresent(Tile.class, "setVersionString(");
assertMethodNotPresent(Tile.class, "isVersionStringSet(");
assertMethodNotPresent(Tile.class, "setNumElements(");
assertMethodNotPresent(Tile.class, "setData(");

Expand All @@ -173,6 +172,7 @@ public void checkTile()
assertMethodPresent(Tile.class, "getVersion()");
assertMethodPresent(Tile.class, "read(zserio.runtime.io.BitStreamReader)");
assertMethodPresent(Tile.class, "isVersionSet(");
assertMethodPresent(Tile.class, "isVersionStringSet(");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def testExtraParamUnionMethods(self):
def testItemMethods(self):
userType = self.api.Item

assertMethodNotPresent(self, userType, "is_extra_param_set")
assertMethodNotPresent(self, userType, "initialize_offsets")
assertMethodNotPresent(self, userType, "write")
assertMethodNotPresent(self, userType, "from_fields")
Expand All @@ -72,6 +71,7 @@ def testItemMethods(self):
assertMethodPresent(self, userType, "read")
assertMethodPresent(self, userType, "from_reader")
assertMethodPresent(self, userType, "bitsizeof")
assertMethodPresent(self, userType, "is_extra_param_set")

assertPropertyPresent(self, userType, "item_type", readOnly=True)
assertPropertyPresent(self, userType, "param", readOnly=True)
Expand Down Expand Up @@ -110,8 +110,6 @@ def testItemChoiceHolderMethods(self):
def testTileMethods(self):
userType = self.api.Tile

assertMethodNotPresent(self, userType, "is_version_set")
assertMethodNotPresent(self, userType, "is_version_string_set")
assertMethodNotPresent(self, userType, "initialize_offsets")
assertMethodNotPresent(self, userType, "write")
assertMethodNotPresent(self, userType, "from_fields")
Expand All @@ -120,6 +118,8 @@ def testTileMethods(self):
assertMethodPresent(self, userType, "read")
assertMethodPresent(self, userType, "from_reader")
assertMethodPresent(self, userType, "bitsizeof")
assertMethodPresent(self, userType, "is_version_set")
assertMethodPresent(self, userType, "is_version_string_set")

assertPropertyPresent(self, userType, "version", readOnly=True)
assertPropertyPresent(self, userType, "num_elements_offset", readOnly=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ struct Item(ItemType itemType)
{
uint16 param;
ExtraParamUnion extraParam if itemType == ItemType.WITH_EXTRA_PARAM;
optional uint8 optNoConditionParam;
};

choice ItemChoice(bool hasItem) on hasItem
Expand Down

0 comments on commit 1a8288b

Please sign in to comment.