Make tests platform independent and fix code style