30 lines
778 B
Python
30 lines
778 B
Python
|
|
import os
|
|
import unittest
|
|
|
|
from vsg.rules import function
|
|
from vsg import vhdlFile
|
|
from vsg.tests import utils
|
|
|
|
sTestDir = os.path.dirname(__file__)
|
|
|
|
lFile, eError =vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir,'rule_601_test_input.vhd'))
|
|
|
|
|
|
class test_function_rule(unittest.TestCase):
|
|
|
|
def setUp(self):
|
|
self.oFile = vhdlFile.vhdlFile(lFile)
|
|
self.assertIsNone(eError)
|
|
|
|
def test_rule_601(self):
|
|
oRule = function.rule_601()
|
|
self.assertTrue(oRule)
|
|
self.assertEqual(oRule.name, 'function')
|
|
self.assertEqual(oRule.identifier, '601')
|
|
|
|
lExpected = [18, 20, 22, 23, 25, 26]
|
|
|
|
oRule.analyze(self.oFile)
|
|
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
|