Unit testing considerations and examples

What complex hardware? an arduino board or the buzzer? They seem simple to me?

There is a type of automated testing called regression tests testing - Unit Test? Integration Test? Regression Test? Acceptance Test? - Stack Overflow Maybe this is different than unit testing per se.

There is also this article on the pertinence of unit tests in microcontroller code: Unit testing in embedded systems: 3 myths and an automated tip - StarFish Medical

The buzzer library may not be the best example to start with, but I think most modules should be individually tested