Ejemplo n.º 1
0
 def test_generic_sort(self):
     generic = GenericSort()
     generic.variable('x')
     sort = Sort('sort')
     sort.operation('op_gen', (generic, generic))
     sort.operation('const', ())
     sort2 = Sort('sort2')
     sort2.operation('const', ())
     r = RewriteRule(sort.op_gen(generic.x(), generic.x()), generic.x())
     t1 = r.apply(sort.op_gen(sort2.const(), sort2.const()))
     self.assertEqual(t1, sort2.const())
     t2 = r.apply(sort.op_gen(sort2.const(), sort.const()))
     self.assertEqual(t2, sort.op_gen(sort2.const(), sort.const()))
Ejemplo n.º 2
0
 def test_variable(self):
     generic = GenericSort()
     generic.variable('x')
     self.assertEqual(type(generic.x), Variable)
     self.assertEqual(type(generic.x()), Term)