Subaru: ensure consistent firmware version size (#31001)
	
		
	
				
					
				
			* fix copying mistakes
* fix SA
* remove print
* ensure size is same
* fix SA
* not in database
old-commit-hash: 94cd4c9046
			
			
				pull/32199/head
			
			
		
							parent
							
								
									e9e1d4559b
								
							
						
					
					
						commit
						35bc540ee5
					
				
				 2 changed files with 22 additions and 3 deletions
			
			
		@ -0,0 +1,20 @@ | 
				
			|||||||
 | 
					from cereal import car | 
				
			||||||
 | 
					import unittest | 
				
			||||||
 | 
					from openpilot.selfdrive.car.subaru.fingerprints import FW_VERSIONS | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Ecu = car.CarParams.Ecu | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ECU_NAME = {v: k for k, v in Ecu.schema.enumerants.items()} | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class TestSubaruFingerprint(unittest.TestCase): | 
				
			||||||
 | 
					  def test_fw_version_format(self): | 
				
			||||||
 | 
					    for platform, fws_per_ecu in FW_VERSIONS.items(): | 
				
			||||||
 | 
					      for (ecu, _, _), fws in fws_per_ecu.items(): | 
				
			||||||
 | 
					        fw_size = len(fws[0]) | 
				
			||||||
 | 
					        for fw in fws: | 
				
			||||||
 | 
					          self.assertEqual(len(fw), fw_size, f"{platform} {ecu}: {len(fw)} {fw_size}") | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == "__main__": | 
				
			||||||
 | 
					  unittest.main() | 
				
			||||||
					Loading…
					
					
				
		Reference in new issue