1from genllheaders import main 2 3 4def test_main(data, hal_path, tmp_path): 5 """Test that common LL headers are generated correctly.""" 6 7 main(hal_path, tmp_path) 8 9 # check README file 10 ref_readme_file = data / "README.rst" 11 gen_readme_file = tmp_path / "README.rst" 12 13 assert gen_readme_file.exists() 14 15 with open(ref_readme_file) as ref, open(gen_readme_file) as gen: 16 assert ref.read() == gen.read() 17 18 # check tim file 19 ref_tim_file = data / "stm32_ll_tim.h" 20 gen_tim_file = tmp_path / "include" / "stm32_ll_tim.h" 21 22 assert gen_tim_file.exists() 23 24 with open(ref_tim_file) as ref, open(gen_tim_file) as gen: 25 assert ref.read() == gen.read() 26 27 # check usart file 28 ref_usart_file = data / "stm32_ll_usart.h" 29 gen_usart_file = tmp_path / "include" / "stm32_ll_usart.h" 30 31 assert gen_usart_file.exists() 32 33 with open(ref_usart_file) as ref, open(gen_usart_file) as gen: 34 assert ref.read() == gen.read() 35 36 # check usb file is not created (ignore list) 37 gen_usb_file = tmp_path / "include" / "stm32_ll_usb.h" 38 39 assert not gen_usb_file.exists() 40