diff --git a/tests/__main__.py b/tests/__main__.py new file mode 100644 index 0000000..d9a7ffd --- /dev/null +++ b/tests/__main__.py @@ -0,0 +1,56 @@ +import sys +import os + +import math +import progress.bar +import glob + +# allow import from parent directory +sys.path.append(os.path.dirname(sys.path[0])) + +import gds + +global bar + +def callback(parser): + global bar + + bar.max = parser.total + bar.index = parser.current + bar.update() + +for arg in glob.glob("{}/tests/*.gds".format(sys.path[0])): + f = open(arg, "rb") + try: + bar = progress.bar.IncrementalBar("parsing file") + lib = gds.parse_file(f, progress_func=callback) + print() + + print("file version: {}".format(lib.version)) + print("last access: {}".format(lib.last_access.isoformat())) + print("last modification: {}".format(lib.last_mod.isoformat())) + print("m/unit : {}".format(lib.meters_per_unit)) + print("unit/dbunit : {}".format(lib.units_per_dbunit)) + + print("library name : {}".format(lib.name)) + print("contains a total of {} structure(s)".format(len(lib.structures))) + + for name in lib.structures.keys(): + #print(name, end = " ") + print("- {}".format(name)) + for elem in lib.structures[name].elements: + if isinstance(elem, gds.Boundary): + for coord in elem.points: + coord = (coord[0] * lib.units_per_dbunit , coord[1] * lib.units_per_dbunit) + + print("linking structure references") + lib.link_all_refs(callback) + + except gds.ParserError as e: + print("parser error: {}".format(e)) + except KeyboardInterrupt: + continue + finally: + f.close() + +print("all done") diff --git a/tests/test_aref.gds b/tests/test_aref.gds new file mode 100644 index 0000000..3caa67c Binary files /dev/null and b/tests/test_aref.gds differ diff --git a/tests/test_coords.gds b/tests/test_coords.gds new file mode 100644 index 0000000..f4021aa Binary files /dev/null and b/tests/test_coords.gds differ diff --git a/tests/test_path.gds b/tests/test_path.gds new file mode 100644 index 0000000..d237340 Binary files /dev/null and b/tests/test_path.gds differ diff --git a/tests/test_sref.gds b/tests/test_sref.gds new file mode 100644 index 0000000..6fb5db1 Binary files /dev/null and b/tests/test_sref.gds differ diff --git a/tests/test_sref_depth.gds b/tests/test_sref_depth.gds new file mode 100644 index 0000000..0328bba Binary files /dev/null and b/tests/test_sref_depth.gds differ diff --git a/tests/test_text.gds b/tests/test_text.gds new file mode 100644 index 0000000..4f85f90 Binary files /dev/null and b/tests/test_text.gds differ