@@ -266,6 +266,12 @@ def test_invalid_struct_field(self):
266
266
parser = ClusterParser (et , self .cluster_id , self .cluster_name )
267
267
cluster = parser .create_cluster ()
268
268
problems = parser .get_problems ()
269
+
270
+ # Verify the valid field was parsed and the invalid one generated a problem
271
+ asserts .assert_true ("TestStruct" in cluster .structs , "TestStruct not found in parsed structs" )
272
+ struct = cluster .structs ["TestStruct" ]
273
+ asserts .assert_equal (len (struct .components ), 1 , "Should only have one valid field" )
274
+ asserts .assert_true ("1" in struct .components , "Valid field not found in struct components" )
269
275
asserts .assert_equal (len (problems ), 1 , "Should have one problem for invalid field" )
270
276
asserts .assert_true ("Struct field in TestStruct with no id or name" in problems [0 ].problem ,
271
277
"Problem message doesn't match expected error" )
@@ -378,18 +384,24 @@ def test_invalid_enum_item(self):
378
384
parser = ClusterParser (et , self .cluster_id , self .cluster_name )
379
385
cluster = parser .create_cluster ()
380
386
problems = parser .get_problems ()
387
+
388
+ # Verify the valid item was parsed and the invalid one generated a problem
389
+ asserts .assert_true ("TestEnum" in cluster .enums , "TestEnum not found in parsed enums" )
390
+ enum = cluster .enums ["TestEnum" ]
391
+ asserts .assert_equal (len (enum .components ), 1 , "Should only have one valid item" )
392
+ asserts .assert_true ("0" in enum .components , "Valid item not found in enum components" )
381
393
asserts .assert_equal (len (problems ), 1 , "Should have one problem for invalid item" )
382
394
asserts .assert_true ("Struct field in TestEnum with no id or name" in problems [0 ].problem ,
383
- "Problem message doesn't match expected error" )
395
+ "Problem message doesn't match expected error" )
384
396
385
397
def test_invalid_bitmap_field (self ):
386
- """Test handling of a bitmap with an invalid field (missing bit)"""
398
+ """Test handling of a bitmap with an invalid bitfield (missing bit)"""
387
399
# Create a bitmap with one valid field and one invalid field (missing bit)
388
400
bitmap_xml = """<bitmap name="TestBitmap">
389
401
<bitfield bit="0" name="Bit0">
390
402
<mandatoryConform/>
391
403
</bitfield>
392
- <bitfield name="InvalidBitfield ">
404
+ <bitfield name="InvalidBit ">
393
405
<mandatoryConform/>
394
406
</bitfield>
395
407
</bitmap>"""
@@ -403,9 +415,15 @@ def test_invalid_bitmap_field(self):
403
415
parser = ClusterParser (et , self .cluster_id , self .cluster_name )
404
416
cluster = parser .create_cluster ()
405
417
problems = parser .get_problems ()
418
+
419
+ # Verify the valid field was parsed and the invalid one generated a problem
420
+ asserts .assert_true ("TestBitmap" in cluster .bitmaps , "TestBitmap not found in parsed bitmaps" )
421
+ bitmap = cluster .bitmaps ["TestBitmap" ]
422
+ asserts .assert_equal (len (bitmap .components ), 1 , "Should only have one valid field" )
423
+ asserts .assert_true ("0" in bitmap .components , "Valid bitfield not found in bitmap components" )
406
424
asserts .assert_equal (len (problems ), 1 , "Should have one problem for invalid bitfield" )
407
425
asserts .assert_true ("Struct field in TestBitmap with no id or name" in problems [0 ].problem ,
408
- "Problem message doesn't match expected error" )
426
+ "Problem message doesn't match expected error" )
409
427
410
428
def test_missing_name (self ):
411
429
"""Test handling of a data type with missing name attribute"""
0 commit comments