summaryrefslogtreecommitdiff
path: root/gerbonara/tests/test_kicad_sexpr.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2023-04-15 17:09:20 +0200
committerjaseg <git@jaseg.de>2023-04-15 17:09:20 +0200
commit2400ff8e5fea41c1f8c6251d37a02209ec253f93 (patch)
tree395968d05156c094709fda605a9fe572aed32b1d /gerbonara/tests/test_kicad_sexpr.py
parentb43e4e2eec99b92a1e87f6388703db1ca33518d1 (diff)
downloadgerbonara-2400ff8e5fea41c1f8c6251d37a02209ec253f93.tar.gz
gerbonara-2400ff8e5fea41c1f8c6251d37a02209ec253f93.tar.bz2
gerbonara-2400ff8e5fea41c1f8c6251d37a02209ec253f93.zip
cad: Add KiCad symbol/footprint parser
Diffstat (limited to 'gerbonara/tests/test_kicad_sexpr.py')
-rw-r--r--gerbonara/tests/test_kicad_sexpr.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/gerbonara/tests/test_kicad_sexpr.py b/gerbonara/tests/test_kicad_sexpr.py
new file mode 100644
index 0000000..b2c60b1
--- /dev/null
+++ b/gerbonara/tests/test_kicad_sexpr.py
@@ -0,0 +1,26 @@
+
+from ..cad.kicad.sexp import parse_sexp, build_sexp
+
+def test_sexp_round_trip():
+ test_sexp = '''(()() (foo) (23)\t(foo 23) (foo 23 bar baz) (foo bar baz) ("foo bar") (" foo " bar) (23 " baz ")
+ (foo ( bar ( baz 23) 42) frob) (() (foo) ()()) foo 23 23.0 23.000001 "foo \\"( ))bar" "foo\\"bar\\"baz" "23" "23foo"
+ "" "" ("") ("" 0 0.0)
+ "lots of data" "lots of data" "lots of data" "lots of data" "lots of data" "lots of data"
+ "lots of data" "lots of data" "lots of data" "lots of data" "lots of data" "lots of data"
+ "lots of data" "lots of data" "lots of data" "lots of data" "lots of data" "lots of data"
+ "lots of data" "lots of data" "lots of data" "lots of data" "lots of data" "lots of data"
+ "lots of data" "lots of data" "lots of data" "lots of data" "lots of data" "lots of data"
+ "lots of data" "lots of data" "lots of data" "lots of data" "lots of data" "lots of data"
+ "lots of data" "lots of data" "lots of data" "lots of data" "lots of data" "lots of data"
+ "lots of data" "lots of data" "lots of data" "lots of data" "lots of data" "lots of data"
+ "lots of data" "lots of data" "lots of data" "lots of data" "lots of data" "lots of data"
+ "lots of data" "lots of data" "lots of data" "lots of data" "lots of data" "lots of data")
+ '''
+ parsed = parse_sexp(test_sexp)
+ sexp1 = build_sexp(parsed)
+ re_parsed = parse_sexp(sexp1)
+ sexp2 = build_sexp(parsed)
+
+ assert re_parsed == parsed
+ assert sexp1 == sexp2
+