def METHOD_NAME(target, suffix):
    m.config.set_debug_mode(True)
    m.set_codegen_debug_info(True)
    with pytest.warns(DeprecationWarning):
        And2 = m.DeclareCircuit('And2', "I0", m.In(m.Bit), "I1", m.In(m.Bit),
                                "O", m.Out(m.Bit))
        main = m.DefineCircuit("main", "I", m.In(m.Bits[2]), "O", m.Out(m.Bit))
        and2 = And2()
        m.wire(main.I[0], and2.I0)
        m.wire(main.I[1], and2.I1)
        m.wire(and2.O, main.O)
        m.EndCircuit()
    m.compile("build/test_simple_def", main, output=target)
    assert check_files_equal(__file__, f"build/test_simple_def.{suffix}",
                             f"gold/test_simple_def.{suffix}")
    # Check that the subclassing pattern produces the same annotations
    class Main(m.Circuit):
        IO = ["I", m.In(m.Bits[2]), "O", m.Out(m.Bit)]
        @classmethod
        def definition(io):
            and2 = And2()
            m.wire(io.I[0], and2.I0)
            m.wire(io.I[1], and2.I1)
            m.wire(and2.O, io.O)
    # Create a fresh context for second compilation.
    m.compile("build/test_simple_def_class", Main, output=target)
    m.set_codegen_debug_info(False)
    m.config.set_debug_mode(False)
    assert check_files_equal(__file__, f"build/test_simple_def_class.{suffix}",
                             f"gold/test_simple_def_class.{suffix}")