Add test code for setting negative weight