restructure code: split header and basic tests