summaryrefslogtreecommitdiff
path: root/gerbonara/tests/test_kicad_sexpr.py
blob: b2c60b1240fca282579e44b6eae512f5e94aca69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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