Skip to content

Commit

Permalink
Fix: AR4 record parser returns AR3 record value
Browse files Browse the repository at this point in the history
  • Loading branch information
cogu committed Mar 30, 2024
1 parent d42b196 commit 642e5e2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Komodo project files
*.komodoproject
#Virtual Environment
*.venv

# Compiled python modules.
*.pyc
Expand Down
2 changes: 1 addition & 1 deletion autosar/parser/constant_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def _parseRecordValueSpecification(self, xmlValue, parent):
raise NotImplementedError(xmlElem.tag)

if (xmlFields is not None):
record = autosar.constant.RecordValue(label, parent=parent)
record = autosar.constant.RecordValueAR4(label, parent=parent)
record.elements = self.parseValueV4(xmlFields, record)
return record
else:
Expand Down
2 changes: 2 additions & 0 deletions tests/arxml/ar4_value_builder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def test_create_record(self):
package = ws.createPackage('Constants', role='Constant')
c1 = package.createConstant('Result_IV', None, {'Status': 0, 'ID': 22, 'Message': 'OK'})
self.assertIsInstance(c1, autosar.constant.Constant)
self.assertIsInstance(c1.value, autosar.constant.RecordValueAR4)

file_name = 'record_constant.arxml'
generated_file = os.path.join(self.output_dir, file_name)
Expand All @@ -75,6 +76,7 @@ def test_create_record(self):
ws2.loadXML(os.path.join(os.path.dirname(__file__), expected_file))
c2 = ws2.find(c1.ref)
self.assertIsInstance(c2, autosar.constant.Constant)
self.assertIsInstance(c2.value, autosar.constant.RecordValueAR4)

def test_create_array(self):
ws = autosar.workspace(version="4.2.2")
Expand Down

0 comments on commit 642e5e2

Please sign in to comment.