Add unittests for coin handling