1
2from gd32pinctrl import main
3
4
5def test_main(data, tmp_path):
6    """Test that pinctrl headers are generated correctly."""
7
8    main(data, tmp_path)
9
10    FILES = (
11        "gd32f888x(0-1)xx-pinctrl.h",
12        "gd32f888x(2-3)xx-pinctrl.h",
13        "gd32f888y(0-1)xx-pinctrl.h",
14        "gd32f999x(0-1)xx-pinctrl.h",
15        "gd32f999x(2-3)xx-pinctrl.h",
16        "gd32f999y(0-1)xx-pinctrl.h",
17    )
18
19    for file in FILES:
20        ref_file = data / file
21        gen_file = tmp_path / file
22
23        assert gen_file.exists()
24
25        with open(ref_file) as ref, open(gen_file) as gen:
26            assert ref.read() == gen.read()
27