OPT code improvements

* Test suite refactored with a `foreach` test specification
* Type specs for all functions in the gen_planet module