Example #1
0
 def test_parser_3(self):
     """Test parser with TEST_MODULE_3"""
     moddict = ModDict()
     moddict.parse(inputs.TEST_MODULE_3)
     stores = moddict.stores()
     print(stores)
     self.assertEqual(eval(stores), TEST_MODULE_3_REF)
Example #2
0
    def test_parser_4(self):
        """Test parser with TEST_MODULE_4"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_4)
        stores = moddict.stores()

        self.assertEqual(eval(stores), TEST_MODULE_4_REF)
Example #3
0
    def test_past_as_initwire_4(self):
        """Test past as initwire with TEST_MODULE_4"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_4)

        printer = Printer(moddict, indent_size=2)
        initwire = printer['InitWire']

        self.assertEqual('\n' + initwire, TEST_MODULE_4_REF)
Example #4
0
    def test_past_as_clockingblock_2(self):
        """Test past as clockingblock with TEST_MODULE_2"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_2)

        printer = Printer(moddict, indent_size=2)
        clockingblock = printer['ClockingBlock']

        self.assertEqual('\n' + clockingblock, TEST_MODULE_2_REF)
Example #5
0
    def test_past_as_parameters_2(self):
        """Test past as parameters with TEST_MODULE_2"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_2)

        printer = Printer(moddict, indent_size=2)
        parameters = printer['Parameters']

        self.assertEqual('\n' + parameters, TEST_MODULE_2_REF)
    def test_past_as_wavedisp_4(self):
        """Test past as wavedisp with TEST_MODULE_4"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_4)

        printer = Printer(moddict, indent_size=3)
        wavedisp = printer['Wavedisp']

        self.assertEqual('\n' + wavedisp, TEST_MODULE_4_REF)
    def test_past_as_instance_4_instance_name(self):
        """Test past as instance with TEST_MODULE_4"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_4)

        printer = Printer(moddict, indent_size=2, instance_name='new_name')
        instance = printer['Instance']

        self.assertEqual('\n' + instance, TEST_MODULE_4_INSTANCE_NAME_REF)
    def test_past_as_instance_3(self):
        """Test past as instance with TEST_MODULE_3"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_3)

        printer = Printer(moddict, indent_size=2)
        instance = printer['Instance']

        self.assertEqual('\n' + instance, TEST_MODULE_3_REF)
Example #9
0
    def test_past_as_logic_4(self):
        """Test past as logic with TEST_MODULE_4"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_4)

        printer = Printer(moddict, indent_size=2)
        logic = printer['Logic']

        self.assertEqual('\n' + logic, TEST_MODULE_4_REF)
Example #10
0
    def test_past_as_module_4(self):
        """Test past as module with TEST_MODULE_4"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_4)

        printer = Printer(moddict, indent_size=3)
        module = printer['Module']

        self.assertEqual('\n' + module, TEST_MODULE_4_REF)
    def test_past_as_doctable_3(self):
        """Test past as doctable with TEST_MODULE_3"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_3)

        printer = Printer(moddict, indent_size=2)
        doctable = printer['DocTable']

        self.assertEqual(doctable, TEST_MODULE_3_REF)
Example #12
0
    def test_past_as_initlatch_2(self):
        """Test past as initlatch with TEST_MODULE_2"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_2)

        printer = Printer(moddict, indent_size=2)
        initlatch = printer['InitLatch']

        self.assertEqual('\n' + initlatch, TEST_MODULE_2_REF)
Example #13
0
    def test_past_as_importlist_1(self):
        """Test past as importlist with TEST_MODULE_1"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_1)

        printer = Printer(moddict, indent_size=2)
        importlist = printer['ImportList']
        print(importlist)
        self.assertEqual('\n' + importlist, TEST_MODULE_4_REF)
Example #14
0
    def test_past_as_signals_4(self):
        """Test past as signals with TEST_MODULE_4"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_4)

        printer = Printer(moddict, indent_size=2)
        signals = printer['Signals']

        self.assertEqual('\n' + signals, TEST_MODULE_4_REF)
Example #15
0
    def test_loads_stores(self):
        """Test parser 'loads' and 'stores' methods"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_0)

        stores = moddict.stores()
        moddict2 = ModDict()
        moddict2.loads(stores)

        self.assertEqual(stores, moddict2.stores())
    def test_past_as_modulename_4(self):
        """Test past as modulename with TEST_MODULE_4"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_4)

        printer = Printer(moddict, indent_size=2)
        modulename = printer['ModuleName']

        print(modulename)
        self.assertEqual(modulename, TEST_MODULE_4_REF)
Example #17
0
    def test_load_store(self):
        """Test parser 'load' and 'store' methods"""
        moddict = ModDict()
        moddict.parse(inputs.TEST_MODULE_0)

        filename = '__test_load_store.txt'

        moddict.store(filename)
        moddict2 = ModDict()
        moddict2.load(filename)

        self.assertEqual(eval(moddict2.stores()), TEST_MODULE_0_REF)

        os.remove(filename)