File tree Expand file tree Collapse file tree 2 files changed +22
-10
lines changed
Expand file tree Collapse file tree 2 files changed +22
-10
lines changed Original file line number Diff line number Diff line change 11from pathlib import Path
22
3- from hdltools .mod_parse import ModParse
3+ from hdltools .hdl_reader import HDLReader
4+ from hdltools .mod_parser import ModParser
45
5- vfile = Path (__file__ ).parent .resolve () / 'hdl/modules.sv'
6+
7+ def get_vlog ():
8+ filepath = Path (__file__ ).parent .resolve () / 'hdl' / 'modules.sv'
9+ reader = HDLReader ()
10+ reader .read_file (filepath )
11+ return reader .get_code ()
612
713
814def test_modules ():
9- vobj = ModParse (vfile )
15+ vobj = ModParser (get_vlog ())
16+ vobj .parse ()
1017 modules = vobj .get_modules ()
1118 assert len (modules ) == 3
1219
1320
1421def test_empty ():
15- vobj = ModParse (vfile )
22+ vobj = ModParser (get_vlog ())
23+ vobj .parse ()
1624 module = vobj .get_module ('mod_empty' )
1725 assert module == {}
1826
1927
2028def test_params ():
21- vobj = ModParse (vfile )
29+ vobj = ModParser (get_vlog ())
30+ vobj .parse ()
2231 module = vobj .get_module ('mod_param' )
2332 assert 'params' in module
2433 params = {}
@@ -34,7 +43,8 @@ def test_params():
3443
3544
3645def test_ports ():
37- vobj = ModParse (vfile )
46+ vobj = ModParser (get_vlog ())
47+ vobj .parse ()
3848 module = vobj .get_module ('mod_param' )
3949 assert 'ports' in module
4050 ports = {
Original file line number Diff line number Diff line change 11from pathlib import Path
22
3- from hdltools .hdl_sanitize import HdlSanitize
3+ from hdltools .hdl_reader import HDLReader
44
5- vfile = Path (__file__ ).parent .resolve () / 'hdl/ modules.sv'
5+ vfile = Path (__file__ ).parent .resolve () / 'hdl' / ' modules.sv'
66
77
88def test_comments ():
9- vobj = HdlSanitize (vfile )
9+ vobj = HDLReader ()
10+ vobj .read_file (vfile )
1011 vcode = vobj .get_code ()
1112 comment_patterns = ['//' , '/*' , '*/' , '--' ]
1213 assert not any (pattern in vcode for pattern in comment_patterns )
1314
1415
1516def test_spaces ():
16- vobj = HdlSanitize (vfile )
17+ vobj = HDLReader ()
18+ vobj .read_file (vfile )
1719 vcode = vobj .get_code ()
1820 assert '\n ' not in vcode
1921 assert ' ' not in vcode
You can’t perform that action at this time.
0 commit comments