forked from jeremiah-c-leary/vhdl-style-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_rule_100.py
More file actions
48 lines (32 loc) · 1.3 KB
/
test_rule_100.py
File metadata and controls
48 lines (32 loc) · 1.3 KB
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*- coding: utf-8 -*-
import os
import unittest
from tests import utils
from vsg import vhdlFile
from vsg.rules import constrained_array_definition
sTestDir = os.path.dirname(__file__)
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_100_test_input.vhd"))
dIndentMap = utils.read_indent_file()
lExpected = []
lExpected.append("")
utils.read_file(os.path.join(sTestDir, "rule_100_test_input.fixed.vhd"), lExpected)
class test_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)
self.oFile.set_indent_map(dIndentMap)
def test_rule_100(self):
oRule = constrained_array_definition.rule_100()
self.assertTrue(oRule)
self.assertEqual(oRule.name, "constrained_array_definition")
self.assertEqual(oRule.identifier, "100")
lExpected = [4, 7]
oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
def test_fix_rule_100(self):
oRule = constrained_array_definition.rule_100()
oRule.fix(self.oFile)
lActual = self.oFile.get_lines()
self.assertEqual(lExpected, lActual)
oRule.analyze(self.oFile)
self.assertEqual(oRule.violations, [])