Added unit tests for error generating functions