tests: use writeBinaryFile for golden tests