def test_parser1():
    test_path = (pathlib.Path(__file__).parent / 'test1.sp').resolve()
    sp = SpiceParser(test_path, "test1", 0)
    g = sp.sp_parser()[0]
    assert len(g["graph"].nodes()) == 10
    assert len(g["ports"]) == 4
    assert 'vss' in g["ports"]  # A port name 0 should be changed to vss
def test_parser3():
    test_path = pathlib.Path(__file__).resolve().parent / 'ota.sp'
    sp = SpiceParser(test_path, "ota", 0)
    g = sp.sp_parser()[0]
    assert len(g["graph"].nodes()) == 25  # number of nodes in OTA
    test_path = pathlib.Path(__file__).resolve().parent / 'basic_template.sp'
    lib_sp = SpiceParser(test_path)
    lib_list = lib_sp.sp_parser()
    #shutil.rmtree("library_graphs")
    assert len(lib_list) == 31  ## 18 subckt in basic template
    return (g["graph"], lib_list)
示例#3
0
def test_parser3():
    test_path = pathlib.Path(
        __file__).resolve().parent / 'test_circuits' / 'ota' / 'ota.sp'
    sp = SpiceParser(test_path, "ota", 0)
    g = sp.sp_parser()[0]
    assert len(g["graph"].nodes()) == 25  # number of nodes in OTA
    test_path = pathlib.Path(
        __file__).resolve().parent / 'test_circuits' / 'basic_template.sp'
    lib_sp = SpiceParser(test_path)
    lib_list = lib_sp.sp_parser()
    assert len(lib_list) == 46  ## 18 subckt in basic template
    return (g["graph"], lib_list)
def test_parser2():
    test_path = (pathlib.Path(__file__).parent / 'test2.sp').resolve()
    sp = SpiceParser(test_path, "test2", 0)
    g = sp.sp_parser()[0]
    assert len(g["graph"].nodes()) == 12