@@ -279,6 +279,35 @@ def test_show_disclaimer_false(tmp_path: Path, simple_regmap: csr.Map) -> None:
279279 assert "Generated by [Corsair]" not in content
280280
281281
282+ def test_show_hardware_mode_true (tmp_path : Path , simple_regmap : csr .Map ) -> None :
283+ """Test that hardware mode conventions and column are present when show_hardware_mode is True."""
284+ config = csr .MarkdownGenerator .Config (show_hardware_mode = True )
285+ gen = csr .MarkdownGenerator (
286+ label = "test_md_gen_hw_mode_true" , register_map = simple_regmap , config = config , output_dir = tmp_path
287+ )
288+ generated_files = list (gen ())
289+ output_file = generated_files [0 ]
290+ content = output_file .read_text ()
291+ assert "## Conventions" in content # Assuming conventions are shown by default or with hardware mode
292+ assert "| Hardware mode | Description |" in content
293+ assert "| Hardware |" in content # Check for the column in the fields table
294+
295+
296+ def test_show_hardware_mode_false (tmp_path : Path , simple_regmap : csr .Map ) -> None :
297+ """Test that hardware mode conventions and column are absent when show_hardware_mode is False."""
298+ config = csr .MarkdownGenerator .Config (show_hardware_mode = False )
299+ gen = csr .MarkdownGenerator (
300+ label = "test_md_gen_hw_mode_false" , register_map = simple_regmap , config = config , output_dir = tmp_path
301+ )
302+ generated_files = list (gen ())
303+ output_file = generated_files [0 ]
304+ content = output_file .read_text ()
305+ # Assuming default of show_conventions=True, so "## Conventions" might still be there
306+ # We specifically check for the *hardware mode* conventions table
307+ assert "| Hardware mode | Description |" not in content
308+ assert "| Hardware |" not in content # Check for the column in the fields table
309+
310+
282311def test_custom_template_and_extra_param (tmp_path : Path , simple_regmap : csr .Map , custom_template : Path ) -> None :
283312 """Test generation with a custom template and extra config parameters."""
284313 template_file = custom_template
0 commit comments