Issue#1232: Updated tests for rule port_018.
This commit is contained in:
parent
c2c07ef689
commit
6aaa7b6366
|
|
@ -1,33 +0,0 @@
|
|||
|
||||
entity FIFO is
|
||||
|
||||
port (
|
||||
I_PORT1 : in integer;
|
||||
I_PORT2 : in std_logic;
|
||||
I_PORTA : in t_user2;
|
||||
I_PORT3 : in std_logic_vector(3 downto 0);
|
||||
I_PORT4 : in signed(15 downto 0);
|
||||
I_PORT5 : in unsigned(7 downto 0);
|
||||
I_PORT6 : in std_ulogic;
|
||||
I_PORT7 : in t_user1
|
||||
);
|
||||
|
||||
end entity FIFO;
|
||||
|
||||
|
||||
-- Violation below
|
||||
|
||||
entity FIFO is
|
||||
|
||||
port (
|
||||
I_PORT1 : in integer;
|
||||
I_PORT2 : in std_logic;
|
||||
I_PORTA : in t_user2;
|
||||
I_PORT3 : in std_logic_vector(3 downto 0);
|
||||
I_PORT4 : in signed(15 downto 0);
|
||||
I_PORT5 : in unsigned(7 downto 0);
|
||||
I_PORT6 : in std_ulogic;
|
||||
I_PORT7 : in t_user1
|
||||
);
|
||||
|
||||
end entity FIFO;
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
|
||||
entity FIFO is
|
||||
|
||||
port (
|
||||
I_PORT1 : in INTEGER;
|
||||
I_PORT2 : in STD_LOGIC;
|
||||
I_PORTA : in t_user2;
|
||||
I_PORT3 : in STD_LOGIC_VECTOR(3 downto 0);
|
||||
I_PORT4 : in SIGNED(15 downto 0);
|
||||
I_PORT5 : in UNSIGNED(7 downto 0);
|
||||
I_PORT6 : in STD_ULOGIC;
|
||||
I_PORT7 : in t_user1
|
||||
);
|
||||
|
||||
end entity FIFO;
|
||||
|
||||
|
||||
-- Violation below
|
||||
|
||||
entity FIFO is
|
||||
|
||||
port (
|
||||
I_PORT1 : in INTEGER;
|
||||
I_PORT2 : in STD_LOGIC;
|
||||
I_PORTA : in t_user2;
|
||||
I_PORT3 : in STD_LOGIC_VECTOR(3 downto 0);
|
||||
I_PORT4 : in SIGNED(15 downto 0);
|
||||
I_PORT5 : in UNSIGNED(7 downto 0);
|
||||
I_PORT6 : in STD_ULOGIC;
|
||||
I_PORT7 : in t_user1
|
||||
);
|
||||
|
||||
end entity FIFO;
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
|
||||
entity FIFO is
|
||||
|
||||
port (
|
||||
I_PORT1 : in integer;
|
||||
I_PORT2 : in std_logic;
|
||||
I_PORTA : in t_user2;
|
||||
I_PORT3 : in std_logic_vector(3 downto 0);
|
||||
I_PORT4 : in signed(15 downto 0);
|
||||
I_PORT5 : in unsigned(7 downto 0);
|
||||
I_PORT6 : in std_ulogic;
|
||||
I_PORT7 : in t_user1
|
||||
);
|
||||
|
||||
end entity FIFO;
|
||||
|
||||
|
||||
-- Violation below
|
||||
|
||||
entity FIFO is
|
||||
|
||||
port (
|
||||
I_PORT1 : in INTEGER;
|
||||
I_PORT2 : in STD_LOGIC;
|
||||
I_PORTA : in t_user2;
|
||||
I_PORT3 : in STD_LOGIC_VECTOR(3 downto 0);
|
||||
I_PORT4 : in SIGNED(15 downto 0);
|
||||
I_PORT5 : in UNSIGNED(7 downto 0);
|
||||
I_PORT6 : in STD_ULOGIC;
|
||||
I_PORT7 : in t_user1
|
||||
);
|
||||
|
||||
end entity FIFO;
|
||||
|
|
@ -1,74 +1,14 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from tests import utils
|
||||
from vsg import vhdlFile
|
||||
from vsg.rules import port
|
||||
|
||||
sTestDir = os.path.dirname(__file__)
|
||||
|
||||
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_018_test_input.vhd"))
|
||||
|
||||
lExpected_lower = []
|
||||
lExpected_lower.append("")
|
||||
utils.read_file(os.path.join(sTestDir, "rule_018_test_input.fixed_lower.vhd"), lExpected_lower)
|
||||
|
||||
lExpected_upper = []
|
||||
lExpected_upper.append("")
|
||||
utils.read_file(os.path.join(sTestDir, "rule_018_test_input.fixed_upper.vhd"), lExpected_upper)
|
||||
|
||||
|
||||
class test_port_rule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.oFile = vhdlFile.vhdlFile(lFile)
|
||||
self.assertIsNone(eError)
|
||||
|
||||
def test_rule_018_lower(self):
|
||||
class test_rule(unittest.TestCase):
|
||||
def test_rule_018(self):
|
||||
oRule = port.rule_018()
|
||||
self.assertTrue(oRule)
|
||||
self.assertEqual(oRule.name, "port")
|
||||
self.assertEqual(oRule.identifier, "018")
|
||||
self.assertEqual(oRule.groups, ["case", "case::keyword"])
|
||||
|
||||
lExpected = [23, 24, 26, 27, 28, 29]
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)
|
||||
|
||||
def test_rule_018_upper(self):
|
||||
oRule = port.rule_018()
|
||||
oRule.case = "upper"
|
||||
self.assertTrue(oRule)
|
||||
self.assertEqual(oRule.name, "port")
|
||||
self.assertEqual(oRule.identifier, "018")
|
||||
|
||||
lExpected = [5, 6, 8, 9, 10, 11]
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(utils.extract_violation_lines_from_violation_object(oRule.violations), lExpected)
|
||||
|
||||
def test_fix_rule_018_lower(self):
|
||||
oRule = port.rule_018()
|
||||
|
||||
oRule.fix(self.oFile)
|
||||
|
||||
lActual = self.oFile.get_lines()
|
||||
|
||||
self.assertEqual(lExpected_lower, lActual)
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(oRule.violations, [])
|
||||
|
||||
def test_fix_rule_018_upper(self):
|
||||
oRule = port.rule_018()
|
||||
oRule.case = "upper"
|
||||
|
||||
oRule.fix(self.oFile)
|
||||
|
||||
lActual = self.oFile.get_lines()
|
||||
|
||||
self.assertEqual(lExpected_upper, lActual)
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(oRule.violations, [])
|
||||
self.assertTrue(oRule.deprecated)
|
||||
|
|
|
|||
Loading…
Reference in New Issue