Skip to content

Commit cdec0cd

Browse files
committed
Tests renamed and updated
1 parent 61c2e5c commit cdec0cd

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,33 @@
11
from 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

814
def 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

1421
def 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

2028
def 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

3645
def 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 = {
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
from 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

88
def 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

1516
def 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

0 commit comments

Comments
 (0)