rewrite the unit tests for cpu version