def test_assign_variable_int(self): a = Ambiente() a.extend(Variable('x'), Var('a')) s = Sustitucion() s.push(Var('a'), Int()) self.assertEqual(a.assign(Variable('x'), Int()), s)
def test_assign_lambda_fun(self): a = Ambiente() s = Sustitucion() s.push(Var('a'), Bool()) s.push(Var('b'), Int()) self.assertEqual(a.assign(Lambda(Variable('x'), Entero(12)), Fun(Bool(), Int())), s)
def test_assign_aplicar_int(self): a = Ambiente() x = Aplicacion(Lambda(Variable('x'), Suma(Variable('x'), Entero(1))), Entero(12)) y = Int() s = Sustitucion() s.push(Var('a'), Int()) s.push(Var('b'), Int()) self.assertEqual(a.assign(x, y), s)
def test_assign_conjuncion_bool(self): a = Ambiente() self.assertEqual(a.assign(Conjuncion(Booleano(True), Booleano(False)), Bool()), Sustitucion())
def test_assign_menorque_bool(self): a = Ambiente() self.assertEqual(a.assign(MenorQue(Entero(12), Entero(14)), Bool()), Sustitucion())
def test_assign_suma_int(self): a = Ambiente() self.assertEqual(a.assign(Suma(Entero(12), Entero(14)), Int()), Sustitucion())
def test_assign_entero_int(self): a = Ambiente() self.assertEqual(a.assign(Entero(12), Int()), Sustitucion())
def test_extend_find_non_existing(self): a = Ambiente() a.extend(Variable('x'), Int()) self.assertEqual(a.find(Variable('y')), None)
def test_find_empty(self): a = Ambiente() self.assertEqual(a.find(Variable('x')), None)