Exemple #1
0
    def test_complicated_string(self):
        """Hardest test of all, filled with multiple replacements and
        all of the pre-processing techniques"""
        buf = "\n\n\
              `define B 2 \n\
              `define A `B \n\
              `define C 4 \n\
              module test ();\n\
              endmodule"

        define_dict = preprocessor.generate_define_table(buf, debug=False)
        result = preprocessor.resolve_defines("val[(`A * `B * `C):((`C)-(`A))]", define_dict, debug = self.dbg)
        result = preprocessor.evaluate_range(result, define_dict, debug=False)
        #print "result: %s" % result

        self.assertEqual(result, "val[16:2]")
Exemple #2
0
 def test_evaluate_range(self):
     """test whether resolve string will get rid of parenthesis"""
     result = preprocessor.evaluate_range("val[(48 -12):0]", debug = self.dbg)
     self.assertEqual(result == "val[36:0]", True)