finalize function test