Restructured unit tests

Redundant code is consolidated and required example files are all
defined in one place.