See [here](http://arduino.stackexchange.com/questions/56/what-is-the-best-way-to-unit-test-my-code-without-controller) and [here](https://github.com/mmurdoch/arduinounit), and maybe [here](https://code.google.com/p/arduinounit/).
See here and here, and maybe here.