swap function test