Skip to content
Snippets Groups Projects
test_codegen.py 809 B
Newer Older
  • Learn to ignore specific revisions
  • from b_asic.codegen.vhdl.common import is_valid_vhdl_identifier
    
    
    def test_is_valid_vhdl_identifier():
        identifier_pass = {
            "COUNT",
            "X",
            "c_out",
            "FFT",
            "Decoder",
            "VHSIC",
            "X1",
            "PageCount",
            "STORE_NEXT_ITEM",
            "ValidIdentifier123",
            "valid_identifier",
        }
        identifier_fail = {
            "",
            "architecture",
            "Architecture",
            "ArChItEctUrE",
            "entity",
            "invalid+",
            "invalid}",
            "not-valid",
            "(invalid)",
            "invalid£",
            "1nvalid",
            "_abc",
        }
    
        for identifier in identifier_pass:
            assert is_valid_vhdl_identifier(identifier)
    
        for identifier in identifier_fail:
            assert not is_valid_vhdl_identifier(identifier)