import vlsir
from vlsirtools.netlist import (
    netlist_from_proto,
)


def test_netlist_from_proto1():
    """Netlisting from protobuf, smoke test"""

    netlist_path = "scratch/test_netlist1.sp"
    netlist_from_proto(
        vlsir.netlist.NetlistInput(
            pkg=vlsir.circuit.Package(),
            netlist_path=netlist_path,
            fmt=vlsir.netlist.NetlistFormat.SPICE,
            result_path="scratch/test_netlist1.result.pb",  # (this doesn't do anything)
        )
    )
    readback = open(netlist_path, "r").read()
    assert len(readback) > 0
    # These are tests we often come to regret, checking netlist literal content. But gotta do something for now!
    assert "* Anonymous `circuit.Package`" in readback
    assert "* Generated by `vlsirtools.SpiceNetlister`" in readback
