When I was writing device drivers for the middleware people, I found that unit tests were useful for testing the code and making sure the hardware was doing what it was supposed to. Along with the drivers, I released the test code to middleware so they could use it in their own code.