def test_unify_matrix_indexed_named_variable_real(): tenv = {} Tmatrix().unify(Tindexed(Tnamed(tenv, "x")), tenv=tenv) Tindexed(Tnamed(tenv, "y")).unify(Tnamed(tenv, "x"), tenv=tenv) Treal().unify(Tnamed(tenv, "y"), tenv=tenv)
def test_unify_matrix_indexed_named_variable_int(): with pytest.raises(IncompatibleTypes): tenv = {} Tmatrix().unify(Tindexed(Tnamed(tenv, "x")), tenv=tenv) Tindexed(Tnamed(tenv, "y")).unify(Tnamed(tenv, "x"), tenv=tenv) Tint().unify(Tnamed(tenv, "y"), tenv=tenv)
def test_unify_variable_indexed(): Tnew().unify(Tindexed(Tint()))
def test_unify_named_variable_indexed(): tenv = {} Tnamed(tenv, "x").unify(Tindexed(Tint()), tenv=tenv)
def test_unify_matrix_indexed_real2(): Tmatrix().unify(Tindexed(Tindexed(Treal())))
def test_unify_matrix_indexed_real3(): with pytest.raises(IncompatibleTypes): Tmatrix().unify(Tindexed(Tindexed(Tindexed(Treal()))))
def test_unify_matrix_indexed2(): Tmatrix().unify(Tindexed(Tindexed()))
def test_unify_vector_indexed_int(): with pytest.raises(IncompatibleTypes): Tvector().unify(Tindexed(Tint()))
def test_unify_vector_indexed_real(): Tvector().unify(Tindexed(Treal()))
def test_unify_array_indexed_int(): with pytest.raises(IncompatibleTypes): Tarray(Treal()).unify(Tindexed(Tint()))
def test_unify_array_indexed_real(): Tarray(Treal()).unify(Tindexed(Treal()))