Ten best practices for scientific software development.
Software testing is critical for maintaining quality code. But test-driven development can also be a tool for designing code with clean abstractions and an intuitive API.
Rule of thumb: you can only write three lines of bug-free code per day. No matter how well you think you've coded it, there are always mistakes. Write your code to anticipate this. Test-driven development allows you to write code that is not only self-documenting, but self-testing - allowing you to not only include new features, but test to make sure you aren't changing answers.
If you're writing scientific software, you will want to implement code verification, above and beyond simple testing to ensure that the code API works the same way. Verification is an implementation of tests that verify the mathematical answers returned by the code do not change over time (or, if they do, justification is given for why).
For linear solvers, you may implement verification as exact results, to 14 decimal places, to ensure exact answers. Or, you may require that certain tolerances be met, and set a general target level for solver accuracy.
Travis CI - run tests each time you commit code, ensure you can track changed answers and create blamelists for failed tests, and create version control for your answers/code output.