From 1a8288bc773b6ef18baa40970034a3b7f8f812e3 Mon Sep 17 00:00:00 2001 From: Johannes Wolf Date: Fri, 19 Jul 2024 10:54:17 +0200 Subject: [PATCH] tests: Add optional field to generator test --- .../without_writer_code/cpp/WithoutWriterCodeTest.cpp | 4 ++-- .../java/without_writer_code/WithoutWriterCodeTest.java | 2 +- .../without_writer_code/python/WithoutWriterCodeTest.py | 6 +++--- .../arguments/without_writer_code/zs/without_writer_code.zs | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/test/arguments/without_writer_code/cpp/WithoutWriterCodeTest.cpp b/test/arguments/without_writer_code/cpp/WithoutWriterCodeTest.cpp index a8e6ea67f..d7d562cae 100644 --- a/test/arguments/without_writer_code/cpp/WithoutWriterCodeTest.cpp +++ b/test/arguments/without_writer_code/cpp/WithoutWriterCodeTest.cpp @@ -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("); @@ -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("); @@ -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("); @@ -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"); diff --git a/test/arguments/without_writer_code/java/without_writer_code/WithoutWriterCodeTest.java b/test/arguments/without_writer_code/java/without_writer_code/WithoutWriterCodeTest.java index 666a90add..0da0789e2 100644 --- a/test/arguments/without_writer_code/java/without_writer_code/WithoutWriterCodeTest.java +++ b/test/arguments/without_writer_code/java/without_writer_code/WithoutWriterCodeTest.java @@ -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("); @@ -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 diff --git a/test/arguments/without_writer_code/python/WithoutWriterCodeTest.py b/test/arguments/without_writer_code/python/WithoutWriterCodeTest.py index 303a3d7e1..8ae14f8b7 100644 --- a/test/arguments/without_writer_code/python/WithoutWriterCodeTest.py +++ b/test/arguments/without_writer_code/python/WithoutWriterCodeTest.py @@ -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") @@ -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) @@ -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") @@ -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) diff --git a/test/arguments/without_writer_code/zs/without_writer_code.zs b/test/arguments/without_writer_code/zs/without_writer_code.zs index 8a179945c..3f6d1a288 100644 --- a/test/arguments/without_writer_code/zs/without_writer_code.zs +++ b/test/arguments/without_writer_code/zs/without_writer_code.zs @@ -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