Static typing or functional programming can protect you only from some types of problems. With automated tests you have the flexibility to define the problem you are verifying your code against.
By the same token, tests can only verify certain properties of a function. How could you test that a function is free from side-effects? How could you test it never returns null?