unit tests for cptwrite()