It is rather common in embedded code to have an endless loop at the end of small test programs.
Note: to OP I am trying to write my embedded code so I can test it with normal C compilers to verify simple unit tests. But, I am my own test team. It seems much easier/faster to test the code on a normal PC than on a micro-controller. I still have to test on the micro-controller; but, it reduces the problems found at that point.
Tim S.